-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update samples to work with both number and letter sidc
- Loading branch information
1 parent
db56511
commit bce78ab
Showing
3 changed files
with
141 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,57 +2,72 @@ | |
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<style type="text/css"> | ||
html, | ||
body, | ||
.mymap { | ||
padding: 0; | ||
margin: 0; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
</style> | ||
<meta charset="UTF-8" /> | ||
<style type="text/css"> | ||
html, | ||
body, | ||
.mymap { | ||
padding: 0; | ||
margin: 0; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
</style> | ||
|
||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" /> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | ||
<script src="../../dist//milsymbol.js"></script> | ||
<script src="../situation.json"></script> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" /> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> | ||
<script src="../../dist//milsymbol.js"></script> | ||
<script src="../situation.json"></script> | ||
</head> | ||
|
||
<body onload="init()"> | ||
<script> | ||
function init() { | ||
var osmAttr = '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'; | ||
var OSM = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 18, attribution: osmAttr }), | ||
latlng = L.latLng(59, 16); | ||
var map = L.map('map', { center: latlng, zoom: 5, layers: [OSM] }); | ||
|
||
var iconSize = { "C": 15, "D": 20, "E": 25, "F": 30, "G": 35, "H": 40, "I": 45 }; | ||
|
||
L.geoJson(situation, { | ||
pointToLayer: function (feature, latlng) { | ||
|
||
var mysymbol = new ms.Symbol( | ||
feature.properties.SIDC, { | ||
size: iconSize[(feature.properties.SIDC).charAt(11)], | ||
uniqueDesignation: feature.properties.name | ||
}) | ||
|
||
var myicon = L.icon({ | ||
iconUrl: mysymbol.toDataURL(), | ||
iconAnchor: [mysymbol.getAnchor().x, mysymbol.getAnchor().y], | ||
}); | ||
|
||
return L.marker(latlng, { icon: myicon, draggable: true }); | ||
} | ||
}).addTo(map); | ||
} | ||
<script> | ||
function init() { | ||
var osmAttr = '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'; | ||
var OSM = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 18, attribution: osmAttr }), | ||
latlng = L.latLng(59, 16); | ||
var map = L.map('map', { center: latlng, zoom: 5, layers: [OSM] }); | ||
|
||
var iconSize = { | ||
"Team/Crew": 5, | ||
"Squad": 10, | ||
"Section": 15, | ||
"Platoon/detachment": 20, | ||
"Company/battery/troop": 25, | ||
"Battalion/squadron": 30, | ||
"Regiment/group": 35, | ||
"Brigade": 40, | ||
"Division": 45, | ||
"Corps/MEF": 50, | ||
"Army": 55, | ||
"Army Group/front": 60, | ||
"Region/Theater": 65, | ||
"Command": 70 | ||
}; | ||
|
||
L.geoJson(situation, { | ||
pointToLayer: function (feature, latlng) { | ||
|
||
</script> | ||
var mysymbol = new ms.Symbol( | ||
feature.properties.SIDC, { | ||
uniqueDesignation: feature.properties.name | ||
}) | ||
// Now that we have a symbol we can ask for the echelon and set the symbol size | ||
mysymbol = mysymbol.setOptions({ size: iconSize[mysymbol.getProperties().echelon] }); | ||
|
||
var myicon = L.icon({ | ||
iconUrl: mysymbol.toDataURL(), | ||
iconAnchor: [mysymbol.getAnchor().x, mysymbol.getAnchor().y], | ||
}); | ||
|
||
return L.marker(latlng, { icon: myicon, draggable: true }); | ||
} | ||
}).addTo(map); | ||
} | ||
</script> | ||
|
||
<div id="map" class="mymap"></div> | ||
<div id="map" class="mymap"></div> | ||
|
||
</body> | ||
|
||
</html> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters