(function ($) { /* * visorGoogle() * FUNCIӓN: visor de mapas de Google * PARAMS: campoLongitud - coordenadas X * campoLatitud - coordenadas Y * zoom - zoom del mapa * url * tipo */ $.fn.visorGoogle = function(options) { var defaults = $.extend({ campoLongitud: '', campoLatitud: '', zoom: 0, url: '', tipo: '' },options); lng = $('#'+defaults.campoLongitud).val(); if (lng == '') lng = 0; lat = $('#'+defaults.campoLatitud).val(); if (lat == '') lat = 0; var iframestr = "
"; var myPos = { my: "center center", of: window, collision: "fit" } $(iframestr).dialog( { height: 600, width: 855, modal: true, position: myPos, autoOpen: false, resizable: false, close: function(event, ui) { $(this).dialog('destroy').remove(); $("input[name*='"+defaults.campoLongitud+"']").focus().val(lng); $("input[name*='"+defaults.campoLatitud+"']").focus().val(lat); }, open: function (event, ui) { $(this).css('overflow', 'hidden'); } }); $('#dialogomapa').dialog('open'); }; /* * visorIDEE() * FUNCIӓN: visor de mapas IDEE * PARAMS: campoLongitud - coordenadas X * campoLatitud - coordenadas Y * zoom - zoom del mapa * url * tipo */ $.fn.visorIDEE = function(options) { var defaults = $.extend({ campoLongitud: '', campoLatitud: '', zoom: 0, url: '', tipo: '' },options); lng = $('#'+defaults.campoLongitud).val(); if (lng == '') lng = 0; lat = $('#'+defaults.campoLatitud).val(); if (lat == '') lat = 0; if(defaults.tipo=='UTM') { if (lat.length == 0 || lng.length == 0) { lng = 697583.8573836017; lat = 4352605.147936047; } } else { if (lat.length == 0 || lng.length == 0) { lng = -0.708618164; lat = 39.300299186; } } campoTipo = defaults.tipo; zoomMod = defaults.zoom; var iframestr = "
"; var myPos = { my: "center center", of: window, collision: "fit" } $(iframestr).dialog({ height: 600, width: 855, modal: true, position: myPos, autoOpen: false, resizable: false, close: function(event, ui) { $(this).dialog('destroy').remove(); }, open: function (event, ui) { $(this).css('overflow', 'hidden'); } }); $('#dialogomapa').dialog('open'); }; /* * visorStreetMap() * FUNCIӓN: visor de mapas StreetMap * PARAMS: campoLongitud - coordenadas X * campoLatitud - coordenadas Y * zoom - zoom del mapa * url * tipo */ $.fn.visorStreetMap = function(options) { var defaults = $.extend({ campoLongitud: '', campoLatitud: '', zoom: 0, url: '', tipo: '', action: '' },options); lng = $('#'+defaults.campoLongitud).val(); if (lng == '') lng = 0; lat = $('#'+defaults.campoLatitud).val(); if (lat == '') lat = 0; if(defaults.tipo=='UTM') { if (lat.length == 0 || lng.length == 0) { lng = 697583.8573836017; lat = 4352605.147936047; } } else { if (lat.length == 0 || lng.length == 0) { lng = -0.708618164; lat = 39.300299186; } } campoTipo = defaults.tipo; zoomMod = defaults.zoom; var iframestr = "
"; var myPos = { my: "center center", of: window, collision: "fit" } $(iframestr).dialog({ height: 600, width: 855, modal: true, position: myPos, autoOpen: false, resizable: false, close: function(event, ui) { $(this).dialog('destroy').remove(); }, open: function (event, ui) { $(this).css('overflow', 'hidden'); } }); $('#dialogomapa').dialog('open'); }; /* * visorICV() * FUNCIӓN: visor de mapas del ICV * PARAMS: campoLongitud - coordenadas X * campoLatitud - coordenadas Y * zoom - zoom del mapa * url * tipo */ $.fn.visorICV = function(options) { var defaults = $.extend({ campoLongitud: '', campoLatitud: '', zoom: 0, url: '', tipo: '' },options); lng = $('#'+defaults.campoLongitud).val(); if (lng == '') lng = 0; lat = $('#'+defaults.campoLatitud).val(); if (lat == '') lat = 0; if ((lng!=0)&&(lat!=0)) { var iframestr = "
"; } else { var iframestr = "
"; } var olng = {value: lng, id: "lng"}; var olat = {value: lat, id: "lat"}; $olng = $(olng); $olat = $(olat); var myPos = { my: "center center", of: window, collision: "fit" } $(iframestr).dialog( { height: 600, width: 855, modal: true, position: myPos, autoOpen: false, resizable: false, close: function(event, ui) { $(this).dialog('destroy').remove(); $("input[name*='"+defaults.campoLongitud+"']").focus().val($olng[0].value); $("input[name*='"+defaults.campoLatitud+"']").focus().val($olat[0].value); }, open: function (event, ui) { $(this).css('overflow', 'hidden'); } } ); $('#dialogomapa').dialog('open'); }; })(jQuery); /************************************************************************************************************************ * BOTÓN TOOLTIP mapa *************************************************************************************************************************/ /* * BOTÓN TOOLTIP mapa * */ $('button[data-gvhFunction=map]').on({ click: function() { action = $(this).attr('data-gvhDestino'); visor = $(this).attr('data-gvhVisor'); coordX = $(this).attr('data-gvhCoordX'); coordY = $(this).attr('data-gvhCoordY'); zoom = $(this).attr('data-gvhZoom'); url = $(this).attr('data-gvhURL'); tipo = $(this).attr('data-gvhTipo'); id = $(this).attr('id'); switch(visor) { case 'visorICV': $('#'+id).visorICV({ campoLongitud: coordX, campoLatitud: coordY, zoom: zoom, url: url, tipo: tipo }); break; case 'visorGoogle': $('#'+id).visorGoogle({ campoLongitud: coordX, campoLatitud: coordY, zoom: zoom, url: url, tipo: tipo }); break; case 'visorStreetMap': $('#'+id).visorStreetMap({ campoLongitud: coordX, campoLatitud: coordY, zoom: zoom, url: url, tipo: tipo, action: action }); break; case 'visorIDEE': $('#'+id).visorIDEE({ campoLongitud: coordX, campoLatitud: coordY, zoom: zoom, url: url, tipo: tipo }); break; default: break; } } });