|
@@ -0,0 +1,146 @@
|
|
|
+{# {{dump(locations)}} #}
|
|
|
+
|
|
|
+<div style="padding: 10px">
|
|
|
+ <div style="text-align: center">
|
|
|
+ <span class="no_defined nas_data_origen">{{'Onus'|trans({}, 'StatsBundle') }}
|
|
|
+ ({{locations|length}} {{ 'onus_with_lat_lng'|trans({}, 'StatsBundle') }})
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div id="div-map-loader">{% include '@Stats/Stats/Template/load_svg.html.twig' with {'width': '120px'} %}</div>
|
|
|
+ <div id="map" style="height:575px;display:hidden"></div>
|
|
|
+</div>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+/* --------------------- PROGRAMA PRINCIPAL ------------------------- */
|
|
|
+
|
|
|
+var elements = {{locations|json_encode|raw}};
|
|
|
+var loc = {{location|json_encode|raw}};
|
|
|
+var initializedMap = false;
|
|
|
+
|
|
|
+/* --------------------- Carga Mapa -------------------------------- */
|
|
|
+
|
|
|
+function initializeMap() {
|
|
|
+
|
|
|
+ initializedMap = true;
|
|
|
+ $("#div-map-loader").hide();
|
|
|
+ $("#map").show();
|
|
|
+
|
|
|
+ //window.map = new L.Map('map', { center: new L.LatLng({{location['lat']}}, {{location['lng']}}), zoom: {{location['zoom']}} });
|
|
|
+ window.map = new L.Map('map', { center: new L.LatLng(loc.lat, loc.lng), zoom: loc.zoom });
|
|
|
+
|
|
|
+ map.invalidateSize();
|
|
|
+
|
|
|
+ var gstreet = L.tileLayer('https://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}',{
|
|
|
+ attribution: 'Google Inc.',
|
|
|
+ maxNativeZoom: 22,
|
|
|
+ maxZoom: 24,
|
|
|
+ subdomains:['mt0','mt1','mt2','mt3']
|
|
|
+ });
|
|
|
+
|
|
|
+ var controlLayers = L.control.layers({
|
|
|
+ "Street": gstreet.addTo(window.map),
|
|
|
+ "Satellite": L.tileLayer('https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}',{
|
|
|
+ attribution: 'Google Inc.',
|
|
|
+ maxNativeZoom: 21,
|
|
|
+ maxZoom: 21,
|
|
|
+ subdomains:['mt0','mt1','mt2','mt3']
|
|
|
+ }),
|
|
|
+ "Hybrid": L.tileLayer('https://{s}.google.com/vt/lyrs=s,h&x={x}&y={y}&z={z}',{
|
|
|
+ attribution: 'Google Inc.',
|
|
|
+ maxNativeZoom: 21,
|
|
|
+ maxZoom: 21,
|
|
|
+ subdomains:['mt0','mt1','mt2','mt3']
|
|
|
+ }),
|
|
|
+ }, {}, {position: 'topleft',collapsed: true});
|
|
|
+
|
|
|
+ controlLayers.addTo(window.map);
|
|
|
+
|
|
|
+ bounds = [];
|
|
|
+ heatOn = [];
|
|
|
+ heatOff = [];
|
|
|
+ heatRxR = [];
|
|
|
+ heatRxY = [];
|
|
|
+ heatRxG = [];
|
|
|
+ heatTxR = [];
|
|
|
+ heatTxY = [];
|
|
|
+ heatTxG = [];
|
|
|
+
|
|
|
+ for(e in elements) {
|
|
|
+
|
|
|
+ var onu = elements[e];
|
|
|
+
|
|
|
+ if(onu.status) {
|
|
|
+ heatOn.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else {
|
|
|
+ heatOff.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ bounds.push([onu.lat, onu.lng]);
|
|
|
+
|
|
|
+ if(onu.rx <= -30) {
|
|
|
+ heatRxR.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.rx > -30 && onu.rx < -28) {
|
|
|
+ heatRxR.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.rx >= -28 && onu.rx < -26) {
|
|
|
+ heatRxY.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.rx >= -26 && onu.rx < 20) {
|
|
|
+ heatRxG.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.rx >= -20 && onu.rx < -15) {
|
|
|
+ heatRxY.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.rx >= -15 && onu.rx < -13) {
|
|
|
+ heatRxR.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else {
|
|
|
+ heatRxR.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(onu.tx < 1) {
|
|
|
+ heatTxR.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.tx >= 1 && onu.tx < 1.5) {
|
|
|
+ heatTxY.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.tx >= 1.5 && onu.tx < 3.5) {
|
|
|
+ heatTxG.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else if(onu.tx >= 3.5 && onu.tx < 4.5) {
|
|
|
+ heatTxY.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ } else {
|
|
|
+ heatTxR.push([onu.lat, onu.lng, 1.0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ map.fitBounds(bounds);
|
|
|
+
|
|
|
+
|
|
|
+ var gradientOn = {0.0: '#00a65a', 1.0: '#00a65a'};
|
|
|
+ var gradientOff = {0.0: '#ff0000', 1.0: '#ff0000'};
|
|
|
+ var online = L.heatLayer(heatOn, {blur: 10, radius: 10, maxZoom:10, gradient: gradientOn});
|
|
|
+ var offline = L.heatLayer(heatOff, {blur: 10, radius: 10, maxZoom: 10, gradient: gradientOff});
|
|
|
+ var statusGroup = L.layerGroup([online,offline]).addTo(window.map);
|
|
|
+
|
|
|
+ var gradientR = {0.0: '#ff4d3f', 1.0: '#ff4d3f'};
|
|
|
+ var gradientY = {0.0: '#ffa732', 1.0: '#ffa732'};
|
|
|
+ var gradientG = {0.0: '#00a65a', 1.0: '#00a65a'};
|
|
|
+
|
|
|
+ var rxR = L.heatLayer(heatRxR, {blur: 10, radius: 10, maxZoom: 10, gradient: gradientR});
|
|
|
+ var rxY = L.heatLayer(heatRxY, {blur: 10, radius: 10, maxZoom: 10, gradient: gradientY});
|
|
|
+ var rxG = L.heatLayer(heatRxG, {blur: 10, radius: 10, maxZoom: 10, gradient: gradientG});
|
|
|
+ var rxGroup = L.layerGroup([rxR, rxY, rxG]);
|
|
|
+
|
|
|
+ var txR = L.heatLayer(heatTxR, {blur: 10, radius: 10, maxZoom: 10, gradient: gradientR});
|
|
|
+ var txY = L.heatLayer(heatTxY, {blur: 10, radius: 10, maxZoom: 10, gradient: gradientY});
|
|
|
+ var txG = L.heatLayer(heatTxG, {blur: 10, radius: 10, maxZoom: 10, gradient: gradientG});
|
|
|
+ var txGroup = L.layerGroup([txR, txY, txG]);
|
|
|
+
|
|
|
+ var overlayMaps = {"{{ 'Status'|trans({}, 'StatsBundle') }}": statusGroup, "{{ 'RX Power'|trans({}, 'StatsBundle') }}": rxGroup, "{{ 'TX Power'|trans({}, 'StatsBundle') }}": txGroup};
|
|
|
+
|
|
|
+ L.control.layers(overlayMaps,{},{collapsed: false}).addTo(window.map);
|
|
|
+
|
|
|
+ console.log(heatRxR);
|
|
|
+ console.log(heatRxY);
|
|
|
+ console.log(heatRxG);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+</script>
|