Files
SIG/GPS/Rastreo/JS/PuntosDeInteres.js
2020-02-06 13:34:47 -07:00

109 lines
3.0 KiB
JavaScript

//REGION PUNTOS DE INTERES
var markersPI = [];
function initPI() {
//NuevaConsultaPI();
var upRutasDiv = document.createElement('div');
var upRutas = new ControlPI(upRutasDiv, map);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(upRutasDiv);
}
function CreaMarcadorPI(coords, nomEquipo) {
var marker = new google.maps.Marker({
position: coords,
title: nomEquipo,
map: map
});
var infowindow = new google.maps.InfoWindow({
content: '<h4><b>' + nomEquipo + '</b></h4>'
});
marker.addListener('click', function () {
closeLastOpenedInfoWindow();
infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow;
});
markersPI.push(marker);
}
function NuevaConsultaPI() {
for (var j = 0; j < markersPI.length; j++) {
markersPI[j].setMap(null);
}
markersPI = [];
$("#LnkMostarPI").css("display", "block");
}
function ControlPI(controlDiv, map) {
// Set CSS for the control border.
var controlUI = document.createElement('div');
controlUI.style.marginLeft = '10px';
controlUI.style.zIndex = '0';
controlUI.style.cursor = 'pointer';
// controlUI.style.position = 'absolute';
controlUI.style.left = "0px";
controlUI.style.width = "150px";
controlUI.style.marginTop = "10px"
controlUI.style.top = "0px";
controlUI.className = 'gmnoprint';
controlDiv.appendChild(controlUI);
var ControlSub1 = document.createElement('div')
ControlSub1.style.float = 'left';
ControlSub1.className = 'gm-style-mtc'
controlUI.appendChild(ControlSub1)
var ControlSub2 = document.createElement('div')
ControlSub2.style.direction = 'ltr';
ControlSub2.style.overflow = 'hidden';
ControlSub2.id = "LnkMostarPI"
ControlSub2.style.textAlign = 'center';
ControlSub2.style.position = 'relative';
ControlSub2.style.color = 'rgb(0,0,0)';
ControlSub2.style.fontFamily = ' "Open Sans", sans-serif; ';
ControlSub2.style.msUserSelect = 'none;';
ControlSub2.style.fontSize = '11px'
ControlSub2.style.display = 'none'
ControlSub2.style.backgroundColor = 'rgb(255,255,255)'
ControlSub2.style.padding = '11px'
ControlSub2.style.backgroundClip = 'padding-box'
ControlSub2.style.minWidth = '28px'
ControlSub2.style.fontWeight = '500'
ControlSub2.style.boxShadow = '0 1px 4px -1px rgba(0,0,0,.3)';
ControlSub2.innerHTML = 'Mostrar Puntos de Interés'
ControlSub1.appendChild(ControlSub2)
ControlSub1.addEventListener('click', function () {
VerPI();
});
}
var IsPIVisible = false;
function VerPI() {
if (IsPIVisible) {
HidePI();
IsPIVisible = false;
} else {
CargaPI();
IsPIVisible = true;
}
}
function HidePI() {
for (var j = 0; j < markersPI.length; j++) {
markersPI[j].setMap(null);
}
}
function CargaPI() {
for (var i = 0; i < markersPI.length; i++) {
markersPI[i].setMap(map);
}
}