From: maxious Date: Sun, 28 Nov 2010 11:34:48 +0000 Subject: Upgrade origin-src to google transit feed 1.2.6 X-Git-Url: http://maxious.lambdacomplex.org/git/?p=bus.git&a=commitdiff&h=37252563b03abca4a228babcdb3291e400553929 --- Upgrade origin-src to google transit feed 1.2.6 --- --- a/busui/common.inc.php +++ b/busui/common.inc.php @@ -19,10 +19,15 @@ bus.lambdacomplex.org - '.$pageTitle.' - + + - @@ -34,7 +39,6 @@

'.$pageTitle.'

- Home
'; } @@ -87,31 +91,71 @@ return $f; } -function staticmap($mapPoints) +function staticmap($mapPoints, $zoom = 0, $markerImage = "iconb") { $width = 300; $height = 300; -$zoom = 0; +$metersperpixel[9]=305.492*$width; +$metersperpixel[10]=152.746*$width; +$metersperpixel[11]=76.373*$width; +$metersperpixel[12]=38.187*$width; +$metersperpixel[13]=19.093*$width; +$metersperpixel[14]=9.547*$width; +$metersperpixel[15]=4.773*$width; +$metersperpixel[16]=2.387*$width; +// $metersperpixel[17]=1.193*$width; $center = ""; $markers = ""; - - if (sizeof($mapPoints) < 1) return ""; +$minlat = 999; +$minlon = 999; +$maxlat = 0; +$maxlon = 0; + + if (sizeof($mapPoints) < 1) return "map error"; if (sizeof($mapPoints) === 1) { - $zoom = 14; - $markers .= $mapPoint[0].",".$mapPoint[1].",ol-marker"; + if ($zoom == 0) $zoom = 14; + $markers .= "{$mapPoints[0][0]},{$mapPoints[0][1]},$markerimage"; $center = "{$mapPoints[0][0]},{$mapPoints[0][1]}"; } else { foreach ($mapPoints as $index => $mapPoint) { - $markers .= $mapPoint[0].",".$mapPoint[1].",lightblue".($index+1); + $markers .= $mapPoint[0].",".$mapPoint[1].",".$markerImage.($index+1); if ($index+1 != sizeof($mapPoints)) $markers .= "|"; + if ($mapPoint[0] < $minlat) $minlat = $mapPoint[0]; + if ($mapPoint[0] > $maxlat) $maxlat = $mapPoint[0]; + if ($mapPoint[1] < $minlon) $minlon = $mapPoint[1]; + if ($mapPoint[1] > $maxlon) $maxlon = $mapPoint[1]; $totalLat += $mapPoint[0]; $totalLon += $mapPoint[1]; } - $zoom = 11; + if ($zoom == 0) { + $mapwidthinmeters = distance($minlat,$minlon,$minlat,$maxlon); + foreach (array_reverse($metersperpixel,true) as $zoomLevel => $maxdistance) + { + if ($zoom == 0 && $mapwidthinmeters < ($maxdistance + 50)) $zoom = $zoomLevel; + } + } $center = $totalLat/sizeof($mapPoints).",".$totalLon/sizeof($mapPoints); } return ''; +} + +function distance($lat1, $lng1, $lat2, $lng2) +{ + $pi80 = M_PI / 180; + $lat1 *= $pi80; + $lng1 *= $pi80; + $lat2 *= $pi80; + $lng2 *= $pi80; + + $r = 6372.797; // mean radius of Earth in km + $dlat = $lat2 - $lat1; + $dlng = $lng2 - $lng1; + $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); + $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); + $km = $r * $c; + + return $km * 1000; } function decodePolylineToArray($encoded) @@ -202,7 +246,8 @@ $url = "http://geocoding.cloudmade.com/daa03470bb8740298d4b10e3f03d63e6/geocoding/v2/find.js?query=".$query."&bbox=-35.5,149.00,-35.15,149.1930&return_location=true&bbox_only=true"; $contents = json_decode(getPage($url)); if ($giveOptions) return $contents->features; - else return $contents->features[0]->centroid->coordinates[0].",".$contents->features[0]->centroid->coordinates[1]; + elseif (isset($contents->features[0]->centroid)) return $contents->features[0]->centroid->coordinates[0].",".$contents->features[0]->centroid->coordinates[1]; + else return ""; } function reverseGeocode($lat,$lng) { @@ -210,6 +255,16 @@ $contents = json_decode(getPage($url)); return $contents->features[0]->properties->name; } + +function startsWith($haystack,$needle,$case=true) { + if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);} + return (strcasecmp(substr($haystack, 0, strlen($needle)),$needle)===0); +} + +function endsWith($haystack,$needle,$case=true) { + if($case){return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);} + return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0); +} ?> --- /dev/null +++ b/busui/staticmaplite/.gitignore @@ -1,1 +1,3 @@ +cache/tiles +cache/map --- /dev/null +++ b/busui/staticmaplite/images/markers/GPlotter - Make Google Maps Easily.URL @@ -1,1 +1,3 @@ +[InternetShortcut] +URL=http://gplotter.offwhite.net/ --- /dev/null +++ b/busui/staticmaplite/images/markers/Google Maps Icons, Free!.URL @@ -1,1 +1,3 @@ +[InternetShortcut] +URL=http://brennan.offwhite.net/blog/2005/07/23/new-google-maps-icons-free/ --- a/busui/staticmaplite/index.html +++ b/busui/staticmaplite/index.html --- /dev/null +++ b/busui/staticmaplite/selinux-fix.sh @@ -1,1 +1,3 @@ +chcon -R -t httpd_sys_content_rw_t cache + --- a/busui/staticmaplite/staticmap.php +++ b/busui/staticmaplite/staticmap.php @@ -41,10 +41,10 @@ protected $osmLogo = 'images/osm_logo.png'; protected $useTileCache = true; - protected $tileCacheBaseDir = 'cache/tiles'; + protected $tileCacheBaseDir = './cache/tiles'; protected $useMapCache = true; - protected $mapCacheBaseDir = 'cache/maps'; + protected $mapCacheBaseDir = './cache/maps'; protected $mapCacheID = ''; protected $mapCacheFile = ''; protected $mapCacheExtension = 'png'; @@ -190,8 +190,7 @@ public function mkdir_recursive($pathname, $mode){ - is_dir(dirname($pathname)) || $this->mkdir_recursive(dirname($pathname), $mode); - return is_dir($pathname) || @mkdir($pathname, $mode); + return mkdir($pathname, $mode, true); } public function writeTileToCache($url, $data){ $filename = $this->tileUrlToFilename($url); @@ -271,3 +270,4 @@ print $map->showMap(); ?> + --- a/busui/stopList.php +++ b/busui/stopList.php @@ -1,6 +1,14 @@ + +
+ '; echo ' '; -echo' -
-
- - '; + include_footer(); ?> --- a/busui/tripPlanner.php +++ b/busui/tripPlanner.php @@ -1,48 +1,115 @@ From: {$tripplan->plan->from->name} "; - echo "

