Permalink
Browse files

Separate examples into a different repository

  • Loading branch information...
1 parent 797122f commit c949c24f2316291bbbfdb9b2de2b44289d59edc1 @galen committed Aug 31, 2011
Showing with 5,456 additions and 1 deletion.
  1. +136 −0 Core/Autoloader.php
  2. +62 −0 Core/CustomControl.php
  3. +47 −0 Core/CustomControlDecorator.php
  4. +64 −0 Core/LatLng.php
  5. +112 −0 Core/MapObject.php
  6. +95 −0 Core/MapObjectDecorator.php
  7. +72 −0 Core/PositionAbstract.php
  8. +39 −0 Core/StaticMapObject.php
  9. +17 −0 Event/DomEventListener.php
  10. +70 −0 Event/EventListener.php
  11. +50 −0 Event/EventListenerDecorator.php
  12. +38 −0 Layer/FusionTable.php
  13. +48 −0 Layer/FusionTableDecorator.php
  14. +36 −0 Layer/KmlLayer.php
  15. +47 −0 Layer/KmlLayerDecorator.php
  16. +46 −0 Layer/PanoramioLayer.php
  17. +49 −0 Layer/PanoramioLayerDecorator.php
  18. +2,344 −0 Map.php
  19. +69 −0 Overlay/Circle.php
  20. +53 −0 Overlay/GroundOverlay.php
  21. +46 −0 Overlay/GroundOverlayDecorator.php
  22. +68 −0 Overlay/MapStyle.php
  23. +284 −0 Overlay/Marker.php
  24. +79 −0 Overlay/MarkerDecorator.php
  25. +94 −0 Overlay/MarkerGroup.php
  26. +73 −0 Overlay/MarkerGroupDecorator.php
  27. +198 −0 Overlay/MarkerIcon.php
  28. +88 −0 Overlay/MarkerShape.php
  29. +81 −0 Overlay/Poly.php
  30. +45 −0 Overlay/PolyDecorator.php
  31. +30 −0 Overlay/Polygon.php
  32. +11 −0 Overlay/Polyline.php
  33. +68 −0 Overlay/Rectangle.php
  34. +10 −0 Overlay/Shape.php
  35. +45 −0 Overlay/ShapeDecorator.php
  36. +1 −1 README.md
  37. +11 −0 Service/BicyclingDirections.php
  38. +105 −0 Service/CachedGeocodeResult.php
  39. +83 −0 Service/CachingGeocoder.php
  40. +108 −0 Service/Directions.php
  41. +59 −0 Service/DirectionsDecorator.php
  42. +11 −0 Service/DrivingDirections.php
  43. +26 −0 Service/GeocodeCache.php
  44. +75 −0 Service/GeocodeCachePDO.php
  45. +39 −0 Service/GeocodeError.php
  46. +37 −0 Service/GeocodeException.php
  47. +80 −0 Service/GeocodeResult.php
  48. +58 −0 Service/Geocoder.php
  49. +11 −0 Service/WalkingDirections.php
  50. +38 −0 Utility/Scraper.php
View
@@ -0,0 +1,136 @@
+<?php
+
+/**
+ * SplClassLoader implementation that implements the technical interoperability
+ * standards for PHP 5.3 namespaces and class names.
+ *
+ * http://groups.google.com/group/php-standards/web/final-proposal
+ *
+ * // Example which loads classes for the Doctrine Common package in the
+ * // Doctrine\Common namespace.
+ * $classLoader = new SplClassLoader('Doctrine\Common', '/path/to/doctrine');
+ * $classLoader->register();
+ *
+ * @author Jonathan H. Wage <jonwage@gmail.com>
+ * @author Roman S. Borschel <roman@code-factory.org>
+ * @author Matthew Weier O'Phinney <matthew@zend.com>
+ * @author Kris Wallsmith <kris.wallsmith@gmail.com>
+ * @author Fabien Potencier <fabien.potencier@symfony-project.org>
+ */
+class SplClassLoader
+{
+ private $_fileExtension = '.php';
+ private $_namespace;
+ private $_includePath;
+ private $_namespaceSeparator = '\\';
+
+ /**
+ * Creates a new <tt>SplClassLoader</tt> that loads classes of the
+ * specified namespace.
+ *
+ * @param string $ns The namespace to use.
+ */
+ public function __construct($ns = null, $includePath = null)
+ {
+ $this->_namespace = $ns;
+ $this->_includePath = $includePath;
+ }
+
+ /**
+ * Sets the namespace separator used by classes in the namespace of this class loader.
+ *
+ * @param string $sep The separator to use.
+ */
+ public function setNamespaceSeparator($sep)
+ {
+ $this->_namespaceSeparator = $sep;
+ }
+
+ /**
+ * Gets the namespace seperator used by classes in the namespace of this class loader.
+ *
+ * @return void
+ */
+ public function getNamespaceSeparator()
+ {
+ return $this->_namespaceSeparator;
+ }
+
+ /**
+ * Sets the base include path for all class files in the namespace of this class loader.
+ *
+ * @param string $includePath
+ */
+ public function setIncludePath($includePath)
+ {
+ $this->_includePath = $includePath;
+ }
+
+ /**
+ * Gets the base include path for all class files in the namespace of this class loader.
+ *
+ * @return string $includePath
+ */
+ public function getIncludePath()
+ {
+ return $this->_includePath;
+ }
+
+ /**
+ * Sets the file extension of class files in the namespace of this class loader.
+ *
+ * @param string $fileExtension
+ */
+ public function setFileExtension($fileExtension)
+ {
+ $this->_fileExtension = $fileExtension;
+ }
+
+ /**
+ * Gets the file extension of class files in the namespace of this class loader.
+ *
+ * @return string $fileExtension
+ */
+ public function getFileExtension()
+ {
+ return $this->_fileExtension;
+ }
+
+ /**
+ * Installs this class loader on the SPL autoload stack.
+ */
+ public function register()
+ {
+ spl_autoload_register(array($this, 'loadClass'));
+ }
+
+ /**
+ * Uninstalls this class loader from the SPL autoloader stack.
+ */
+ public function unregister()
+ {
+ spl_autoload_unregister(array($this, 'loadClass'));
+ }
+
+ /**
+ * Loads the given class or interface.
+ *
+ * @param string $className The name of the class to load.
+ * @return void
+ */
+ public function loadClass($className)
+ {
+ if (null === $this->_namespace || $this->_namespace.$this->_namespaceSeparator === substr($className, 0, strlen($this->_namespace.$this->_namespaceSeparator))) {
+ $fileName = '';
+ $namespace = '';
+ if (false !== ($lastNsPos = strripos($className, $this->_namespaceSeparator))) {
+ $namespace = substr($className, 0, $lastNsPos);
+ $className = substr($className, $lastNsPos + 1);
+ $fileName = str_replace($this->_namespaceSeparator, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
+ }
+ $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . $this->_fileExtension;
+
+ require ($this->_includePath !== null ? $this->_includePath . DIRECTORY_SEPARATOR : '') . $fileName;
+ }
+ }
+}
View
@@ -0,0 +1,62 @@
+<?php
+
+namespace PHPGoogleMaps\Core;
+
+/**
+ * CustomControl Class
+ * Adds a custom control to a map
+ * @link http://code.google.com/apis/maps/documentation/javascript/examples/control-custom.html
+ */
+
+class CustomControl extends \PHPGoogleMaps\Core\MapObject {
+
+ /**
+ * Custom control position
+ *
+ * @link http://code.google.com/apis/maps/documentation/javascript/reference.html#ControlPosition
+ *
+ * @var string
+ */
+ protected $position = 'TOP_RIGHT';
+
+ /**
+ * Control listeners
+ *
+ * All the listeners that have been added to the control
+ *
+ * @var array
+ */
+ protected $listeners = array();
+
+ /**
+ * Constructor
+ *
+ * @param array $outeroptions array of control's wrapper options
+ * @param array $inner_options array of control's inner options
+ * @return CustomControl
+ */
+ public function __construct( array $outer_options=null, array $inner_options=null, $position=null ) {
+ $this->options['outer'] = $outer_options;
+ $this->options['inner'] = $inner_options;
+ if ( $position ) {
+ $this->position = $position;
+ }
+ }
+
+ /**
+ * Add Listener
+ *
+ * Add a listener to the control
+ *
+ * @param string $event Event to listen for (click)
+ * @param string $function Function to call
+ * @return void
+ */
+ public function addListener( $event, $function ) {
+ $this->listeners[] = array(
+ 'event' => $event,
+ 'function' => $function
+ );
+ }
+
+}
@@ -0,0 +1,47 @@
+<?php
+
+namespace PHPGoogleMaps\Core;
+
+/**
+ * CustomControl decorator class
+ * This holds the custom control's id and map
+ */
+
+class CustomControlDecorator extends \PHPGoogleMaps\Core\MapObjectDecorator {
+
+ /**
+ * ID of the custom control in the map
+ *
+ * @var integer
+ */
+ protected $_id;
+
+ /**
+ * Map ID of the map the custom control is attached to
+ *
+ * @var string
+ */
+ protected $_map;
+
+ /**
+ * Constructor
+ *
+ * @param CustonControl $control Custom control to decorate
+ * @param int $id ID of the custom control in the map
+ * @param string $map Map ID of the map the custom control is attached to
+ * @return CustomControl
+ */
+ public function __construct( CustomControl $control, $id, $map ) {
+ parent::__construct( $control, array( '_id' => $id, '_map' => $map ) );
+ }
+
+ /**
+ * Returns the javascript variable of the custom control
+ *
+ * @return string
+ */
+ public function getJsVar() {
+ return sprintf( '%s.custom_controls[%s]', $this->_map, $this->_id );
+ }
+
+}
View
@@ -0,0 +1,64 @@
+<?php
+
+namespace PHPGoogleMaps\Core;
+
+/**
+ * LatLng class
+ * Base class used for storing lat/lngs
+ */
+
+class LatLng extends PositionAbstract {
+
+ /**
+ * Latitude
+ *
+ * @var float
+ */
+ public $lat;
+
+ /**
+ * Longitude
+ *
+ * @var float
+ */
+ public $lng;
+
+ /**
+ * LatLng location
+ *
+ * @var string
+ */
+ public $location;
+
+ /**
+ * Constructor
+ *
+ * @param float $lat Latitude
+ * @param float $lng Longitude
+ * @return LatLng
+ */
+ public function __construct( $lat, $lng, $location=null ) {
+ $this->lat = $lat;
+ $this->lng = $lng;
+ $this->location = $location;
+ }
+
+ public function getLatLng() {
+ return $this;
+ }
+ public function getLat() {
+ return $this->lat;
+ }
+ public function getLng() {
+ return $this->lng;
+ }
+
+ /**
+ * Returns a string in the format lat,lng
+ *
+ * @return string
+ */
+ public function __toString() {
+ return sprintf( '%s,%s', $this->lat, $this->lng );
+ }
+}
Oops, something went wrong.

0 comments on commit c949c24

Please sign in to comment.