Mostar puntos de interes en rastreo

This commit is contained in:
2020-02-06 13:19:52 -07:00
parent 2852d1505b
commit 45027a61e7
5 changed files with 554 additions and 234 deletions

View File

@@ -4,7 +4,7 @@ var polylinesGeoRutas = [];
var polybounds = [];
function initGeoRutas() {
NuevaConsultaGeoRutas();
//NuevaConsultaGeoRutas();
var upRutasDiv = document.createElement('div');
var upRutas = new ControlGeoRutas(upRutasDiv, map);
@@ -65,6 +65,8 @@ function NuevaConsultaGeoRutas() {
polylinesGeoRutas = [];
polybounds = [];
markersRutas = [];
$("#LnkMostarGeoRutas").css("display", "block");
}
function ControlGeoRutas(controlDiv, map) {
@@ -98,7 +100,7 @@ function ControlGeoRutas(controlDiv, map) {
ControlSub2.style.fontFamily = ' "Open Sans", sans-serif; ';
ControlSub2.style.msUserSelect = 'none;';
ControlSub2.style.fontSize = '11px'
ControlSub2.style.display = 'block'
ControlSub2.style.display = 'none'
ControlSub2.style.backgroundColor = 'rgb(255,255,255)'
ControlSub2.style.padding = '11px'
ControlSub2.style.backgroundClip = 'padding-box'

138
GPS/Rastreo/JS/Geocercas.js Normal file
View File

@@ -0,0 +1,138 @@
//REGION GEOCERCAS
var polygonsGeocercas = [];
var markersGeo = [];
var IsGeoVisibles = false;
function initGeocercas() {
//NuevaConsultaGeoCercas();
var upGeoDiv = document.createElement('div');
var upGeo = new ControlGeocercas(upGeoDiv, map);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(upGeoDiv);
}
function NuevaConsultaGeoCercas() {
HideGeocercas();
DeleteGeocercas();
$("#LnkMostarGeocercas").css("display", "block");
}
function VerGeocercas() {
if (IsGeoVisibles) {
HideGeocercas();
IsGeoVisibles = false;
} else {
CargaGeocercas();
IsGeoVisibles = true;
}
}
function CargaGeocercas() {
for (var i = 0; i < polygonsGeocercas.length; i++) {
polygonsGeocercas[i].setMap(map);
}
for (var j = 0; j < markersGeo.length; j++) {
markersGeo[j].setMap(map);
}
}
function DeleteGeocercas() {
for (var i = 0; i < polygonsGeocercas.length; i++) {
polygonsGeocercas[i].setMap(null);
}
for (var j = 0; j < markersGeo.length; j++) {
markersGeo[j].setMap(null);
}
polygonsGeocercas = [];
markersGeo = [];
}
function HideGeocercas() {
for (var i = 0; i < polygonsGeocercas.length; i++) {
polygonsGeocercas[i].setMap(null);
}
for (var j = 0; j < markersGeo.length; j++) {
markersGeo[j].setMap(null);
}
}
function creaPoligonoGeocerca(coords, color, Geocerca) {
var polygon = new google.maps.Polygon({
paths: coords,
strokeColor: color,
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: color,
fillOpacity: 0.35
});
polygonsGeocercas.push(polygon);
CreaMarcadorPoligonoGeocerca(coords, Geocerca);
}
function CreaMarcadorPoligonoGeocerca(coords, GeoCerca) {
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < coords.length; i++) {
bounds.extend(coords[i]);
}
var marker = new google.maps.Marker({
position: bounds.getCenter(),
title: GeoCerca
});
var infowindow = new google.maps.InfoWindow({
content: '<h4><b>' + GeoCerca + '</b></h4>'
});
marker.addListener('click', function () {
closeLastOpenedInfoWindow();
infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow;
});
markersGeo.push(marker);
}
function ControlGeocercas(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 = "LnkMostarGeocercas"
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 Geocercas'
ControlSub1.appendChild(ControlSub2)
ControlSub1.addEventListener('click', function () {
VerGeocercas();
});
}
//END REGION

View File

@@ -0,0 +1,108 @@
//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);
}
}