Files
SIG/GPS/TrayectoDetalle.aspx

731 lines
43 KiB
Plaintext

<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="TrayectoDetalle.aspx.vb" Inherits="GPS_TrayectoDetalle" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style type="text/css">
/*html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}*/
/*#map {
width: 100%;
margin: 0;
padding: 0;
position: fixed !important;
}*/
.pac-container.pac-logo {
z-index: 100000;
}
.v-center {
display: flex;
align-items: center;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
<asp:Literal ID="LblTitulo" runat="server" Text="Trayecto"></asp:Literal>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:UpdatePanel runat="server" UpdateMode="conditional">
<ContentTemplate>
<asp:LinkButton runat="server" ID="BtnTerminarTrayeto" OnClick="BtnTerminarTrayeto_Click"><i class="fa fa-map-marker"></i>Terminar Trayecto</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<ajax:TabContainer runat="server" Width="100%">
<ajax:TabPanel runat="server" HeaderText="Recorrido">
<ContentTemplate>
<div class="row">
<div class="col-md-12 ">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-map-o"></i>
<span class="caption-subject bold uppercase">Recorrido de la unidad:</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div id="map" style="height: 600px; padding: 0;"></div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" HeaderText="Estatus">
<ContentTemplate>
<asp:UpdatePanel ID="UpEventos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-6 ">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-map-signs font-green"></i>
<span class="caption-subject bold uppercase">Datos del Trayecto:</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form" style="padding: 5px;">
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Estatus Actual:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlEstatusActual" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Vehículo:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlDispositivo" runat="server"></asp:Literal>
</div>
</div>
<br />
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Fecha Inicio:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlFechaI" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Fecha Fin:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlFechaF" runat="server"></asp:Literal>
</div>
</div>
<br />
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Combustible Inicial:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlCombustibleI" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Combustible Final:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlCombustibleF" runat="server"></asp:Literal>
</div>
</div>
<br />
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Cargas:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlCargas" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Descargas:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlDescargas" runat="server"></asp:Literal>
</div>
</div>
<br />
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Combutible Consumido:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlCombustibleConsumido" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Rendimiento:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlRendimiento" runat="server"></asp:Literal>
</div>
</div>
<br />
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Velocidad Media:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlVMedia" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Velocidad Máxima:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlVMax" runat="server"></asp:Literal>
</div>
</div>
<br />
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Tiempo Operativo:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlTiempo" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Kilometros Recorridos:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlKM" runat="server"></asp:Literal>
</div>
</div>
<br />
<div class="row v-center">
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="No. Excesos de Velocidad:"></asp:Literal></b>
</div>
<div class="col-md-4 v-center">
<asp:Literal ID="LtlExcesosVelo" runat="server"></asp:Literal>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 ">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-car font-green"></i>
<span class="caption-subject bold uppercase">Historial de Estatus:</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvEstatus" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Eventos" GridLines="none" ToolTip="Listado de Eventos" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:BoundField DataField="Estatus" ItemStyle-Width="15%" HeaderText="Estatus" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="ES" ItemStyle-Width="15%" HeaderText="Evento" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Fecha" ItemStyle-Width="15%" HeaderText="Fecha" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Combustible" ItemStyle-Width="15%" HeaderText="Combustible" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Direccion" ItemStyle-Width="40%" HeaderText="Dirección" ItemStyle-HorizontalAlign="Left" />
<%-- <asp:BoundField DataField="Combustible" ItemStyle-Width="20%" HeaderText="Combustible" ItemStyle-HorizontalAlign="Center" />--%>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" HeaderText="Driving">
<ContentTemplate>
<asp:UpdatePanel ID="UpDriving" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-6 ">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa
fa-car font-green"></i>
<span class="caption-subject bold uppercase">Eventos de la unidad:</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvEventos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Eventos" GridLines="none" ToolTip="Listado de Eventos" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:BoundField DataField="Evento" ItemStyle-Width="20%" HeaderText="Evento" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaTrama" ItemStyle-Width="20%" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Direccion" ItemStyle-Width="60%" HeaderText="Dirección" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-car font-green"></i>
<span class="caption-subject bold uppercase">Ralentí:</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvRalenti" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Eventos" GridLines="none" ToolTip="Listado de Eventos" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:BoundField DataField="Evento" ItemStyle-Width="25%" HeaderText="Estatus" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="TiempoDetenido" ItemStyle-Width="25%" HeaderText="Evento" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaTrama" ItemStyle-Width="25%" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-car font-green"></i>
<span class="caption-subject bold uppercase">Excesos de Velocidad:</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvExcesos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Eventos" GridLines="none" ToolTip="Listado de Eventos" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:BoundField DataField="VelocidadMaxima" ItemStyle-Width="25%" HeaderText="Velocidad Máxima" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="TiempoDetenido" ItemStyle-Width="25%" HeaderText="Tiempo Detenido" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaTrama" ItemStyle-Width="25%" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" HeaderText="Igniciones">
<ContentTemplate>
<asp:UpdatePanel runat="server" ID="UpIgniciones">
<ContentTemplate>
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-car font-green"></i>
<span class="caption-subject bold uppercase">Igniciones</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvIgnicion" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-rows="1" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" ToolTip="Listado de Numero de Vueltas Realizadas">
<Columns>
<asp:BoundField DataField="Vehiculo" ItemStyle-Width="12.5%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaEncendido" ItemStyle-Width="12.5%" HeaderText="Fecha Encendido" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaApagado" ItemStyle-Width="12.5%" HeaderText="Fecha Apagado" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="VMedia" DataFormatString="{0:N2} Km/hr." ItemStyle-Width="12.5%" HeaderText="Velocidad Media" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="VMax" DataFormatString="{0:N2} Km/hr." ItemStyle-Width="12.5%" HeaderText="Velocidad Máxima" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Kilometraje" DataFormatString="{0:N2} Km." ItemStyle-Width="12.5%" HeaderText="Kilometraje" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Duracion" ItemStyle-Width="12.5%" HeaderText="Duración" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Dirección Inicial" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Literal ID="LtlDireccionInicial" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Dirección Final" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Literal ID="LtlDireccionFinal" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" HeaderText="Combustible">
<ContentTemplate>
<asp:UpdatePanel runat="server" ID="UpCombustible">
<ContentTemplate>
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-car font-green"></i>
<span class="caption-subject bold uppercase">Combustible</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvCombustible" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-rows="1" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<Columns>
<asp:BoundField DataField="Estatus" ItemStyle-Width="12.5%" HeaderText="Estatus" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="EstatusSiguiente" ItemStyle-Width="12.5%" HeaderText="Estatus Siguiente" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Cargas" DataFormatString="{0:N0}" ItemStyle-Width="12.5%" HeaderText="Cargas" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="SumaCargas" DataFormatString="{0:N2} Lts." ItemStyle-Width="12.5%" HeaderText="Combustible Cargas" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Descargas" DataFormatString="{0:N0}" ItemStyle-Width="12.5%" HeaderText="Descargas" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="SumaDescargas" DataFormatString="{0:N2} Lts." ItemStyle-Width="12.5%" HeaderText="Combustible Descargas" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Distancia" DataFormatString="{0:N2} Km." ItemStyle-Width="12.5%" HeaderText="Distancia" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="CombustibleI" DataFormatString="{0:N2} Lts." ItemStyle-Width="12.5%" HeaderText="Combustible Inicial" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="CombustibleF" DataFormatString="{0:N2} Lts." ItemStyle-Width="12.5%" HeaderText="Combustible Final" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="CombustibleConsumido" DataFormatString="{0:N2} Lts." ItemStyle-Width="12.5%" HeaderText="Combustible Consimido" ItemStyle-HorizontalAlign="Right" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel runat="server" HeaderText="Gastos">
<ContentTemplate>
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
<ContentTemplate>
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-money font-green"></i>
<span class="caption-subject bold uppercase">Gastos</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvGastos" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
data-sort="true" data-rows="1" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" OnRowDataBound="GvGastos_RowDataBound">
<Columns>
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Precio" HeaderText="Precio" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Descripcion" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Observaciones" HeaderText="Observaciones" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Fecha" ItemStyle-Width="15%" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField DataField="FechaIng" ItemStyle-Width="15%" HeaderText="Fecha de Ingreso" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField DataField="UsuarioIngreso" HeaderText="Usuario Ingresó" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="UsuarioModifico" HeaderText="Usuario Modificó" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Total" HeaderText="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Left" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 29.0730, lng: -110.9559 },
zoom: 7
});
}
var polylines = [];
var polygons = [];
var polybounds = [];
var markers = [];
var GeoReferencias = []
var lastOpenedInfoWindow;
var directionsDisplay;
//$(document).ready(function () {
// initMap();
// DeleteMarkers();
//});
function DeleteMarkers() {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
for (var i = 0; i < polygons.length; i++) {
polygons[i].setMap(null);
}
markers = [];
polygons = [];
if (typeof directionsDisplay !== 'undefined') {
directionsDisplay.setMap(null);
}
}
function doScaledCLick(boton) {
setTimeout(function () {
$(boton).click();
}, 250);
}
function creaPoligono(coords, color, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior) {
var polygon = new google.maps.Polygon({
paths: coords,
strokeColor: color,
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: color,
fillOpacity: 0.35
});
polygon.setMap(map);
polygons.push(polygon);
CreaMarcadorPoligono(coords, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior)
}
var posInicio, posFin;
function CreaMarcadorPoligono(coords, GeoCerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior) {
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < coords.length; i++) {
bounds.extend(coords[i]);
}
if (InicioFin == 0) {
var data = {
CveEstatus: CveEstatus,
CveEstatusAnterior: CveEstatusAnterior,
coords: bounds.getCenter(),
};
GeoReferencias.push(data);
} else if (InicioFin == 1) {
posInicio = bounds.getCenter();
} else if (InicioFin == 2) {
posFin = bounds.getCenter();
var directionsService = new google.maps.DirectionsService;
directionsDisplay = new google.maps.DirectionsRenderer({
map: map,
suppressMarkers: true
});
calculateAndDisplayRoute(directionsService, directionsDisplay, posInicio, posFin);
}
var marker = new google.maps.Marker({
position: bounds.getCenter(),
title: GeoCerca,
map: map
});
var infowindow = new google.maps.InfoWindow({
content: '<h4><b> GeoReferencia: ' + GeoCerca + '</b></h4><h4><b> Estatus: ' + Estatus + '</b></h4>'
});
marker.addListener('click', function () {
closeLastOpenedInfoWindow();
infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow;
});
markers.push(marker);
}
function calculateAndDisplayRoute(directionsService, directionsDisplay, pointA, pointB) {
var waypts = [];
var orden = GeoReferencias.sort((a, b) => parseInt(a.CveEstatusAnterior) - parseInt(b.CveEstatusAnterior));
for (var i = 0; i < orden.length; i++) {
waypts.push({
location: orden[i].coords,
stopover: true
});
}
directionsService.route({
origin: pointA,
destination: pointB,
waypoints: waypts,
travelMode: google.maps.TravelMode.DRIVING
}, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
window.alert('Directions request failed due to ' + status);
}
});
}
function CenterPoligono(coords) {
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < coords.length; i++) {
bounds.extend(coords[i]);
}
map.fitBounds(bounds)
}
function closeLastOpenedInfoWindow() {
if (lastOpenedInfoWindow) {
lastOpenedInfoWindow.close();
}
}
function FitBounds() {
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < polygons.length; i++) {
var paths = polygons[i].getPaths();
paths.forEach(function (path) {
var ar = path.getArray();
for (var i = 0, l = ar.length; i < l; i++) {
bounds.extend(ar[i]);
}
})
}
for (var i = 0; i < polybounds.length; i++) {
bounds.extend(polybounds[i]);
}
for (var i = 0; i < markers.length; i++) {
if (markers[i].getVisible()) {
bounds.extend(markers[i].getPosition());
}
}
map.fitBounds(bounds)
}
function CreaMarcador(coords, nomEquipo, ContentString, imagen) {
//setTimeout(function () {
//}, 500);
if (typeof imagen === 'undefined') { imagen = image; }
var marker = new google.maps.Marker({
position: coords,
title: nomEquipo,
map: map,
icon: imagen
});
var infowindow = new google.maps.InfoWindow({
content: ContentString
});
marker.addListener('click', function () {
closeLastOpenedInfoWindow();
infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow;
});
markers.push(marker);
}
function creaPolyline(coords, color, GeoCerca) {
var polyline = new google.maps.Polyline({
path: coords,
strokeColor: color,
strokeOpacity: 0.8,
strokeWeight: 2,
fillOpacity: 0.35
});
polyline.setMap(map);
polylines.push(polyline);
polybounds.push(coords[0]);
polybounds.push(coords[coords.length - 1]);
CreaMarcadorPoligono(coords, GeoCerca);
}
function NuevaConsulta() {
for (var i = 0; i < polygons.length; i++) {
polygons[i].setMap(null);
}
polygons = [];
for (var i = 0; i < polylines.length; i++) {
polylines[i].setMap(null);
}
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
polylines = [];
polybounds = [];
markers = [];
$("#dvConsulta").modal({ backdrop: 'static', keyboard: false })
}
function fitBoundsToVisibleMarkers() {
var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < polygons.length; i++) {
bounds.extend(polygons[i].my_getBounds().getCenter())
}
for (var i = 0; i < markers.length; i++) {
if (markers[i].getVisible()) {
bounds.extend(markers[i].getPosition());
}
}
map.fitBounds(bounds);
}
</script>
<script src="<%= String.Format("https://maps.googleapis.com/maps/api/js?key={0}&libraries=places", Extensiones.GOOGLE_MAPS_API_KEY) %>"</script>
</asp:Content>