instruments & global positioning
This commit is contained in:
parent
c9fa779f16
commit
2878f6b8db
27 changed files with 6633 additions and 125 deletions
|
|
@ -3,15 +3,13 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
|
||||
|
||||
function setCoord(config, pos)
|
||||
{
|
||||
var culture = '@System.Globalization.CultureInfo.CurrentCulture.Name';
|
||||
var lat = new Number(pos.lat);
|
||||
var lng = new Number(pos.lng);
|
||||
$('#'+config.latId).val(lat.toLocaleString(culture));
|
||||
$('#'+config.lonId).val(lng.toLocaleString(culture));
|
||||
$('#'+config.latId).val(pos.lat.toLocaleString(culture, { minimumFractionDigits: 7 }));
|
||||
$('#'+config.lonId).val(pos.lng.toLocaleString(culture, { minimumFractionDigits: 7 }));
|
||||
}
|
||||
var marker=null;
|
||||
function chooseLoc(config, sender, loc) {
|
||||
if (sender === 'user') $('#'+config.addrId).val(loc.formatted_address);
|
||||
var pos = loc.geometry.location;
|
||||
|
|
@ -19,18 +17,23 @@
|
|||
var gmap = config.gmap;
|
||||
gmap.setCenter(pos);
|
||||
setCoord(config, pos);
|
||||
var marker = new google.maps.Marker({
|
||||
map: gmap,
|
||||
draggable: true,
|
||||
animation: google.maps.Animation.DROP,
|
||||
position: pos
|
||||
if (marker!=null) {
|
||||
marker.position = pos;
|
||||
}
|
||||
else {
|
||||
marker = new google.maps.Marker({
|
||||
map: gmap,
|
||||
draggable: true,
|
||||
animation: google.maps.Animation.DROP,
|
||||
position: pos
|
||||
});
|
||||
google.maps.event.addListener(marker, 'dragend', function() {
|
||||
var pos = marker.getPosition();
|
||||
setCoord(config, { lat: pos.lat(), lng: pos.lng() });
|
||||
});
|
||||
}
|
||||
|
||||
$('#'+config.addrId).valid();
|
||||
$('#'+config.valId).empty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -41,10 +44,9 @@
|
|||
addrId: $(mapDiv).data('addr'),
|
||||
lonId: $(mapDiv).data('lon'),
|
||||
latId: $(mapDiv).data('lat'),
|
||||
valId: $(mapDiv).data('val'),
|
||||
locComboId: $(mapDiv).data('loccombo')
|
||||
};
|
||||
|
||||
var scenter = { lat: parseFloat($('#'+config.latId).val().replace(',','.')), lng: parseFloat($('#'+config.lonId).val().replace(',','.')) } ;
|
||||
var input = '#'+config.addrId;
|
||||
$(input).data("val-required", '@SR["SpecifyPlace"]') ;
|
||||
$(input).data("val-remote", '@SR[ "GoogleDidntGeoLocalized"]') ;
|
||||
|
|
@ -85,9 +87,18 @@
|
|||
});
|
||||
|
||||
var gmap = new google.maps.Map(document.getElementById(config.mapId), {
|
||||
zoom: 8
|
||||
zoom: 8,
|
||||
center: scenter
|
||||
});
|
||||
|
||||
config.gmap = gmap;
|
||||
marker = new google.maps.Marker({
|
||||
map: gmap,
|
||||
draggable: true,
|
||||
animation: google.maps.Animation.DROP,
|
||||
position: scenter
|
||||
});
|
||||
|
||||
}
|
||||
$("div.map").each(function(indexMap){
|
||||
setupInputAddress(this)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue