--- a/src/pyams_gis/resources/js/pyams_gis.min.js Thu Jun 21 09:57:17 2018 +0200
+++ b/src/pyams_gis/resources/js/pyams_gis.min.js Tue Jun 26 16:54:41 2018 +0200
@@ -1,1 +1,1 @@
-!function(a,e){"use strict";var t,n=e.MyAMS,i={RPC_ENDPOINT:"/api/gis/json",WGS_SRID:4326,_layersControlAddItem:function(e){var n,i,r=a("<div></div>").addClass("inline-group"),l=a("<label></label>").addClass(e.overlay?"checkbox":"radio"),o=a("<i></i>"),s=this._map.hasLayer(e.layer);e.overlay?((n=document.createElement("input")).type="checkbox",n.className="leaflet-control-layers-selector",n.defaultChecked=s):n=this._createRadioElement("leaflet-base-layers",s),n.layerId=t.stamp(e.layer),a(n).addClass(e.overlay?"checkbox":"radio"),t.DomEvent.on(n,"click",this._onInputClick,this),i=a("<span></span>").text(" "+e.name),l.append(n),l.append(o),l.append(i),r.append(l);var d=e.overlay?this._overlaysList:this._baseLayersList;return a(d).append(r),r},init:function(r,l,o){var s=r;n.ajax.check(e.L,"/--static--/pyams_gis/js/leaflet-1.0.3"+n.devext+".js",function(r){r&&((t=e.L).Control.Layers.prototype._addItem=i._layersControlAddItem),n.getCSS("/--static--/pyams_gis/css/leaflet-1.0.3"+n.devext+".css","leaflet",function(){n.ajax.post("get-map-configuration.json",{},function(r){var d=s.data(),p={preferCanvas:d.mapLeafletPreferCanvas||!1,attributionControl:void 0===d.mapLeafletAttributionControl?r.attributionControl:d.mapLeafletAttributionControl,zoomControl:void 0===d.mapLeafletZoomControl?r.zoomControl:d.mapLeafletZoomControl,crs:d.mapLeafletCrs||n.getObject(r.crs)||e.L.CRS.EPSG3857,center:d.mapLeafletCenter||r.center,zoom:d.mapLeafletZoom||r.zoom};p=a.extend({},p,l),s.trigger("map.init",[s,p,r]);var c=t.map(s.attr("id"),p);if(r.layers)for(var u=0;u<r.layers.length;u++){var m=r.layers[u];s.trigger("map.layer.init",[s,m]),i.getLayer(m).addTo(c)}else t.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,id:"osm",attribution:'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(c);r.zoomControl&&!0!==d.mapLeafletHideZoomControl&&t.control.scale().addTo(c),r.bounds&&c.fitBounds(r.bounds),s.data("leafmap",c),s.data("leafmap.config",r),s.trigger("map.finishing",[s,c]),o&&o(c,r),s.trigger("map.finished",[s,c])})})})},getLayer:function(e){var t=n.getObject(e.factory);if(void 0!==t){delete e.factory;var i=[];if(e.dependsOn){for(var r in e.dependsOn)e.dependsOn.hasOwnProperty(r)&&void 0===n.getObject(r)&&i.push(n.getScript(e.dependsOn[r]));delete e.dependsOn}return i.length>0&&a.when.apply(a,i),t(e)}},factory:{TileLayer:function(a){var e=a.url;return delete a.url,t.tileLayer(e,a)},WMS:function(a){var e=a.url;return delete a.url,t.tileLayer.wms(e,a)},Geoportal:{WMS:function(a){return n.getCSS("/--static--/pyams_gis/css/leaflet-gp-3.0.2"+n.devext+".css","geoportal"),t.geoportalLayer.WMS(a)}},ESRI:{Feature:function(a){return t.esri.featureLayer(a)}},Google:function(e){var i=e.apiKey;if(delete e.apiKey,void 0===n.getObject("window.google.maps")){var r=n.getScript("https://maps.googleapis.com/maps/api/js?key="+i);a.when.apply(a,[r])}return t.gridLayer.googleMutant(e)}},callJSON:function(e,t,r){n.ajax.check(a.jsonRPC,n.baseURL+"ext/jquery-jsonrpc"+n.devext+".js",function(){a.jsonRPC.withOptions({endPoint:i.RPC_ENDPOINT,cache:!1},function(){a.jsonRPC.request(e,{id:(new Date).getTime(),params:t,success:r,error:n.error.show})})})},position:{init:function(){var e=a(".map",a(this));void 0===e.data("leafmap")&&(e.css("height",a(window).height()-200),i.init(e,{},function(n,r){var l=e.data(),o=t.icon({iconUrl:"/--static--/pyams_gis/img/marker-icon.png",iconSize:[25,41],iconAnchor:[13,40]}),s=t.marker();s.setIcon(o);var d=l.mapLeafletFieldname,p=a('input[name="'+d+'.widgets.longitude"]'),c=a('input[name="'+d+'.widgets.latitude"]');if(p.val()&&c.val()){var u=a('select[name="'+d+'.widgets.projection:list"]'),m={point:{longitude:parseFloat(p.val()),latitude:parseFloat(c.val())},from_srid:u.val()||i.WGS_SRID,to_srid:i.WGS_SRID};i.callJSON("transformPoint",m,function(a){if(!a.error){var e=a.result.point;s.setLatLng({lon:e.longitude,lat:e.latitude}),s.addTo(n),n.setView(s.getLatLng(),r.zoom||13)}})}else s.setLatLng([-90,0]),s.addTo(n);e.data("marker",s),n.on("click",i.position.onClick)}))},onClick:function(e){var t=e.target.getContainer(),n=a(t).data(),r=n.marker,l=e.latlng;r.setLatLng(l);var o=n.mapLeafletFieldname,s=a('select[name="'+o+'.widgets.projection:list"]'),d={point:{longitude:l.lng,latitude:l.lat},from_srid:i.WGS_SRID,to_srid:s.val()};i.callJSON("transformPoint",d,function(e){if(!e.error){var n=e.result.point;a('input[name="'+o+'.widgets.longitude"]').val(n.longitude),a('input[name="'+o+'.widgets.latitude"]').val(n.latitude),a(t).trigger("marker.changed",[t,n])}})},changedCoordinate:function(){var e=a(this),t=a(".map",e.parents("fieldset:first"));if(t.data("marker")){var n=t.data("map-leaflet-fieldname"),r=a('input[name="'+n+'.widgets.longitude"]'),l=a('input[name="'+n+'.widgets.latitude"]');if(r.val()&&l.val()){var o=a('select[name="'+n+'.widgets.projection:list"]'),s={point:{longitude:parseFloat(r.val()),latitude:parseFloat(l.val())},from_srid:o.val(),to_srid:i.WGS_SRID};i.callJSON("transformPoint",s,function(a){if(!a.error){var e=a.result.point;t.data("marker").setLatLng({lon:e.longitude,lat:e.latitude})}})}}},changedProjection:function(e){var t=a(this),n=a(".map",t.parents("fieldset:first")).data("map-leaflet-fieldname"),r=a('input[name="'+n+'.widgets.longitude"]'),l=a('input[name="'+n+'.widgets.latitude"]');if(e.removed){var o=e.removed.id,s=e.added.id;if(o!==s&&r.val()&&l.val()){var d={point:{longitude:parseFloat(r.val()),latitude:parseFloat(l.val())},from_srid:o,to_srid:s};i.callJSON("transformPoint",d,function(a){if(!a.error){var e=a.result.point;r.val(e.longitude),l.val(e.latitude)}})}}else i.position.changedCoordinate.apply(r)},clear:function(e){var t=a(this).parents("fieldset:first");a("input",t).val(null)},moveMarkerTo:function(e,t,n){var r=e.data("map-leaflet-fieldname");a('input[name="'+r+'.widgets.longitude"]').val(t.lon),a('input[name="'+r+'.widgets.latitude"]').val(t.lat);var l={point:{longitude:t.lon,latitude:t.lat},from_srid:n,to_srid:4326};i.callJSON("transformPoint",l,function(a){if(!a.error){var n=a.result.point;e.data("marker").setLatLng({lon:n.longitude,lat:n.latitude}),e.data("leafmap").setView(t)}})}},area:{init:function(){var e=a(".map",a(this));void 0===e.data("leafmap")&&(e.css("height",a(window).height()-200),i.init(e,{},function(r){t.Draw=t.Draw||{},t.Edit=t.Edit||{},n.ajax.check([t.Draw,t.Draw.Event,t.Map.TouchExtend,t.Edit.SimpleShape],["/--static--/pyams_gis/js/leaflet.Draw"+n.devext+".js","/--static--/pyams_gis/js/leaflet.Draw.Event"+n.devext+".js","/--static--/pyams_gis/js/TouchEvents"+n.devext+".js","/--static--/pyams_gis/js/Edit.SimpleShape"+n.devext+".js"],function(){n.ajax.check(t.Edit.Rectangle,"/--static--/pyams_gis/js/Edit.Rectangle"+n.devext+".js",function(){function n(a,n){var l=new t.FeatureGroup;s=t.rectangle([a,n]),l.addLayer(s),r.addLayer(l),r.fitBounds(s.getBounds()),s.editing.enable(),e.data("area",s),r.on(t.Draw.Event.EDITMOVE,i.area.changedArea),r.on(t.Draw.Event.EDITRESIZE,i.area.changedArea),r.on(t.Draw.Event.EDITVERTEX,i.area.changedArea)}var l,o,s,d=e.data().mapLeafletFieldname,p=a('input[name="'+d+'.widgets.x1"]'),c=a('input[name="'+d+'.widgets.y1"]'),u=a('input[name="'+d+'.widgets.x2"]'),m=a('input[name="'+d+'.widgets.y2"]');if(p.val()&&c.val()&&u.val()&&m.val()){var g=a('select[name="'+d+'.widgets.projection:list"]'),v={area:{x1:parseFloat(p.val()),y1:parseFloat(c.val()),x2:parseFloat(u.val()),y2:parseFloat(m.val())},from_srid:g.val(),to_srid:i.WGS_SRID};i.callJSON("transformArea",v,function(a){if(!a.error){var e=a.result.area;l=t.latLng({lon:e.x1,lat:e.y1}),o=t.latLng({lon:e.x2,lat:e.y2}),n(l,o)}})}else{var f=e.data("leafmap.config");f.bounds?(l=t.latLng(f.bounds[0]),o=t.latLng(f.bounds[1])):(l=t.latLng({lon:-168,lat:-56.37}),o=t.latLng({lon:191.25,lat:83.72})),n(l,o)}})})}))},last_event:null,changedArea:function(e){i.area.last_event=e,setTimeout(function(){if(e===i.area.last_event){var t=e.target.getContainer(),n=a(t).data(),r=n.area.getBounds(),l=n.mapLeafletFieldname,o=a('select[name="'+l+'.widgets.projection:list"]').val(),s={area:{x1:r.getWest(),y1:r.getSouth(),x2:r.getEast(),y2:r.getNorth()},from_srid:i.WGS_SRID,to_srid:o};i.callJSON("transformArea",s,function(e){if(!e.error){var t=e.result.area;a('input[name="'+l+'.widgets.x1"]').val(t.x1),a('input[name="'+l+'.widgets.y1"]').val(t.y1),a('input[name="'+l+'.widgets.x2"]').val(t.x2),a('input[name="'+l+'.widgets.y2"]').val(t.y2)}})}},100)},changedCoordinate:function(){var e=a(this),n=a(".map",e.parents("fieldset:first"));if(n.data("area")){var r=n.data("map-leaflet-fieldname"),l=a('input[name="'+r+'.widgets.x1"]'),o=a('input[name="'+r+'.widgets.y1"]'),s=a('input[name="'+r+'.widgets.x2"]'),d=a('input[name="'+r+'.widgets.y2"]');if(l.val()&&o.val()&&s.val()&&d.val()){var p=a('select[name="'+r+'.widgets.projection:list"]'),c={area:{x1:parseFloat(l.val()),y1:parseFloat(o.val()),x2:parseFloat(s.val()),y2:parseFloat(d.val())},from_srid:p.val(),to_srid:4326};i.callJSON("transformArea",c,function(a){if(!a.error){var e=a.result.area,i=n.data("area");i.editing.disable(),i.setBounds([t.latLng({lon:e.x1,lat:e.y1}),t.latLng({lon:e.x2,lat:e.y2})]),i.editing.enable()}})}}},changedProjection:function(e){var t=a(this),n=a(".map",t.parents("fieldset:first")).data("map-leaflet-fieldname"),r=a('input[name="'+n+'.widgets.x1"]'),l=a('input[name="'+n+'.widgets.y1"]'),o=a('input[name="'+n+'.widgets.x2"]'),s=a('input[name="'+n+'.widgets.y2"]');if(e.removed){var d=e.removed.id,p=e.added.id;if(d!==p&&r.val()&&l.val()&&o.val()&&s.val()){var c={area:{x1:parseFloat(r.val()),y1:parseFloat(l.val()),x2:parseFloat(o.val()),y2:parseFloat(s.val())},from_srid:d,to_srid:p};i.callJSON("transformArea",c,function(a){if(!a.error){var e=a.result.area;r.val(e.x1),l.val(e.y1),o.val(e.x2),s.val(e.y2)}})}}else i.area.changedCoordinate.apply(r)},clear:function(e){var t=a(this).parents("fieldset:first");a("input",t).val(null)}}};e.PyAMS_GIS=i}(jQuery,this);
+!function(a,e){"use strict";var t,n=e.MyAMS,i={RPC_ENDPOINT:"/api/gis/json",WGS_SRID:4326,_layersControlAddItem:function(e){var n,i,r=a("<div></div>").addClass("inline-group"),l=a("<label></label>").addClass(e.overlay?"checkbox":"radio"),o=a("<i></i>"),s=this._map.hasLayer(e.layer);e.overlay?((n=document.createElement("input")).type="checkbox",n.className="leaflet-control-layers-selector",n.defaultChecked=s):n=this._createRadioElement("leaflet-base-layers",s),n.layerId=t.stamp(e.layer),a(n).addClass(e.overlay?"checkbox":"radio"),t.DomEvent.on(n,"click",this._onInputClick,this),i=a("<span></span>").text(" "+e.name),l.append(n),l.append(o),l.append(i),r.append(l);var d=e.overlay?this._overlaysList:this._baseLayersList;return a(d).append(r),r},init:function(r,l,o){var s=r;n.ajax.check(e.L,"/--static--/pyams_gis/js/leaflet-1.0.3"+n.devext+".js",function(r){r&&((t=e.L).Control.Layers.prototype._addItem=i._layersControlAddItem),n.getCSS("/--static--/pyams_gis/css/leaflet-1.0.3"+n.devext+".css","leaflet",function(){n.ajax.post("get-map-configuration.json",{},function(r){var d=s.data(),p={preferCanvas:d.mapLeafletPreferCanvas||!1,attributionControl:void 0===d.mapLeafletAttributionControl?r.attributionControl:d.mapLeafletAttributionControl,zoomControl:void 0===d.mapLeafletZoomControl?r.zoomControl:d.mapLeafletZoomControl,crs:d.mapLeafletCrs||n.getObject(r.crs)||e.L.CRS.EPSG3857,center:d.mapLeafletCenter||r.center,zoom:d.mapLeafletZoom||r.zoom};p=a.extend({},p,l),s.trigger("map.init",[s,p,r]);var c=t.map(s.attr("id"),p);if(r.layers)for(var u=0;u<r.layers.length;u++){var m=r.layers[u];s.trigger("map.layer.init",[s,m]),i.getLayer(m).addTo(c)}else t.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,id:"osm",attribution:'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'}).addTo(c);r.zoomControl&&!0!==d.mapLeafletHideZoomControl&&t.control.scale().addTo(c),r.bounds&&c.fitBounds(r.bounds),s.data("leafmap",c),s.data("leafmap.config",r),s.trigger("map.finishing",[s,c]),o&&o(c,r),s.trigger("map.finished",[s,c])})})})},getLayer:function(e){var t=n.getObject(e.factory);if(void 0!==t){delete e.factory;var i=[];if(e.dependsOn){for(var r in e.dependsOn)e.dependsOn.hasOwnProperty(r)&&void 0===n.getObject(r)&&i.push(n.getScript(e.dependsOn[r]));delete e.dependsOn}return i.length>0&&a.when.apply(a,i),t(e)}},factory:{TileLayer:function(a){var e=a.url;return delete a.url,t.tileLayer(e,a)},WMS:function(a){var e=a.url;return delete a.url,t.tileLayer.wms(e,a)},Geoportal:{WMS:function(a){return n.getCSS("/--static--/pyams_gis/css/leaflet-gp-3.0.2"+n.devext+".css","geoportal"),t.geoportalLayer.WMS(a)}},ESRI:{Feature:function(a){return t.esri.featureLayer(a)}},Google:function(e){var i=e.apiKey;if(delete e.apiKey,void 0===n.getObject("window.google.maps")){var r=n.getScript("https://maps.googleapis.com/maps/api/js?key="+i);a.when.apply(a,[r])}return t.gridLayer.googleMutant(e)}},callJSON:function(e,t,r){n.ajax.check(a.jsonRPC,n.baseURL+"ext/jquery-jsonrpc"+n.devext+".js",function(){a.jsonRPC.withOptions({endPoint:i.RPC_ENDPOINT,cache:!1},function(){a.jsonRPC.request(e,{id:(new Date).getTime(),params:t,success:r,error:n.error.show})})})},position:{init:function(){var e=a(".map",a(this));void 0===e.data("leafmap")&&(e.css("height",a(window).height()-200),i.init(e,{},function(n,r){var l=e.data(),o=t.icon({iconUrl:"/--static--/pyams_gis/img/marker-icon.png",iconSize:[25,41],iconAnchor:[13,40]}),s=t.marker();s.setIcon(o);var d=l.mapLeafletFieldname,p=a('input[name="'+d+'.widgets.longitude"]'),c=a('input[name="'+d+'.widgets.latitude"]');if(p.val()&&c.val()){var u=a('select[name="'+d+'.widgets.projection:list"]'),m={point:{longitude:parseFloat(p.val()),latitude:parseFloat(c.val())},from_srid:u.val()||i.WGS_SRID,to_srid:i.WGS_SRID};i.callJSON("transformPoint",m,function(a){if(!a.error){var e=a.result.point;s.setLatLng({lon:e.longitude,lat:e.latitude}),s.addTo(n),n.setView(s.getLatLng(),r.zoom||13)}})}else s.setLatLng([-90,0]),s.addTo(n);e.data("marker",s),n.on("click",i.position.onClick)}))},onClick:function(e){var t=e.target.getContainer(),n=a(t).data(),r=n.marker,l=e.latlng;r.setLatLng(l);var o=n.mapLeafletFieldname,s=a('select[name="'+o+'.widgets.projection:list"]'),d={point:{longitude:l.lng,latitude:l.lat},from_srid:i.WGS_SRID,to_srid:s.val()};i.callJSON("transformPoint",d,function(e){if(!e.error){var n=e.result.point;a('input[name="'+o+'.widgets.longitude"]').val(n.longitude),a('input[name="'+o+'.widgets.latitude"]').val(n.latitude),a(t).trigger("marker.changed",[t,n])}})},changedCoordinate:function(){var e=a(this),t=a(".map",e.parents("fieldset:first"));if(t.data("marker")){var n=t.data("map-leaflet-fieldname"),r=a('input[name="'+n+'.widgets.longitude"]'),l=a('input[name="'+n+'.widgets.latitude"]');if(r.val()&&l.val()){var o=a('select[name="'+n+'.widgets.projection:list"]'),s={point:{longitude:parseFloat(r.val()),latitude:parseFloat(l.val())},from_srid:o.val(),to_srid:i.WGS_SRID};i.callJSON("transformPoint",s,function(a){if(!a.error){var e=a.result.point;t.data("marker").setLatLng({lon:e.longitude,lat:e.latitude})}})}}},changedProjection:function(e){var t=a(this),n=a(".map",t.parents("fieldset:first")).data("map-leaflet-fieldname"),r=a('input[name="'+n+'.widgets.longitude"]'),l=a('input[name="'+n+'.widgets.latitude"]');if(e.removed){var o=e.removed.id,s=e.added.id;if(o!==s&&r.val()&&l.val()){var d={point:{longitude:parseFloat(r.val()),latitude:parseFloat(l.val())},from_srid:o,to_srid:s};i.callJSON("transformPoint",d,function(a){if(!a.error){var e=a.result.point;r.val(e.longitude),l.val(e.latitude)}})}}else i.position.changedCoordinate.apply(r)},clear:function(e){var t=a(this).parents("fieldset:first");a("input",t).val(null);var n=a(".map",t),i=n.data("marker");if(i){i.setLatLng([-90,0]);var r=n.data("leafmap"),l=n.data("leafmap.config");if(l.bounds)r.fitBounds(l.bounds);else{var o=n.data();r.setView(o.mapLeafletCenter||l.center,l.zoom||13)}}},moveMarkerTo:function(e,t,n){var r=e.data("map-leaflet-fieldname");a('input[name="'+r+'.widgets.longitude"]').val(t.lon),a('input[name="'+r+'.widgets.latitude"]').val(t.lat);var l={point:{longitude:t.lon,latitude:t.lat},from_srid:n,to_srid:4326};i.callJSON("transformPoint",l,function(a){if(!a.error){var n=a.result.point;e.data("marker").setLatLng({lon:n.longitude,lat:n.latitude}),e.data("leafmap").setView(t)}})}},area:{init:function(){var e=a(".map",a(this));void 0===e.data("leafmap")&&(e.css("height",a(window).height()-200),i.init(e,{},function(r){t.Draw=t.Draw||{},t.Edit=t.Edit||{},n.ajax.check([t.Draw,t.Draw.Event,t.Map.TouchExtend,t.Edit.SimpleShape],["/--static--/pyams_gis/js/leaflet.Draw"+n.devext+".js","/--static--/pyams_gis/js/leaflet.Draw.Event"+n.devext+".js","/--static--/pyams_gis/js/TouchEvents"+n.devext+".js","/--static--/pyams_gis/js/Edit.SimpleShape"+n.devext+".js"],function(){n.ajax.check(t.Edit.Rectangle,"/--static--/pyams_gis/js/Edit.Rectangle"+n.devext+".js",function(){function n(a,n){var l=new t.FeatureGroup;s=t.rectangle([a,n]),l.addLayer(s),r.addLayer(l),r.fitBounds(s.getBounds()),s.editing.enable(),e.data("area",s),r.on(t.Draw.Event.EDITMOVE,i.area.changedArea),r.on(t.Draw.Event.EDITRESIZE,i.area.changedArea),r.on(t.Draw.Event.EDITVERTEX,i.area.changedArea)}var l,o,s,d=e.data().mapLeafletFieldname,p=a('input[name="'+d+'.widgets.x1"]'),c=a('input[name="'+d+'.widgets.y1"]'),u=a('input[name="'+d+'.widgets.x2"]'),m=a('input[name="'+d+'.widgets.y2"]');if(p.val()&&c.val()&&u.val()&&m.val()){var f=a('select[name="'+d+'.widgets.projection:list"]'),g={area:{x1:parseFloat(p.val()),y1:parseFloat(c.val()),x2:parseFloat(u.val()),y2:parseFloat(m.val())},from_srid:f.val(),to_srid:i.WGS_SRID};i.callJSON("transformArea",g,function(a){if(!a.error){var e=a.result.area;l=t.latLng({lon:e.x1,lat:e.y1}),o=t.latLng({lon:e.x2,lat:e.y2}),n(l,o)}})}else{var v=e.data("leafmap.config");v.bounds?(l=t.latLng(v.bounds[0]),o=t.latLng(v.bounds[1])):(l=t.latLng({lon:-168,lat:-56.37}),o=t.latLng({lon:191.25,lat:83.72})),n(l,o)}})})}))},last_event:null,changedArea:function(e){i.area.last_event=e,setTimeout(function(){if(e===i.area.last_event){var t=e.target.getContainer(),n=a(t).data(),r=n.area.getBounds(),l=n.mapLeafletFieldname,o=a('select[name="'+l+'.widgets.projection:list"]').val(),s={area:{x1:r.getWest(),y1:r.getSouth(),x2:r.getEast(),y2:r.getNorth()},from_srid:i.WGS_SRID,to_srid:o};i.callJSON("transformArea",s,function(e){if(!e.error){var t=e.result.area;a('input[name="'+l+'.widgets.x1"]').val(t.x1),a('input[name="'+l+'.widgets.y1"]').val(t.y1),a('input[name="'+l+'.widgets.x2"]').val(t.x2),a('input[name="'+l+'.widgets.y2"]').val(t.y2)}})}},100)},changedCoordinate:function(){var e=a(this),n=a(".map",e.parents("fieldset:first"));if(n.data("area")){var r=n.data("map-leaflet-fieldname"),l=a('input[name="'+r+'.widgets.x1"]'),o=a('input[name="'+r+'.widgets.y1"]'),s=a('input[name="'+r+'.widgets.x2"]'),d=a('input[name="'+r+'.widgets.y2"]');if(l.val()&&o.val()&&s.val()&&d.val()){var p=a('select[name="'+r+'.widgets.projection:list"]'),c={area:{x1:parseFloat(l.val()),y1:parseFloat(o.val()),x2:parseFloat(s.val()),y2:parseFloat(d.val())},from_srid:p.val(),to_srid:4326};i.callJSON("transformArea",c,function(a){if(!a.error){var e=a.result.area,i=n.data("area");i.editing.disable(),i.setBounds([t.latLng({lon:e.x1,lat:e.y1}),t.latLng({lon:e.x2,lat:e.y2})]),i.editing.enable()}})}}},changedProjection:function(e){var t=a(this),n=a(".map",t.parents("fieldset:first")).data("map-leaflet-fieldname"),r=a('input[name="'+n+'.widgets.x1"]'),l=a('input[name="'+n+'.widgets.y1"]'),o=a('input[name="'+n+'.widgets.x2"]'),s=a('input[name="'+n+'.widgets.y2"]');if(e.removed){var d=e.removed.id,p=e.added.id;if(d!==p&&r.val()&&l.val()&&o.val()&&s.val()){var c={area:{x1:parseFloat(r.val()),y1:parseFloat(l.val()),x2:parseFloat(o.val()),y2:parseFloat(s.val())},from_srid:d,to_srid:p};i.callJSON("transformArea",c,function(a){if(!a.error){var e=a.result.area;r.val(e.x1),l.val(e.y1),o.val(e.x2),s.val(e.y2)}})}}else i.area.changedCoordinate.apply(r)},clear:function(e){var t=a(this).parents("fieldset:first");a("input",t).val(null)}}};e.PyAMS_GIS=i}(jQuery,this);