ó
®â0_c           @   sv   d  d l  m Z d  d l m Z d  d l 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   OGRGeomTypei  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.htmlsF   https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/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   (    (    sB   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/admin/options.pyR   .   s    c         K   sa   t  | t j ƒ rA | j d k  rA |  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   widgetN(	   t
   isinstanceR   t   GeometryFieldt   dimt   get_map_widgett	   formfieldR   R   t   formfield_for_dbfield(   R   t   db_fieldt   requestt   kwargs(    (    sB   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/admin/options.pyR   6   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    t   Nonet   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   (   R.   R   (   R0   R   ($   t   __name__t
   __module__t   map_templatet   template_nameR$   RC   t   itemst   pairt   joinR    R!   R"   RD   R#   R   t   nameR'   R(   R2   R3   R4   R5   R6   R7   R8   R9   R:   R;   R<   R=   t   map_sridR?   R@   RA   RB   t   params(    (   R)   R   R&   R   (    sB   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/admin/options.pyR   R   sN   			&





















(   R   R   R   R   (   R$   R   t   replaceR   (   R   R   R   (    (   R)   R   R&   R   sB   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/admin/options.pyR   C   s    	(+('   RE   RF   t   __doc__R    R!   R"   t   FalseR#   R?   R   R2   R3   R4   R5   R6   R7   t   TrueR8   R9   R:   R(   R'   R;   R<   RM   RG   R
   R=   R@   RA   RB   RC   RD   R   R   t   propertyR   R   R   (    (    (    sB   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/admin/options.pyR   	   sB   
	t   OSMGeoAdminc           B   s6   e  Z d  Z d Z e Z d Z d Z e d Z d Z	 RS(   s   gis/admin/osm.htmli   s%   -20037508,-20037508,20037508,20037508s   156543.0339i   t   m(
   RE   RF   RG   R2   t   spherical_mercator_sridRM   R7   R6   R=   R5   (    (    (    sB   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/admin/options.pyRT   €   s   
N(   t   django.contrib.adminR    t    django.contrib.gis.admin.widgetsR   t   django.contrib.gis.dbR   t   django.contrib.gis.gdalR   RV   R   RT   (    (    (    sB   /tmp/pip-unpacked-wheel-BAJOf3/django/contrib/gis/admin/options.pyt   <module>   s   w