To: {$tripplan->plan->to->name}

"; - echo "

At: {$tripplan->plan->date}

"; - foreach ($tripplan->plan->itineraries->itinerary as $itineraryNumber => $itinerary ){ - echo "

Option #".($itineraryNumber+1)."

"; - echo "Duration: ".floor($itinerary->duration/60000)." minutes ({$itinerary->startTime} to {$itinerary->endTime})
\n"; - echo "Walking time: ".floor($itinerary->walkTime/60000)." minutes ({$itinerary->walkDistance} meters)
\n"; - echo "Transit time: ".floor($itinerary->transitTime/60000)." minutes
\n"; - echo "Waiting time: ".floor($itinerary->waitingTime/60000)." minutes
\n"; - $legMarkers = Array(); - foreach ($itinerary->legs->leg as $legNumber => $leg ){ - $legMarkers[] = Array($leg->from->lat,$leg->from->lon); - } - echo staticmap($legMarkers)."
\n"; - foreach ($itinerary->legs->leg as $legNumber => $leg ){ - echo "Leg #".($legNumber+1)." (from: {$leg->from->name} to {$leg->to->name}, ".floor($leg->duration/60000)." minutes)
\n"; - $legArray = object2array($leg); - if ($legArray["@mode"] === "BUS") { - echo "Take bus {$legArray['@route']} ".str_replace("To","towards",$legArray['@headsign'])."
"; - } - else { - foreach ($leg->steps->walkSteps as $stepNumber => $step ){ - echo "Walking step $stepNumber $step->absoluteDirection / $step->relativeDirection on $step->streetName for $step->distance meters / ".floor($step->duration/60000)." minutes
\n"; - } - } - } - } -} else { - echo '
I would like to go from to - on at -
'; + include('common.inc.php'); + include_header("Trip Planner"); + function tripPlanForm($errorMessage = "") + { + $from = (isset($_REQUEST['from']) ? $_REQUEST['from'] : "Brigalow"); + $to = (isset($_REQUEST['to']) ? $_REQUEST['to'] : "Barry"); + $date = (isset($_REQUEST['date']) ? $_REQUEST['date'] : date("m/d/Y")); + $time = (isset($_REQUEST['time']) ? $_REQUEST['time'] : date("h:ia")); + echo "$errorMessage"; + echo '
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
'; + } + + function processItinerary($itineraryNumber, $itinerary) + { + echo '
0 ? 'data-collapsed="true"' : "") . '>

Option #' . ($itineraryNumber + 1) . ": " . floor($itinerary->duration / 60000) . " minutes ({$itinerary->startTime} to {$itinerary->endTime})

"; + echo "Walking time: " . floor($itinerary->walkTime / 60000) . " minutes (" . floor($itinerary->walkDistance) . " meters)
\n"; + echo "Transit time: " . floor($itinerary->transitTime / 60000) . " minutes
\n"; + echo "Waiting time: " . floor($itinerary->waitingTime / 60000) . " minutes
\n"; + -} - include_footer(); + + if (is_array($itinerary->legs->leg)) { + $legMarkers = array(); + foreach ($itinerary->legs->leg as $legNumber => $leg) { + $legMarkers[] = array($leg->from->lat, $leg->from->lon); + } + echo '' . staticmap($legMarkers) . "
\n"; + echo '

    '; + foreach ($itinerary->legs->leg as $legNumber => $leg) { + echo '
  • '; + processLeg($legNumber, $leg); + echo "
  • "; + } + echo "
"; + } else { + echo '' . staticmap(array(array($itinerary->legs->leg->from->lat, $itinerary->legs->leg->from->lon))) . "
\n"; + processLeg(0, $itinerary->legs->leg); + } + + echo "

"; + } + + function processLeg($legNumber, $leg) { + $legArray = object2array($leg); + echo '

Leg #' . ($legNumber + 1) . " ( {$legArray['@mode']} from: {$leg->from->name} to {$leg->to->name}, " . floor($leg->duration / 60000) . " minutes)

\n"; + if ($legArray["@mode"] === "BUS") { + echo "Take bus {$legArray['@route']} " . str_replace("To", "towards", $legArray['@headsign']) . "
"; + } else { + $walkStepMarkers = array(); + foreach ($leg->steps->walkSteps as $stepNumber => $step) { + $walkStepMarkers[] = array($step->lat, $step->lon); + } + echo "" . staticmap($walkStepMarkers, "icong") . "
\n"; + foreach ($leg->steps->walkSteps as $stepNumber => $step) { + echo "Walking step " . ($stepNumber + 1) . " $step->absoluteDirection / $step->relativeDirection on $step->streetName for " . floor($step->distance) . " meters
\n"; + } + } + } + + if ($_REQUEST['time']) { + $toPlace = (startsWith($_REQUEST['to'], "-") ? $_REQUEST['to'] : geocode(urlencode($_REQUEST['to']), false)); + $fromPlace = (startsWith($_REQUEST['from'], "-") ? $_REQUEST['from'] : geocode(urlencode($_REQUEST['from']), false)); + if ($toPlace == "" || $fromPlace == "") { + $errorMessage = ""; + if ($toPlace === "") + $errorMessage .= urlencode($_REQUEST['to']) . " not found.
\n"; + if ($fromPlace === "") + $errorMessage .= urlencode($_REQUEST['from']) . " not found.
\n"; + tripPlanForm($errorMessage); + } else { + $url = "http://localhost:8080/opentripplanner-api-webapp/ws/plan?_dc=1290254798856&arriveBy=false&date=" . urlencode($_REQUEST['date']) . "&time=" . urlencode($_REQUEST['time']) . "&mode=TRANSIT%2CWALK&optimize=QUICK&maxWalkDistance=840&wheelchair=false&toPlace=$toPlace&fromPlace=$fromPlace&intermediatePlaces="; + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json")); + $page = curl_exec($ch); + curl_close($ch); + $tripplan = json_decode($page); + echo "

