|
|
@ -431,3 +431,76 @@ function viewFence(geoFenceElement,id) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closeAll();
|
|
|
|
closeAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function viewFenceByData(geoJson, queryName, areaName, stationeryTime, id) {
|
|
|
|
|
|
|
|
var matchResults = /(?:"geoFenceGeoJSON"):"{(.*)}"/g.exec(geoJson);
|
|
|
|
|
|
|
|
if (matchResults && matchResults.length > 1) {
|
|
|
|
|
|
|
|
geoJson = "{" + matchResults[1] + "}";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
geoJson = JSON.parse(geoJson.replace(/'/g, '"'));
|
|
|
|
|
|
|
|
var geometryShape;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(geoJson.type=="Point"){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var circleOptions = {
|
|
|
|
|
|
|
|
color: '#ff0043'
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
geometryShape= new L.circle([geoJson.coordinates[1],geoJson.coordinates[0]], geoJson.radius,circleOptions);
|
|
|
|
|
|
|
|
// var marker=new L.marker([geoJson.coordinates[1],geoJson.coordinates[0]]);
|
|
|
|
|
|
|
|
map.addLayer(geometryShape);
|
|
|
|
|
|
|
|
// map.addLayer(marker);
|
|
|
|
|
|
|
|
} else if(geoJson.type=="Polygon"){
|
|
|
|
|
|
|
|
geoJson.coordinates[0].pop(); // popout the last coordinate set(lat,lng pair) due to circular chain
|
|
|
|
|
|
|
|
var leafletLatLngs = [];
|
|
|
|
|
|
|
|
$.each(geoJson.coordinates[0], function (idx, pItem) {
|
|
|
|
|
|
|
|
leafletLatLngs.push({lat: pItem[1], lng: pItem[0]});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
geometryShape = new L.Polygon(leafletLatLngs);
|
|
|
|
|
|
|
|
map.addLayer(geometryShape);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var geoPublicUri = $("#geo-charts").data("geo-public-uri");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(id=="Stationery"){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#templateLoader').load(geoPublicUri + "/assets/html_templates/view_fence_popup.html #viewStationeryAlert", function () {
|
|
|
|
|
|
|
|
var popupTemplate = $('#templateLoader').find('#viewStationeryAlert');
|
|
|
|
|
|
|
|
popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id);
|
|
|
|
|
|
|
|
popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id);
|
|
|
|
|
|
|
|
popupTemplate.find('#viewAreaTime').html(stationeryTime);
|
|
|
|
|
|
|
|
geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup();
|
|
|
|
|
|
|
|
// transparent the layer .leaflet-popup-content-wrapper
|
|
|
|
|
|
|
|
$(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if(id=="WithIn"){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#templateLoader').load(geoPublicUri + "/assets/html_templates/view_fence_popup.html #viewWithinAlert", function () {
|
|
|
|
|
|
|
|
var popupTemplate = $('#templateLoader').find('#viewWithinAlert');
|
|
|
|
|
|
|
|
popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id);
|
|
|
|
|
|
|
|
popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id);
|
|
|
|
|
|
|
|
popupTemplate.find('#viewAreaName').html(areaName);
|
|
|
|
|
|
|
|
popupTemplate.find('#withinAlertForm').attr('area-name', areaName);
|
|
|
|
|
|
|
|
popupTemplate.find('#withinAlertForm').attr('query-name', queryName);
|
|
|
|
|
|
|
|
geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup();
|
|
|
|
|
|
|
|
// transparent the layer .leaflet-popup-content-wrapper
|
|
|
|
|
|
|
|
$(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if(id=="Exit"){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#templateLoader').load(geoPublicUri + "/assets/html_templates/view_fence_popup.html #viewExitAlert", function () {
|
|
|
|
|
|
|
|
var popupTemplate = $('#templateLoader').find('#viewExitAlert');
|
|
|
|
|
|
|
|
popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id);
|
|
|
|
|
|
|
|
popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id);
|
|
|
|
|
|
|
|
popupTemplate.find('#viewAreaName').html(areaName);
|
|
|
|
|
|
|
|
popupTemplate.find('#exitAlertForm').attr('area-name', areaName);
|
|
|
|
|
|
|
|
popupTemplate.find('#exitAlertForm').attr('query-name', queryName);
|
|
|
|
|
|
|
|
geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup();
|
|
|
|
|
|
|
|
// transparent the layer .leaflet-popup-content-wrapper
|
|
|
|
|
|
|
|
$(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)");
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if(id=="Traffic"){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
closeAll();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|