35 lines
1 KiB
Twig
35 lines
1 KiB
Twig
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key={{ bingmaps_api_key|raw }}' async defer></script>
|
|
<script>
|
|
|
|
var polygons = new Array();
|
|
|
|
function GetMap()
|
|
{
|
|
var map = new Microsoft.Maps.Map('#m_geomap', {
|
|
center: new Microsoft.Maps.Location(14.6091, 121.0223),
|
|
mapTypeId: Microsoft.Maps.MapTypeId.road,
|
|
zoom: 13
|
|
});
|
|
|
|
{% if areas %}
|
|
{% for obj in areas %}
|
|
var pointsArray = new Array();
|
|
|
|
{% for point in obj.getCoverageArea.getRing(0).getPoints() %}
|
|
var polylatlng = new Microsoft.Maps.Location(
|
|
{{ point.getLatitude }},
|
|
{{ point.getLongitude }});
|
|
|
|
pointsArray.push(polylatlng);
|
|
{% endfor %}
|
|
|
|
var coveredarea = new Microsoft.Maps.Polygon(pointsArray, {
|
|
fillColor: "#FF0000"
|
|
});
|
|
map.entities.push(coveredarea);
|
|
|
|
polygons[{{ obj.getID}}] = coveredarea;
|
|
|
|
{% endfor %}
|
|
{% endif %}
|
|
}
|