ó
i4Vdc           @   sŒ   d  d l  m Z d  d l m Z d  d l m Z d  d l m Z m Z d  d l	 m
 Z
 d Z d e f d „  ƒ  YZ d	 e f d
 „  ƒ  YZ d S(   iÿÿÿÿ(   t
   ModelAdmin(   t   OpenLayersWidget(   t   models(   t   HAS_GDALt   OGRGeomType(   t   ImproperlyConfiguredi  t   GeoModelAdminc           B   sè   e  Z d  Z d Z d Z d Z e Z e Z g  Z	 d Z
 e Z e Z e Z e Z e Z e Z e Z e Z e Z e Z d Z d Z d Z d Z d Z e
 d	 Z d
 Z d Z d Z i d d 6Z e Z  e! Z" e# d „  ƒ Z$ d „  Z% d „  Z& RS(   s   
    The administration options class for Geographic models. Map settings
    may be overloaded from their defaults to create custom maps.
    i    i   i   iX  i  iæ  s   gis/admin/openlayers.htmls,   http://openlayers.org/api/2.13/OpenLayers.jsi   s&   http://vmap0.tiles.osgeo.org/wms/vmap0t   basics   OpenLayers WMSs
   image/jpegt   formatc         C   s9   t  t |  ƒ j } | j |  j g ƒ | j |  j ƒ | S(   s-   Injects OpenLayers JavaScript into the admin.(   t   superR   t   mediat   add_jst   openlayers_urlt   extra_js(   t   selfR
   (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyR
   /   s    c         K   sn   t  | t j ƒ rQ | j d k  rQ | j d d ƒ |  j | ƒ | d <| j |   St t	 |  ƒ j
 | |  Sd S(   s²   
        Overloaded from ModelAdmin so that an OpenLayersWidget is used
        for viewing/editing 2D GeometryFields (OpenLayers 2 does not support
        3D editing).
        i   t   requestt   widgetN(   t
   isinstanceR   t   GeometryFieldt   dimt   popt   Nonet   get_map_widgett	   formfieldR	   R   t   formfield_for_dbfield(   R   t   db_fieldt   kwargs(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyR   7   s
    !c            s}   ˆ j  d k ‰ ˆ rK ˆ j  d k r- d ‰  qQ t ˆ j  j d d ƒ ƒ ‰  n d ‰  d	 ˆ j f ‡  ‡ ‡ ‡ f d
 †  ƒ  Y} | S(   s¼   
        Returns a subclass of the OpenLayersWidget (or whatever was specified
        in the `widget` attribute) using the settings from the attributes set
        in this class.
        t
   MULTIPOINTt   MULTILINESTRINGt   MULTIPOLYGONt   GEOMETRYCOLLECTIONt   Anyt   MULTIt    R   t   OLMapc              sÓ  e  Z ˆ j Z ˆ j Z d  Z ˆ j rc g  ˆ j j ƒ  D] Z d e ^ q7 Z d d j e ƒ Z n  i! ˆ j	 d 6ˆ j
 d 6ˆ j d 6ˆ j p“ ˆ j d 6e ˆ j ƒ d 6ˆ j d	 6ˆ d
 6ˆ j d 6ˆ j d 6ˆ  d 6ˆ j d k d 6ˆ j d, k d 6ˆ j d- k d 6ˆ j d. k d 6ˆ j d 6ˆ j d 6ˆ j d 6ˆ j d 6ˆ j d 6ˆ j d 6ˆ j d 6ˆ j d  6ˆ j d! 6ˆ j d" 6ˆ j d# 6ˆ j d$ 6ˆ j d% 6ˆ j d& 6ˆ j  d' 6ˆ j! d( 6ˆ j" d) 6e d* 6ˆ j d+ 6Z# RS(/   R!   s   %s: '%s's   , %ss   , t   default_lont   default_latt   default_zoomt   display_wktt	   geom_typet
   field_namet   is_collectiont
   scrollablet   layerswitchert   collection_typet   GEOMETRYt
   is_generict
   LINESTRINGR   t   is_linestringt   POLYGONR   t
   is_polygont   POINTR   t   is_pointt   num_zoomt   max_zoomt   min_zoomt   unitst   max_resolutiont
   max_extentt
   modifiablet   mouse_positiont
   scale_textt	   map_widtht
   map_heightt
   point_zoomt   sridt   display_sridt   wms_urlt	   wms_layert   wms_namet   wms_optionst   debug(   R/   R   (   R1   R   (   R3   R   ($   t   __name__t
   __module__t   map_templatet   templateR'   RF   t   itemst   pairt   joinR#   R$   R%   RG   R&   R   t   nameR*   R+   R5   R6   R7   R8   R9   R:   R;   R<   R=   R>   R?   R@   t   map_sridRB   RC   RD   RE   t   params(    (   R,   R   R)   R   (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyR"   T   sN   			&





















(   R   R   R   R   (   R'   R   t   replaceR   (   R   R   R"   (    (   R,   R   R)   R   sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyR   E   s    	(+('   RH   RI   t   __doc__R#   R$   R%   t   FalseR&   RB   R   R5   R6   R7   R8   R9   R:   t   TrueR;   R<   R=   R+   R*   R>   R?   RP   RJ   R   R@   RC   RD   RE   RF   RG   R   R   t   propertyR
   R   R   (    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyR   
   sB   
	t   OSMGeoAdminc           B   s?   e  Z d  Z d Z e Z d Z d Z e d Z d Z	 d „  Z
 RS(   s   gis/admin/osm.htmli   s%   -20037508,-20037508,20037508,20037508s   156543.0339i   t   mc         G   s/   t  s t d ƒ ‚ n  t t |  ƒ j | Œ  d  S(   Ns5   OSMGeoAdmin is not usable without GDAL libs installed(   R   R   R	   RW   t   __init__(   R   t   args(    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyRY   ‹   s    (   RH   RI   RJ   R5   t   spherical_mercator_sridRP   R:   R9   R@   R8   RY   (    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyRW   ‚   s   
N(   t   django.contrib.adminR    t    django.contrib.gis.admin.widgetsR   t   django.contrib.gis.dbR   t   django.contrib.gis.gdalR   R   t   django.core.exceptionsR   R[   R   RW   (    (    (    sn   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/django/contrib/gis/admin/options.pyt   <module>   s   x