ó
i4Vdc           @  s  d  d l  m Z d  d l m Z d  d l m Z m Z m Z m Z m	 Z	 d  d l
 m Z d  d l m Z d  d l m Z e e d e f d „  ƒ  Yƒ ƒ Z e e d	 e f d
 „  ƒ  Yƒ ƒ Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ e d e f d „  ƒ  Yƒ Z d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   unicode_literals(   t   total_ordering(   t
   LinearRingt
   LineStringt   Pointt   Polygont   fromstr(   t   six(   t   python_2_unicode_compatible(   t	   html_safet   GEventc           B  s    e  Z d  Z d „  Z d „  Z RS(   u'  
    A Python wrapper for the Google GEvent object.

    Events can be attached to any object derived from GOverlayBase with the
    add_event() call.

    For more information please see the Google Maps API Reference:
     https://developers.google.com/maps/documentation/javascript/reference#event

    Example:

      from django.shortcuts import render
      from django.contrib.gis.maps.google import GoogleMap, GEvent, GPolyline

      def sample_request(request):
          polyline = GPolyline('LINESTRING(101 26, 112 26, 102 31)')
          event = GEvent('click',
            'function() { location.href = "http://www.google.com"}')
          polyline.add_event(event)
          return render(request, 'mytemplate.html', {
              'google': GoogleMap(polylines=[polyline]),
          })
    c         C  s   | |  _  | |  _ d S(   u  
        Initializes a GEvent object.

        Parameters:

        event:
          string for the event, such as 'click'. The event must be a valid
          event for the object in the Google Maps API.
          There is no validation of the event type within Django.

        action:
          string containing a Javascript function, such as
          'function() { location.href = "newurl";}'
          The string must be a valid Javascript function. Again there is no
          validation fo the function within Django.
        N(   t   eventt   action(   t   selfR   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   __init__(   s    	c         C  s   d |  j  |  j f S(   u'   Returns the parameter part of a GEvent.u   "%s", %s(   R   R   (   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   __str__<   s    (   t   __name__t
   __module__t   __doc__R   R   (    (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR
      s   	t   GOverlayBasec           B  s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C  s   g  |  _  d  S(   N(   t   events(   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   D   s    c         C  s   d d j  d „  | Dƒ ƒ S(   uJ   Generates a JavaScript array of GLatLng objects for the given coordinates.u   [%s]u   ,c         s  s%   |  ] \ } } d  | | f Vq d S(   u   new GLatLng(%s,%s)N(    (   t   .0t   xt   y(    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pys	   <genexpr>I   s    (   t   join(   R   t   coords(    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   latlng_from_coordsG   s    c         C  s   |  j  j | ƒ d S(   u(   Attaches a GEvent to the overlay object.N(   R   t   append(   R   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt	   add_eventK   s    c         C  s   d |  j  j |  j f S(   u5   The string representation is the JavaScript API call.u   %s(%s)(   t	   __class__R   t	   js_params(   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   O   s    (   R   R   R   R   R   R   (    (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   A   s   			t   GPolygonc           B  s5   e  Z d  Z d d d d d d „ Z e d „  ƒ Z RS(   uÑ   
    A Python wrapper for the Google GPolygon object.  For more information
    please see the Google Maps API Reference:
     https://developers.google.com/maps/documentation/javascript/reference#Polygon
    u   #0000ffi   i   gš™™™™™Ù?c         C  sÎ   t  | t j ƒ r! t | ƒ } n  t  | t t f ƒ rE t | ƒ } n  t  | t ƒ sc t d ƒ ‚ n  | j |  _ |  j	 | j
 j ƒ |  _ | | | |  _ |  _ |  _ | | |  _ |  _ t t |  ƒ j ƒ  d S(   uØ  
        The GPolygon object initializes on a GEOS Polygon or a parameter that
        may be instantiated into GEOS Polygon.  Please note that this will not
        depict a Polygon's internal rings.

        Keyword Options:

          stroke_color:
            The color of the polygon outline. Defaults to '#0000ff' (blue).

          stroke_weight:
            The width of the polygon outline, in pixels.  Defaults to 2.

          stroke_opacity:
            The opacity of the polygon outline, between 0 and 1.  Defaults to 1.

          fill_color:
            The color of the polygon fill.  Defaults to '#0000ff' (blue).

          fill_opacity:
            The opacity of the polygon fill.  Defaults to 0.4.
        u.   GPolygon may only initialize on GEOS Polygons.N(   t
   isinstanceR   t   string_typesR   t   tuplet   listR   t	   TypeErrort   envelopeR   t   shellR   t   pointst   stroke_colort   stroke_opacityt   stroke_weightt
   fill_colort   fill_opacityt   superR   R   (   R   t   polyR(   R*   R)   R+   R,   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   Z   s    c         C  s,   d |  j  |  j |  j |  j |  j |  j f S(   Nu   %s, "%s", %s, %s, "%s", %s(   R'   R(   R*   R)   R+   R,   (   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   Š   s    (   R   R   R   R   t   propertyR   (    (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   T   s   	.t	   GPolylinec           B  s/   e  Z d  Z d d d d „ Z e d „  ƒ Z RS(   uÓ   
    A Python wrapper for the Google GPolyline object.  For more information
    please see the Google Maps API Reference:
     https://developers.google.com/maps/documentation/javascript/reference#Polyline
    u   #0000ffi   i   c         C  sè   t  | t j ƒ r! t | ƒ } n  t  | t t f ƒ rE t | ƒ } n  t  | t t f ƒ rr |  j	 | j
 ƒ |  _ n6 t  | t ƒ rœ |  j	 | j j
 ƒ |  _ n t d ƒ ‚ | j |  _ | | | |  _ |  _ |  _ t t |  ƒ j ƒ  d S(   u  
        The GPolyline object may be initialized on GEOS LineStirng, LinearRing,
        and Polygon objects (internal rings not supported) or a parameter that
        may instantiated into one of the above geometries.

        Keyword Options:

          color:
            The color to use for the polyline.  Defaults to '#0000ff' (blue).

          weight:
            The width of the polyline, in pixels.  Defaults to 2.

          opacity:
            The opacity of the polyline, between 0 and 1.  Defaults to 1.
        uX   GPolyline may only initialize on GEOS LineString, LinearRing, and/or Polygon geometries.N(   R    R   R!   R   R"   R#   R   R   R   R   R   t   latlngsR&   R$   R%   t   colort   weightt   opacityR-   R0   R   (   R   t   geomR2   R3   R4   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   –   s    c         C  s    d |  j  |  j |  j |  j f S(   Nu   %s, "%s", %s, %s(   R1   R2   R3   R4   (   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   ¹   s    (   R   R   R   R   R/   R   (    (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR0      s   #t   GIconc           B  sD   e  Z d  Z d d d d d d d „ Z d „  Z d „  Z d „  Z RS(   uÛ  
    Creates a GIcon object to pass into a Gmarker object.

    The keyword arguments map to instance attributes of the same name. These,
    in turn, correspond to a subset of the attributes of the official GIcon
    javascript object:

    https://developers.google.com/maps/documentation/javascript/reference#Icon

    Because a Google map often uses several different icons, a name field has
    been added to the required arguments.

    Required Arguments:
        varname:
            A string which will become the basis for the js variable name of
            the marker, for this reason, your code should assign a unique
            name for each GIcon you instantiate, otherwise there will be
            name space collisions in your javascript.

    Keyword Options:
        image:
            The url of the image to be used as the icon on the map defaults
            to 'G_DEFAULT_ICON'

        iconsize:
            a tuple representing the pixel size of the foreground (not the
            shadow) image of the icon, in the format: (width, height) ex.:

            GIcon('fast_food',
                  image="/media/icon/star.png",
                  iconsize=(15,10))

            Would indicate your custom icon was 15px wide and 10px height.

        shadow:
            the url of the image of the icon's shadow

        shadowsize:
            a tuple representing the pixel size of the shadow image, format is
            the same as ``iconsize``

        iconanchor:
            a tuple representing the pixel coordinate relative to the top left
            corner of the icon image at which this icon is anchored to the map.
            In (x, y) format.  x increases to the right in the Google Maps
            coordinate system and y increases downwards in the Google Maps
            coordinate system.)

        infowindowanchor:
            The pixel coordinate relative to the top left corner of the icon
            image at which the info window is anchored to this icon.
    c         C  sC   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(   t   varnamet   imaget   iconsizet   shadowt
   shadowsizet
   iconanchort   infowindowanchor(   R   R7   R8   R9   R:   R;   R<   R=   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   ô   s    						c         C  s   |  j  | j  k S(   N(   R7   (   R   t   other(    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   __eq__ÿ   s    c         C  s   |  j  | j  k  S(   N(   R7   (   R   R>   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   __lt__  s    c         C  s   t  |  j ƒ t  |  j ƒ AS(   N(   t   hashR   R7   (   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   __hash__  s    N(   R   R   R   t   NoneR   R?   R@   RB   (    (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR6   ¾   s   5				t   GMarkerc           B  sA   e  Z d  Z d e d d „ Z d „  Z d „  Z e d „  ƒ Z	 RS(   u°  
    A Python wrapper for the Google GMarker object.  For more information
    please see the Google Maps API Reference:
     https://developers.google.com/maps/documentation/javascript/reference#Marker

    Example:

      from django.shortcuts import render
      from django.contrib.gis.maps.google.overlays import GMarker, GEvent

      def sample_request(request):
          marker = GMarker('POINT(101 26)')
          event = GEvent('click',
                         'function() { location.href = "http://www.google.com"}')
          marker.add_event(event)
          return render(request, 'mytemplate.html', {
              'google': GoogleMap(markers=[marker]),
          })
    c         C  s¶   t  | t j ƒ r! t | ƒ } n  t  | t t f ƒ rE t | ƒ } n  t  | t ƒ rl |  j | j ƒ |  _	 n t
 d ƒ ‚ | j |  _ | |  _ | |  _ | |  _ t t |  ƒ j ƒ  d S(   u¤  
        The GMarker object may initialize on GEOS Points or a parameter
        that may be instantiated into a GEOS point.  Keyword options map to
        GMarkerOptions -- so far only the title option is supported.

        Keyword Options:
         title:
           Title option for GMarker, will be displayed as a tooltip.

         draggable:
           Draggable option for GMarker, disabled by default.
        u3   GMarker may only initialize on GEOS Point geometry.N(   R    R   R!   R   R"   R#   R   R   R   t   latlngR$   R%   t   titlet	   draggablet   iconR-   RD   R   (   R   R5   RF   RG   RH   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR     s    			c         C  s   d | d | d f S(   Nu   new GLatLng(%s,%s)i   i    (    (   R   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   =  s    c         C  ss   g  } |  j  r& | j d |  j  ƒ n  |  j rI | j d |  j j ƒ n  |  j rb | j d ƒ n  d d j | ƒ S(   Nu   title: "%s"u   icon: %su   draggable: trueu   {%s}u   ,(   RF   R   RH   R7   RG   R   (   R   t   result(    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   options@  s    			c         C  s   d |  j  |  j ƒ  f S(   Nu   %s, %s(   RE   RJ   (   R   (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyR   J  s    N(
   R   R   R   RC   t   FalseR   R   RJ   R/   R   (    (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyRD     s
   		
N(   t
   __future__R    t	   functoolsR   t   django.contrib.gis.geosR   R   R   R   R   t   django.utilsR   t   django.utils.encodingR   t   django.utils.htmlR	   t   objectR
   R   R   R0   R6   RD   (    (    (    su   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/maps/google/overlays.pyt   <module>   s    (2<.L