Advertisement
Guest User

map.js

a guest
Feb 15th, 2019
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mapinfo = {
  2.     regionsize: 512,
  3.     chunksize: 16,
  4.     tilesize: 128,
  5.     maxzoom: 4,
  6. }
  7.  
  8. function InitMap() {
  9.     // ===============================================================================================
  10.     // 7dtd coordinate transformations
  11.  
  12.     SDTD_Projection = {
  13.         project: function (latlng) {
  14.             return new L.Point(
  15.                 (latlng.lat) / Math.pow(2, mapinfo.maxzoom),
  16.                 (latlng.lng) / Math.pow(2, mapinfo.maxzoom) );
  17.         },
  18.        
  19.         unproject: function (point) {
  20.             return new L.LatLng(
  21.                 point.x * Math.pow(2, mapinfo.maxzoom),
  22.                 point.y * Math.pow(2, mapinfo.maxzoom) );
  23.         }
  24.     };
  25.  
  26.     SDTD_CRS = L.extend({}, L.CRS.Simple, {
  27.         projection: SDTD_Projection,
  28.         transformation: new L.Transformation(1, 0, -1, 0),
  29.  
  30.         scale: function (zoom) {
  31.             return Math.pow(2, zoom);
  32.         }
  33.     });
  34.  
  35.     // ===============================================================================================
  36.     // Map and basic tile layers
  37.  
  38.     map = L.map('tab_map', {
  39.         zoomControl: false, // Added by Zoomslider
  40.         zoomsliderControl: true,
  41.         attributionControl: false,
  42.         crs: SDTD_CRS
  43.     }).setView([0, 0], Math.max(0, mapinfo.maxzoom - 5));
  44.  
  45.  
  46.     var initTime = new Date().getTime();
  47.     var tileLayer = GetSdtdTileLayer (mapinfo, initTime);
  48.     var tileLayerMiniMap = GetSdtdTileLayer (mapinfo, initTime, true);
  49.  
  50.     // player icon
  51.     var playerIcon = L.icon({
  52.         iconUrl: '/static/leaflet/images/marker-survivor.png',
  53.         iconRetinaUrl: '/static/leaflet/images/marker-survivor-2x.png',
  54.         iconSize: [25, 48],
  55.         iconAnchor: [12, 24],
  56.         popupAnchor: [0, -20]
  57.     });
  58.    
  59.     // hostile icon
  60.     var hostileIcon = L.icon({
  61.         iconUrl: '/static/leaflet/images/marker-zombie.png',
  62.         iconRetinaUrl: '/static/leaflet/images/marker-zombie-2x.png',
  63.         iconSize: [25, 33],
  64.         iconAnchor: [12, 16],
  65.         popupAnchor: [0, -10]
  66.     });
  67.    
  68.     // animal icon
  69.     var animalIcon = L.icon({
  70.         iconUrl: '/static/leaflet/images/marker-animal.png',
  71.         iconRetinaUrl: '/static/leaflet/images/marker-animal-2x.png',
  72.         iconSize: [25, 26],
  73.         iconAnchor: [12, 13],
  74.         popupAnchor: [0, -10]
  75.     });
  76.    
  77.     // trader icon
  78.     var traderIcon = L.icon({
  79.         iconUrl: '/static/leaflet/images/cart.png',
  80.         iconRetinaUrl: '/static/leaflet/images/cart.png',
  81.         iconSize: [32, 32],
  82.         iconAnchor: [16, 16],
  83.         popupAnchor: [16, 16],
  84.         correction : [20, 18]
  85.     });
  86.    
  87.     function loadPrefabsXML(){
  88.         $.ajax({
  89.         type: "GET",
  90.         url: "prefabs.xml",
  91.         dataType: "xml",
  92.         success: function(xml) {
  93.             setXMLMarkersForDecoration(xml, "trader", traderIcon);
  94.             }
  95.         });
  96.        
  97.     }
  98.    
  99.     function setMapMarker(position, icon){
  100.         var marker;
  101.         if (icon.options.hasOwnProperty('correction')){
  102.             position [0] = String(parseInt(position [0])+icon.options.correction[0]);
  103.             position [2] = String(parseInt(position [2])+icon.options.correction[1]);
  104.         }
  105.         marker = L.marker([position[0], position[2]], {icon: icon}).addTo(map);
  106.     }
  107.    
  108.     function setXMLMarkersForDecoration(xml, decorationname, icon){
  109.        
  110.         var $xml = $(xml);
  111.         var $decoration = $xml.find("decoration[name*='"+decorationname+"']");
  112.         $decoration.each( function(key, val){
  113.             var position = $(this).attr("position").split(",");
  114.             setMapMarker(position, icon);
  115.         });
  116.     }
  117.    
  118.     loadPrefabsXML();
  119.  
  120.  
  121.     // ===============================================================================================
  122.     // Overlays and controls
  123.  
  124.     var playersOnlineMarkerGroup = L.markerClusterGroup({
  125.         maxClusterRadius: function(zoom) { return zoom >= mapinfo.maxzoom ? 10 : 50; }
  126.     });
  127.     var playersOfflineMarkerGroup = L.markerClusterGroup({
  128.         maxClusterRadius: function(zoom) { return zoom >= mapinfo.maxzoom ? 10 : 50; }
  129.     });
  130.     var hostilesMarkerGroup = L.markerClusterGroup({
  131.         maxClusterRadius: function(zoom) { return zoom >= mapinfo.maxzoom ? 10 : 50; }
  132.     });
  133.     var animalsMarkerGroup = L.markerClusterGroup({
  134.         maxClusterRadius: function(zoom) { return zoom >= mapinfo.maxzoom ? 10 : 50; }
  135.     });
  136.  
  137.     var densityMismatchMarkerGroupAir = L.markerClusterGroup({
  138.         maxClusterRadius: function(zoom) { return zoom >= mapinfo.maxzoom ? 10 : 50; }
  139.     });
  140.     var densityMismatchMarkerGroupTerrain = L.markerClusterGroup({
  141.         maxClusterRadius: function(zoom) { return zoom >= mapinfo.maxzoom ? 10 : 50; }
  142.     });
  143.     var densityMismatchMarkerGroupNonTerrain = L.markerClusterGroup({
  144.         maxClusterRadius: function(zoom) { return zoom >= mapinfo.maxzoom ? 10 : 50; }
  145.     });
  146.  
  147.  
  148.     var layerControl = L.control.layers({
  149.             //"Map": tileLayer
  150.         }, null, {
  151.             collapsed: false
  152.         }
  153.     );
  154.    
  155.     var layerCount = 0;
  156.  
  157.  
  158.     tileLayer.addTo(map);
  159.  
  160.     new L.Control.Coordinates({}).addTo(map);
  161.    
  162.     new L.Control.ReloadTiles({
  163.         autoreload_enable: true,
  164.         autoreload_minInterval: 30,
  165.         autoreload_interval: 120,
  166.         autoreload_defaultOn: false,
  167.         layers: [tileLayer, tileLayerMiniMap]
  168.     }).addTo(map);
  169.    
  170.     layerControl.addOverlay (GetRegionLayer (mapinfo), "Region files");
  171.     layerCount++;
  172.    
  173.     var miniMap = new L.Control.MiniMap(tileLayerMiniMap, {
  174.         zoomLevelOffset: -6,
  175.         toggleDisplay: true
  176.     }).addTo(map);
  177.  
  178.     var measure = L.control.measure({
  179.         units: {
  180.             sdtdMeters: {
  181.                 factor: 0.00001,
  182.                 display: 'XMeters',
  183.                 decimals: 0
  184.             },
  185.             sdtdSqMeters: {
  186.                 factor: 0.000000001,
  187.                 display: 'XSqMeters',
  188.                 decimals: 0
  189.             }
  190.         },
  191.         primaryLengthUnit: "sdtdMeters",
  192.         primaryAreaUnit: "sdtdSqMeters",
  193.         //activeColor: "#ABE67E",
  194.         //completedColor: "#C8F2BE",
  195.         position: "bottomleft"
  196.     });
  197.     //measure.addTo(map);
  198.  
  199.     new L.Control.GameTime({}).addTo(map);
  200.    
  201.     if (HasPermission ("webapi.getlandclaims")) {
  202.         layerControl.addOverlay (GetLandClaimsLayer (map, mapinfo), "Land claims");
  203.         layerCount++;
  204.     }
  205.    
  206.     if (HasPermission ("webapi.gethostilelocation")) {
  207.         layerControl.addOverlay (hostilesMarkerGroup, "Hostiles (<span id='mapControlHostileCount'>0</span>)");
  208.         layerCount++;
  209.     }
  210.    
  211.     if (HasPermission ("webapi.getanimalslocation")) {
  212.         layerControl.addOverlay (animalsMarkerGroup, "Animals (<span id='mapControlAnimalsCount'>0</span>)");
  213.         layerCount++;
  214.     }
  215.    
  216.     if (HasPermission ("webapi.getplayerslocation")) {
  217.         layerControl.addOverlay (playersOfflineMarkerGroup, "Players (offline) (<span id='mapControlOfflineCount'>0</span>)");
  218.         layerControl.addOverlay (playersOnlineMarkerGroup, "Players (online) (<span id='mapControlOnlineCount'>0</span>)");
  219.         layerCount++;
  220.     }
  221.    
  222.     if (layerCount > 0) {
  223.         layerControl.addTo(map);
  224.     }
  225.  
  226.  
  227.  
  228.  
  229.     var hostilesMappingList = {};
  230.     var animalsMappingList = {};
  231.     var playersMappingList = {};
  232.  
  233.    
  234.  
  235.     // ===============================================================================================
  236.     // Player markers
  237.  
  238.     $(".leaflet-popup-pane").on('click.action', '.inventoryButton', function(event) {
  239.         ShowInventoryDialog ($(this).data('steamid'));
  240.     });
  241.  
  242.     var updatingMarkers = false;
  243.  
  244.  
  245.     var setPlayerMarkers = function(data) {
  246.         var onlineIds = [];
  247.         updatingMarkers = true;
  248.         $.each( data, function( key, val ) {
  249.             var marker;
  250.             if (playersMappingList.hasOwnProperty(val.steamid)) {
  251.                 marker = playersMappingList[val.steamid].currentPosMarker;
  252.             } else {
  253.                 marker = L.marker([val.position.x, val.position.z], {icon: playerIcon}).bindPopup(
  254.                     "Player: " + $("<div>").text(val.name).html() +
  255.                     (HasPermission ("webapi.getplayerinventory") ?
  256.                         "<br/><a class='inventoryButton' data-steamid='"+val.steamid+"'>Show inventory</a>"
  257.                         : "")
  258.                 );
  259.                 marker.on("move", function ( e ) {
  260.                     if ( this.isPopupOpen () ) {
  261.                         map.flyTo (e.latlng, map.getZoom ());
  262.                     }
  263.                 });
  264.                 playersMappingList[val.steamid] = { online: !val.online };
  265.             }
  266.            
  267.             if (val.online) {
  268.                 onlineIds.push (val.steamid);
  269.             }
  270.            
  271.             oldpos = marker.getLatLng ();
  272.             if ( playersMappingList[val.steamid].online != val.online ) {
  273.                 if (playersMappingList[val.steamid].online) {
  274.                     playersOnlineMarkerGroup.removeLayer(marker);
  275.                     playersOfflineMarkerGroup.addLayer(marker);
  276.                 } else {
  277.                     playersOfflineMarkerGroup.removeLayer(marker);
  278.                     playersOnlineMarkerGroup.addLayer(marker);
  279.                 }
  280.             }
  281.             if ( oldpos.lat != val.position.x || oldpos.lng != val.position.z ) {
  282.                 marker.setLatLng([val.position.x, val.position.z]);
  283.                 if (val.online) {
  284.                         marker.setOpacity(1.0);
  285.                 } else {
  286.                         marker.setOpacity(0.5);
  287.                 }
  288.             }
  289.  
  290.             val.currentPosMarker = marker;
  291.             playersMappingList[val.steamid] = val;
  292.         });
  293.        
  294.         var online = 0;
  295.         var offline = 0;
  296.         $.each ( playersMappingList, function ( key, val ) {
  297.             if ( val.online && onlineIds.indexOf (key) < 0 ) {
  298.                 var marker = val.currentPosMarker;
  299.                 playersOnlineMarkerGroup.removeLayer(marker);
  300.                 playersOfflineMarkerGroup.addLayer(marker);
  301.                 val.online = false;
  302.             }
  303.             if (val.online) {
  304.                 online++;
  305.             } else {
  306.                 offline++;
  307.             }
  308.         });
  309.        
  310.         updatingMarkers = false;
  311.  
  312.         $( "#mapControlOnlineCount" ).text( online );
  313.         $( "#mapControlOfflineCount" ).text( offline );
  314.     }
  315.  
  316.     var updatePlayerTimeout;
  317.     var playerUpdateCount = -1;
  318.     var updatePlayerEvent = function() {
  319.         playerUpdateCount++;
  320.        
  321.         $.getJSON( "../api/getplayerslocation" + ((playerUpdateCount % 15) == 0 ? "?offline=true" : ""))
  322.         .done(setPlayerMarkers)
  323.         .fail(function(jqxhr, textStatus, error) {
  324.             console.log("Error fetching players list");
  325.         })
  326.         .always(function() {
  327.             updatePlayerTimeout = window.setTimeout(updatePlayerEvent, 4000);
  328.         });
  329.     }
  330.  
  331.     tabs.on ("tabbedcontenttabopened", function (event, data) {
  332.         if (data.newTab === "#tab_map") {
  333.             if (HasPermission ("webapi.getplayerslocation")) {
  334.                 updatePlayerEvent ();
  335.             }
  336.         } else {
  337.             window.clearTimeout (updatePlayerTimeout);
  338.         }
  339.     });
  340.    
  341.     if (tabs.tabbedContent ("isTabOpen", "tab_map")) {
  342.         if (HasPermission ("webapi.getplayerslocation")) {
  343.             updatePlayerEvent ();
  344.         }
  345.     }
  346.  
  347.  
  348.  
  349.  
  350.     // ===============================================================================================
  351.     // Hostiles markers
  352.  
  353.     var setHostileMarkers = function(data) {
  354.         updatingMarkersHostile = true;
  355.        
  356.         var hostileCount = 0;
  357.  
  358.         hostilesMarkerGroup.clearLayers();
  359.        
  360.         $.each( data, function( key, val ) {
  361.             var marker;
  362.             if (hostilesMappingList.hasOwnProperty(val.id)) {
  363.                 marker = hostilesMappingList[val.id].currentPosMarker;
  364.             } else {
  365.                 marker = L.marker([val.position.x, val.position.z], {icon: hostileIcon}).bindPopup(
  366.                     "Hostile: " + val.name
  367.                 );
  368.                 //hostilesMappingList[val.id] = { };
  369.                 hostilesMarkerGroup.addLayer(marker);
  370.             }
  371.  
  372.             var bAbort = false;
  373.            
  374.             oldpos = marker.getLatLng ();
  375.  
  376.             //if ( oldpos.lat != val.position.x || oldpos.lng != val.position.z ) {
  377.             //  hostilesMarkerGroup.removeLayer(marker);
  378.                 marker.setLatLng([val.position.x, val.position.z]);
  379.                 marker.setOpacity(1.0);
  380.                 hostilesMarkerGroup.addLayer(marker);
  381.             //}
  382.  
  383.             val.currentPosMarker = marker;
  384.             hostilesMappingList[val.id] = val;
  385.            
  386.             hostileCount++;
  387.         });
  388.        
  389.         $( "#mapControlHostileCount" ).text( hostileCount );
  390.        
  391.         updatingMarkersHostile = false;
  392.     }
  393.  
  394.     var updateHostileTimeout;
  395.     var updateHostileEvent = function() {
  396.         $.getJSON( "../api/gethostilelocation")
  397.         .done(setHostileMarkers)
  398.         .fail(function(jqxhr, textStatus, error) {
  399.             console.log("Error fetching hostile list");
  400.         })
  401.         .always(function() {
  402.             updateHostileTimeout = window.setTimeout(updateHostileEvent, 4000);
  403.         });
  404.     }
  405.  
  406.     tabs.on ("tabbedcontenttabopened", function (event, data) {
  407.         if (data.newTab === "#tab_map") {
  408.             if (HasPermission ("webapi.gethostilelocation")) {
  409.                 updateHostileEvent ();
  410.             }
  411.         } else {
  412.             window.clearTimeout (updateHostileTimeout);
  413.         }
  414.     });
  415.    
  416.     if (tabs.tabbedContent ("isTabOpen", "tab_map")) {
  417.         if (HasPermission ("webapi.gethostilelocation")) {
  418.             updateHostileEvent ();
  419.         }
  420.     }
  421.  
  422.  
  423.  
  424.     // ===============================================================================================
  425.     // Animals markers
  426.  
  427.     var setAnimalMarkers = function(data) {
  428.         updatingMarkersAnimals = true;
  429.        
  430.         var animalsCount = 0;
  431.  
  432.         animalsMarkerGroup.clearLayers();
  433.        
  434.         $.each( data, function( key, val ) {
  435.             var marker;
  436.             if (animalsMappingList.hasOwnProperty(val.id)) {
  437.                 marker = animalsMappingList[val.id].currentPosMarker;
  438.             } else {
  439.                 marker = L.marker([val.position.x, val.position.z], {icon: animalIcon}).bindPopup(
  440.                     "Animal: " + val.name
  441.                 );
  442.                 //animalsMappingList[val.id] = { };
  443.                 animalsMarkerGroup.addLayer(marker);
  444.             }
  445.  
  446.             var bAbort = false;
  447.            
  448.             oldpos = marker.getLatLng ();
  449.  
  450.             //if ( oldpos.lat != val.position.x || oldpos.lng != val.position.z ) {
  451.             //  animalsMarkerGroup.removeLayer(marker);
  452.                 marker.setLatLng([val.position.x, val.position.z]);
  453.                 marker.setOpacity(1.0);
  454.                 animalsMarkerGroup.addLayer(marker);
  455.             //}
  456.  
  457.             val.currentPosMarker = marker;
  458.             animalsMappingList[val.id] = val;
  459.            
  460.             animalsCount++;
  461.         });
  462.        
  463.         $( "#mapControlAnimalsCount" ).text( animalsCount );
  464.        
  465.         updatingMarkersAnimals = false;
  466.     }
  467.  
  468.     var updateAnimalsTimeout;
  469.     var updateAnimalsEvent = function() {
  470.         $.getJSON( "../api/getanimalslocation")
  471.         .done(setAnimalMarkers)
  472.         .fail(function(jqxhr, textStatus, error) {
  473.             console.log("Error fetching animals list");
  474.         })
  475.         .always(function() {
  476.             updateAnimalsTimeout = window.setTimeout(updateAnimalsEvent, 4000);
  477.         });
  478.     }
  479.  
  480.     tabs.on ("tabbedcontenttabopened", function (event, data) {
  481.         if (data.newTab === "#tab_map") {
  482.             if (HasPermission ("webapi.getanimalslocation")) {
  483.                 updateAnimalsEvent ();
  484.             }
  485.         } else {
  486.             window.clearTimeout (updateAnimalsTimeout);
  487.         }
  488.     });
  489.    
  490.     if (tabs.tabbedContent ("isTabOpen", "tab_map")) {
  491.         if (HasPermission ("webapi.getanimalslocation")) {
  492.             updateAnimalsEvent ();
  493.         }
  494.     }
  495.  
  496.    
  497.    
  498.    
  499.    
  500.    
  501.    
  502.    
  503.    
  504.     // ===============================================================================================
  505.     // Density markers
  506.  
  507.     var setDensityMarkers = function(data) {
  508.         var densityCountAir = 0;
  509.         var densityCountTerrain = 0;
  510.         var densityCountNonTerrain = 0;
  511.  
  512.         densityMismatchMarkerGroupAir.clearLayers();
  513.         densityMismatchMarkerGroupTerrain.clearLayers();
  514.         densityMismatchMarkerGroupNonTerrain.clearLayers();
  515.        
  516.        
  517.         var downloadCsv = true;
  518.         var downloadJson = false;
  519.        
  520.         if (downloadJson) {
  521.             var jsonAir = [];
  522.             var jsonTerrain = [];
  523.             var jsonNonTerrain = [];
  524.         }
  525.         if (downloadCsv) {
  526.             var csvAir = "x;y;z;Density;IsTerrain;BvType\r\n";
  527.             var csvTerrain = "x;y;z;Density;IsTerrain;BvType\r\n";
  528.             var csvNonTerrain = "x;y;z;Density;IsTerrain;BvType\r\n";
  529.         }
  530.        
  531.         $.each( data, function( key, val ) {
  532.             if (val.bvtype == 0) {
  533.                 marker = L.marker([val.x, val.z]).bindPopup(
  534.                     "Density Mismatch: <br>Position: " + val.x + " " + val.y + " " + val.z + "<br>Density: " + val.density + "<br>isTerrain: " + val.terrain + "<br>bv.type: " + val.bvtype
  535.                 );
  536.                 densityMismatchMarkerGroupAir.addLayer(marker);
  537.                 densityCountAir++;
  538.                 if (downloadJson) {
  539.                     jsonAir.push (val);
  540.                 }
  541.                 if (downloadCsv) {
  542.                     csvAir += val.x + ";" + val.y + ";" + val.z + ";" + val.density + ";" + val.terrain + ";" + val.bvtype + "\r\n";
  543.                 }
  544.             } else if (val.terrain) {
  545.                 marker = L.marker([val.x, val.z]).bindPopup(
  546.                     "Density Mismatch: <br>Position: " + val.x + " " + val.y + " " + val.z + "<br>Density: " + val.density + "<br>isTerrain: " + val.terrain + "<br>bv.type: " + val.bvtype
  547.                 );
  548.                 densityMismatchMarkerGroupTerrain.addLayer(marker);
  549.                 densityCountTerrain++;
  550.                 if (downloadJson) {
  551.                     jsonTerrain.push (val);
  552.                 }
  553.                 if (downloadCsv) {
  554.                     csvTerrain += val.x + ";" + val.y + ";" + val.z + ";" + val.density + ";" + val.terrain + ";" + val.bvtype + "\r\n";
  555.                 }
  556.             } else {
  557.                 marker = L.marker([val.x, val.z]).bindPopup(
  558.                     "Density Mismatch: <br>Position: " + val.x + " " + val.y + " " + val.z + "<br>Density: " + val.density + "<br>isTerrain: " + val.terrain + "<br>bv.type: " + val.bvtype
  559.                 );
  560.                 densityMismatchMarkerGroupNonTerrain.addLayer(marker);
  561.                 densityCountNonTerrain++;
  562.                 if (downloadJson) {
  563.                     jsonNonTerrain.push (val);
  564.                 }
  565.                 if (downloadCsv) {
  566.                     csvNonTerrain += val.x + ";" + val.y + ";" + val.z + ";" + val.density + ";" + val.terrain + ";" + val.bvtype + "\r\n";
  567.                 }
  568.             }
  569.         });
  570.  
  571.         layerControl.addOverlay (densityMismatchMarkerGroupAir, "Density Mismatches Air (<span id='mapControlDensityCountAir'>0</span>)");
  572.         layerControl.addOverlay (densityMismatchMarkerGroupTerrain, "Density Mismatches Terrain (<span id='mapControlDensityCountTerrain'>0</span>)");
  573.         layerControl.addOverlay (densityMismatchMarkerGroupNonTerrain, "Density Mismatches NonTerrain (<span id='mapControlDensityCountNonTerrain'>0</span>)");
  574.  
  575.         $( "#mapControlDensityCountAir" ).text( densityCountAir );
  576.         $( "#mapControlDensityCountTerrain" ).text( densityCountTerrain );
  577.         $( "#mapControlDensityCountNonTerrain" ).text( densityCountNonTerrain );
  578.        
  579.         if (downloadJson) {
  580.             download ("air-negative-density.json", JSON.stringify(jsonAir, null, '\t'));
  581.             download ("terrain-positive-density.json", JSON.stringify(jsonTerrain, null, '\t'));
  582.             download ("nonterrain-negative-density.json", JSON.stringify(jsonNonTerrain, null, '\t'));
  583.         }
  584.         if (downloadCsv) {
  585.             download ("air-negative-density.csv", csvAir);
  586.             download ("terrain-positive-density.csv", csvTerrain);
  587.             download ("nonterrain-negative-density.csv", csvNonTerrain);
  588.         }
  589.        
  590.         function download(filename, text) {
  591.             var element = document.createElement('a');
  592.             var file = new Blob([text], {type: 'text/plain'});
  593.             element.href = URL.createObjectURL(file);
  594.             element.download = filename;
  595.  
  596.             element.style.display = 'none';
  597.             document.body.appendChild(element);
  598.  
  599.             element.click();
  600.  
  601.             document.body.removeChild(element);
  602.         }
  603.     }
  604.  
  605.     $.getJSON("densitymismatch.json")
  606.     .done(setDensityMarkers)
  607.     .fail(function(jqxhr, textStatus, error) {
  608.         console.log("Error fetching density mismatch list");
  609.     });
  610.  
  611. }
  612.  
  613.  
  614.  
  615.  
  616.  
  617. function StartMapModule () {
  618.     $.getJSON( "../map/mapinfo.json")
  619.     .done(function(data) {
  620.         mapinfo.tilesize = data.blockSize;
  621.         mapinfo.maxzoom = data.maxZoom;
  622.     })
  623.     .fail(function(jqxhr, textStatus, error) {
  624.         console.log ("Error fetching map information");
  625.     })
  626.     .always(function() {
  627.         InitMap ();
  628.     });
  629. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement