o ºŽÒ_pã@sfddlZddlmZddlmZmZddlmZddlm Z de   ¡iZ e  d¡Z Gdd „d eƒZdS) éN)Ú GDALException)Ú GEOSExceptionÚ GEOSGeometry)ÚTextarea)Ú translationÚ LANGUAGE_BIDIzdjango.contrib.gisc@s eZdZdZdd„Zdd„ZdS)ÚOpenLayersWidgetzA Render an OpenLayers map using the WKT of the geometry. c Csv|r|j |¡|jd|jd<nd|jd<d|jd<|rFt|tƒrFzt|ƒ}WnttfyE}zt d||¡d}WYd}~nd}~ww|rW|j   ¡|j krW|j dkrWd}|  ¡|jd<||jd <|jd   d d ¡}d ||jd <|r²|jd}|j |krªz |j}| |¡|j}Wn ty©}zt d|j ||¡d}WYd}~nd}~ww|j}||jd<|j t¡|jS)NÚ modifiableÚeditableTÚÚwktz,Error creating geometry from value '%s' (%s)ÚGEOMETRYÚ map_optionsÚnameú-Ú_z geodjango_%sÚmoduleÚsridz.ol_boundscSr))Nz$new OpenLayers.Projection("EPSG:%s")r&)rr&r&r'Ú ol_projectionWr,z3OpenLayersWidget.map_options..ol_projection)rÚ projectionr)Ú display_sridÚdisplayProjectionrÚunitsÚmax_resolutionÚ maxResolution)Ú max_extentÚ maxExtentÚboundsÚnum_zoomÚ numZoomLevelsÚmax_zoomÚ maxZoomLevelsÚmin_zoomÚ minZoomLevelFrr6z"%s")rÚfloatÚintrÚgetÚ TypeError) r!r+r-Ú map_typesrÚ param_nameÚjs_nameÚ option_typer"r&r&r'rQs4ù    €zOpenLayersWidget.map_optionsN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r(rr&r&r&r'rs ?r)ÚloggingÚdjango.contrib.gis.gdalrÚdjango.contrib.gis.geosrrÚdjango.forms.widgetsrÚ django.utilsrÚget_language_bidir Ú getLoggerrrr&r&r&r'Ús