From: {$tripplan->plan->from->name} To: {$tripplan->plan->to->name}

"; + echo "

At: {$tripplan->plan->date}

"; + + if (is_array($tripplan->plan->itineraries->itinerary)) { + echo '
'; + foreach ($tripplan->plan->itineraries->itinerary as $itineraryNumber => $itinerary) { + processItinerary($itineraryNumber, $itinerary); + } + echo "
"; + } else { + processItinerary(0, $tripplan->plan->itineraries->itinerary); + } + + } + } else { + tripPlanForm(); + } + include_footer(); ?> --- a/origin-src/transitfeed-1.2.5/COPYING +++ /dev/null @@ -1,203 +1,1 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - --- a/origin-src/transitfeed-1.2.5/INSTALL +++ /dev/null @@ -1,22 +1,1 @@ -INSTALL file for transitfeed distribution - - -To download and install in one step make sure you have easy-install installed and run -easy_install transitfeed - - - -Since you got this far chances are you have downloaded a copy of the source -code. Install with the command - -python setup.py install - - - -If you don't want to install you may be able to run the scripts from this -directory. For example, try running - -./feedvalidator.py -n test/data/good_feed.zip - - --- a/origin-src/transitfeed-1.2.5/PKG-INFO +++ /dev/null @@ -1,21 +1,1 @@ -Metadata-Version: 1.0 -Name: transitfeed -Version: 1.2.5 -Summary: Google Transit Feed Specification library and tools -Home-page: http://code.google.com/p/googletransitdatafeed/ -Author: Tom Brown -Author-email: tom.brown.code@gmail.com -License: Apache License, Version 2.0 -Download-URL: http://googletransitdatafeed.googlecode.com/files/transitfeed-1.2.5.tar.gz -Description: This module provides a library for reading, writing and validating Google Transit Feed Specification files. It includes some scripts that validate a feed, display it using the Google Maps API and the start of a KML importer and exporter. -Platform: OS Independent -Classifier: Development Status :: 4 - Beta -Classifier: Intended Audience :: Developers -Classifier: Intended Audience :: Information Technology -Classifier: Intended Audience :: Other Audience -Classifier: License :: OSI Approved :: Apache Software License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Topic :: Scientific/Engineering :: GIS -Classifier: Topic :: Software Development :: Libraries :: Python Modules --- a/origin-src/transitfeed-1.2.5/README +++ /dev/null @@ -1,19 +1,1 @@ -README file for transitfeed distribution - - -This distribution contains a library to help you parse and generate Google -Transit Feed files. It also contains some sample tools that demonstrate the -library and are useful in their own right when maintaining Google -Transit Feed files. You may fetch the specification from -http://code.google.com/transit/spec/transit_feed_specification.htm - - -See INSTALL for installation instructions - -The most recent source can be downloaded from our subversion repository at -http://googletransitdatafeed.googlecode.com/svn/trunk/python/ - -See http://code.google.com/p/googletransitdatafeed/wiki/TransitFeedDistribution -for more information. - --- a/origin-src/transitfeed-1.2.5/build/lib/gtfsscheduleviewer/__init__.py +++ /dev/null @@ -1,9 +1,1 @@ -__doc__ = """ -Package holding files for Google Transit Feed Specification Schedule Viewer. -""" -# This package contains the data files for schedule_viewer.py, a script that -# comes with the transitfeed distribution. According to the thread -# "[Distutils] distutils data_files and setuptools.pkg_resources are driving -# me crazy" this is the easiest way to include data files. My experience -# agrees. - Tom 2007-05-29 --- a/origin-src/transitfeed-1.2.5/build/lib/gtfsscheduleviewer/files/index.html +++ /dev/null @@ -1,706 +1,1 @@ - - - - - [agency] - - - - - - - - - -
-
- ... -
-
-
[agency]
-
-
- - -
-
- -
bottom bar
- - - - --- a/origin-src/transitfeed-1.2.5/build/lib/gtfsscheduleviewer/files/labeled_marker.js +++ /dev/null @@ -1,186 +1,1 @@ -/* -* LabeledMarker Class -* -* Copyright 2007 Mike Purvis (http://uwmike.com) -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* This class extends the Maps API's standard GMarker class with the ability -* to support markers with textual labels. Please see articles here: -* -* http://googlemapsbook.com/2007/01/22/extending-gmarker/ -* http://googlemapsbook.com/2007/03/06/clickable-labeledmarker/ -*/ -/** - * Constructor for LabeledMarker, which picks up on strings from the GMarker - * options array, and then calls the GMarker constructor. - * - * @param {GLatLng} latlng - * @param {GMarkerOptions} Named optional arguments: - * opt_opts.labelText {String} text to place in the overlay div. - * opt_opts.labelClass {String} class to use for the overlay div. - * (default "markerLabel") - * opt_opts.labelOffset {GSize} label offset, the x- and y-distance between - * the marker's latlng and the upper-left corner of the text div. - */ -function LabeledMarker(latlng, opt_opts){ - this.latlng_ = latlng; - this.opts_ = opt_opts; - - this.initText_ = opt_opts.labelText || ""; - this.labelClass_ = opt_opts.labelClass || "markerLabel"; - this.labelOffset_ = opt_opts.labelOffset || new GSize(0, 0); - - this.clickable_ = opt_opts.clickable || true; - - if (opt_opts.draggable) { - // This version of LabeledMarker doesn't support dragging. - opt_opts.draggable = false; - } - - GMarker.apply(this, arguments); -} - - -// It's a limitation of JavaScript inheritance that we can't conveniently -// inherit from GMarker without having to run its constructor. In order for -// the constructor to run, it requires some dummy GLatLng. -LabeledMarker.prototype = new GMarker(new GLatLng(0, 0)); - -/** - * Is called by GMap2's addOverlay method. Creates the text div and adds it - * to the relevant parent div. - * - * @param {GMap2} map the map that has had this labeledmarker added to it. - */ -LabeledMarker.prototype.initialize = function(map) { - // Do the GMarker constructor first. - GMarker.prototype.initialize.apply(this, arguments); - - this.map_ = map; - this.setText(this.initText_); -} - -/** - * Create a new div for this label. - */ -LabeledMarker.prototype.makeDiv_ = function(map) { - if (this.div_) { - return; - } - this.div_ = document.createElement("div"); - this.div_.className = this.labelClass_; - this.div_.style.position = "absolute"; - this.div_.style.cursor = "pointer"; - this.map_.getPane(G_MAP_MARKER_PANE).appendChild(this.div_); - - if (this.clickable_) { - /** - * Creates a closure for passing events through to the source marker - * This is located in here to avoid cluttering the global namespace. - * The downside is that the local variables from initialize() continue - * to occupy space on the stack. - * - * @param {Object} object to receive event trigger. - * @param {GEventListener} event to be triggered. - */ - function newEventPassthru(obj, event) { - return function() { - GEvent.trigger(obj, event); - }; - } - - // Pass through events fired on the text div to the marker. - var eventPassthrus = ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout']; - for(var i = 0; i < eventPassthrus.length; i++) { - var name = eventPassthrus[i]; - GEvent.addDomListener(this.div_, name, newEventPassthru(this, name)); - } - } -} - -/** - * Return the html in the div of this label, or "" if none is set - */ -LabeledMarker.prototype.getText = function(text) { - if (this.div_) { - return this.div_.innerHTML; - } else { - return ""; - } -} - -/** - * Set the html in the div of this label to text. If text is "" or null remove - * the div. - */ -LabeledMarker.prototype.setText = function(text) { - if (this.div_) { - if (text) { - this.div_.innerHTML = text; - } else { - // remove div - GEvent.clearInstanceListeners(this.div_); - this.div_.parentNode.removeChild(this.div_); - this.div_ = null; - } - } else { - if (text) { - this.makeDiv_(); - this.div_.innerHTML = text; - this.redraw(); - } - } -} - -/** - * Move the text div based on current projection and zoom level, call the redraw() - * handler in GMarker. - * - * @param {Boolean} force will be true when pixel coordinates need to be recomputed. - */ -LabeledMarker.prototype.redraw = function(force) { - GMarker.prototype.redraw.apply(this, arguments); - - if (this.div_) { - // Calculate the DIV coordinates of two opposite corners of our bounds to - // get the size and position of our rectangle - var p = this.map_.fromLatLngToDivPixel(this.latlng_); - var z = GOverlay.getZIndex(this.latlng_.lat()); - - // Now position our div based on the div coordinates of our bounds - this.div_.style.left = (p.x + this.labelOffset_.width) + "px"; - this.div_.style.top = (p.y + this.labelOffset_.height) + "px"; - this.div_.style.zIndex = z; // in front of the marker - } -} - -/** - * Remove the text div from the map pane, destroy event passthrus, and calls the - * default remove() handler in GMarker. - */ - LabeledMarker.prototype.remove = function() { - this.setText(null); - GMarker.prototype.remove.apply(this, arguments); -} - -/** - * Return a copy of this overlay, for the parent Map to duplicate itself in full. This - * is part of the Overlay interface and is used, for example, to copy everything in the - * main view into the mini-map. - */ -LabeledMarker.prototype.copy = function() { - return new LabeledMarker(this.latlng_, this.opt_opts_); -} - --- a/origin-src/transitfeed-1.2.5/build/lib/gtfsscheduleviewer/files/style.css +++ /dev/null @@ -1,162 +1,1 @@ -html { overflow: hidden; } -html, body { - margin: 0; - padding: 0; - height: 100%; -} - -body { margin: 5px; } - -#content { - position: relative; - margin-top: 5px; -} - -#map-wrapper { - position: relative; - height: 100%; - width: auto; - left: 0; - top: 0; - z-index: 100; -} - -#map { - position: relative; - height: 100%; - width: auto; - border: 1px solid #aaa; -} - -#sidebar-wrapper { - position: absolute; - height: 100%; - width: 220px; - top: 0; - border: 1px solid #aaa; - overflow: auto; - z-index: 300; -} - -#sidebar { - position: relative; - width: auto; - padding: 4px; - overflow: hidden; -} - -#topbar { - position: relative; - padding: 2px; - border: 1px solid #aaa; - margin: 0; -} - -#topbar h1 { - white-space: nowrap; - overflow: hidden; - font-size: 14pt; - font-weight: bold; - font-face: - margin: 0; -} - - -body.sidebar-right #map-wrapper { margin-right: 229px; } -body.sidebar-right #sidebar-wrapper { right: 0; } - -body.sidebar-left #map { margin-left: 229px; } -body.sidebar-left #sidebar { left: 0; } - -body.nosidebar #map { margin: 0; } -body.nosidebar #sidebar { display: none; } - -#bottombar { - position: relative; - padding: 2px; - border: 1px solid #aaa; - margin-top: 5px; - display: none; -} - -/* holly hack for IE to get position:bottom right - see: http://www.positioniseverything.net/abs_relbugs.html - \*/ -* html #topbar { height: 1px; } -/* */ - -body { - font-family:helvetica,arial,sans, sans-serif; -} -h1 { - margin-top: 0.5em; - margin-bottom: 0.5em; -} -h2 { - margin-top: 0.2em; - margin-bottom: 0.2em; -} -h3 { - margin-top: 0.2em; - margin-bottom: 0.2em; -} -.tooltip { - white-space: nowrap; - padding: 2px; - color: black; - font-size: 12px; - background-color: white; - border: 1px solid black; - cursor: pointer; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} -#routeList { - border: 1px solid black; - overflow: auto; -} -.shortName { - font-size: bigger; - font-weight: bold; -} -.routeChoice,.tripChoice,.routeChoiceSelected,.tripChoiceSelected { - white-space: nowrap; - cursor: pointer; - padding: 0px 2px; - color: black; - line-height: 1.4em; - font-size: smaller; - overflow: hidden; -} -.tripChoice { - color: blue; -} -.routeChoiceSelected,.tripChoiceSelected { - background-color: blue; - color: white; -} -.tripSection { - padding-left: 0px; - font-size: 10pt; - background-color: lightblue; -} -.patternSection { - margin-left: 8px; - padding-left: 2px; - border-bottom: 1px solid grey; -} -.unusualPattern { - background-color: #aaa; - color: #444; -} -/* Following styles are used by location_editor.py */ -#edit { - visibility: hidden; - float: right; - font-size: 80%; -} -#edit form { - display: inline; -} --- a/o