src/pyams_gis/resources/js/pyams_gis.js
changeset 47 ee8602c0df78
parent 16 5755c811bf11
child 54 4ce98983666a
equal deleted inserted replaced
46:662b63ea1eff 47:ee8602c0df78
   318 					PyAMS_GIS.position.changedCoordinate.apply(longitude);
   318 					PyAMS_GIS.position.changedCoordinate.apply(longitude);
   319 				}
   319 				}
   320 			},
   320 			},
   321 
   321 
   322 			clear: function(event) {
   322 			clear: function(event) {
       
   323 				// Clear fieldset
   323 				var fieldset = $(this).parents('fieldset:first');
   324 				var fieldset = $(this).parents('fieldset:first');
   324 				$('input', fieldset).val(null);
   325 				$('input', fieldset).val(null);
       
   326 				// reset map position and zoom level
       
   327 				var map = $('.map', fieldset);
       
   328 				var marker = map.data('marker');
       
   329 				if (marker) {
       
   330 					marker.setLatLng([-90, 0]);
       
   331 					var leafmap = map.data('leafmap');
       
   332 					var config = map.data('leafmap.config');
       
   333 					if (config.bounds) {
       
   334 						leafmap.fitBounds(config.bounds);
       
   335 					} else {
       
   336 						var map_data = map.data();
       
   337 						leafmap.setView(map_data.mapLeafletCenter || config.center,
       
   338 										config.zoom || 13);
       
   339 					}
       
   340 				}
   325 			},
   341 			},
   326 
   342 
   327 			moveMarkerTo: function(map, position, srid) {
   343 			moveMarkerTo: function(map, position, srid) {
   328 				// Update fields
   344 				// Update fields
   329 				var fieldname = map.data('map-leaflet-fieldname');
   345 				var fieldname = map.data('map-leaflet-fieldname');
   542 					PyAMS_GIS.area.changedCoordinate.apply(x1);
   558 					PyAMS_GIS.area.changedCoordinate.apply(x1);
   543 				}
   559 				}
   544 			},
   560 			},
   545 
   561 
   546 			clear: function(event) {
   562 			clear: function(event) {
       
   563 				// Clear fieldset
   547 				var fieldset = $(this).parents('fieldset:first');
   564 				var fieldset = $(this).parents('fieldset:first');
   548 				$('input', fieldset).val(null);
   565 				$('input', fieldset).val(null);
   549 			}
   566 			}
   550 		}
   567 		}
   551 	};
   568 	};