Merge pull request #447 from Megala21/embed

Adding minor fixes to geo fencing
revert-dabc3590
sinthuja 8 years ago committed by GitHub
commit 9e9a480486

@ -12,9 +12,9 @@ define stream dataIn (id string, latitude double, longitude double, timeStamp lo
@Export('org.wso2.geo.ProcessedSpatialEvents:1.0.0') @Export('org.wso2.geo.ProcessedSpatialEvents:1.0.0')
define stream dataOut (id string, latitude double, longitude double, timeStamp long, type string ,speed float, heading float, eventId string, state string, information string); define stream dataOut (id string, latitude double, longitude double, timeStamp long, type string ,speed float, heading float, eventId string, state string, information string);
from dataIn[geo:within(longitude,latitude,"$geoFenceGeoJSON")==true and id == $deviceId]#geodashboard:subscribe() from dataIn[geo:within(longitude,latitude,"$geoFenceGeoJSON")==true and id == "$deviceId"]#geodashboard:subscribe()
select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "ALERTED" as state, "This device is in $areaName restricted area!!!" as information select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "ALERTED" as state, "This device is in $areaName restricted area!!!" as information
insert into dataOut; insert into dataOut;
from dataIn[geo:within(longitude,latitude,"$geoFenceGeoJSON")!=true and id == $deviceId] from dataIn[geo:within(longitude,latitude,"$geoFenceGeoJSON")!=true and id == "$deviceId"]
select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "NORMAL" as state, "" as information select id , latitude, longitude,timeStamp, type, speed, heading ,eventId , "NORMAL" as state, "" as information
insert into dataOut; insert into dataOut;

@ -281,7 +281,8 @@ function setWithinAlert(leafletId) {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({
'geoFenceGeoJSON': selectedAreaGeoJson, 'geoFenceGeoJSON': selectedAreaGeoJson,
'executionPlanName': createExecutionPlanName(queryName, "WithIn", deviceId), 'executionPlanName': createExecutionPlanName(queryName, "WithIn", deviceId),
'areaName': areaName 'areaName': areaName,
'deviceId' : deviceId
}), }),
'executionPlan': 'Within', 'executionPlan': 'Within',
'customName': areaName, // TODO: fix , When template copies there can be two queryName and areaName id elements in the DOM 'customName': areaName, // TODO: fix , When template copies there can be two queryName and areaName id elements in the DOM

@ -677,13 +677,14 @@ function intializeWebsocketUrls() {
.constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain + .constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain +
ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION .CEP_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION
+ "?token=ee9971c8-bf09-3c83-b097-ce87a0c88806&deviceId=" + deviceId + "&deviceType=" + deviceType; + "?deviceId=" + deviceId + "&deviceType=" + deviceType;
alertWebSocketURL = 'wss://' + data.ip + ':' + data.httpsPort + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance alertWebSocketURL = 'wss://' + data.ip + ':' + data.httpsPort + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions .CEP_WEB_SOCKET_OUTPUT_ADAPTOR_WEBAPP_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions
.constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain + .constance.TENANT_INDEX + ApplicationOptions.constance.PATH_SEPARATOR + data.user.domain +
ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance
.CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION .CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION
+ "?token=ee9971c8-bf09-3c83-b097-ce87a0c88806&deviceId=" + deviceId + "&deviceType=" + deviceType; + "?deviceId=" + deviceId + "&deviceType=" + deviceType;
document.cookie = "websocket-token=f98d6142-e988-3c7f-a8c9-7e6d74da7113; path=/";
initializeWebSocket(); initializeWebSocket();
initializeOnAlertWebSocket(); initializeOnAlertWebSocket();
}); });
@ -705,7 +706,8 @@ intializeWebsocketUrls();
SpatialObject.prototype.stateIcon = function () { SpatialObject.prototype.stateIcon = function () {
var iconUrl = "/portal/store/carbon.super/fs/gadget/geo-dashboard/img/markers/object-types/" + this.type.toLowerCase(); //TODO : Need to add separate icons for each device type
var iconUrl = "/portal/store/carbon.super/fs/gadget/geo-dashboard/img/markers/object-types/default_icons";
if (0 < this.speed && (-360 <= this.heading && 360 >= this.heading)) { if (0 < this.speed && (-360 <= this.heading && 360 >= this.heading)) {
iconUrl = iconUrl + "/moving/" + this.state.toLowerCase(); iconUrl = iconUrl + "/moving/" + this.state.toLowerCase();
} else { } else {

@ -12,7 +12,7 @@
define stream dataIn (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string, state string, information string ); define stream dataIn (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string, state string, information string );
@Export('org.wso2.geo.AlertsNotifications:1.0.0') @Export('org.wso2.geo.AlertsNotifications:1.0.0')
define stream alertsOut ( id string, state string, information string, timeStamp long, latitude double, longitude double ); define stream alertsOut ( id string, state string, information string, timeStamp long, latitude double, longitude double, type string);
@Export('org.wso2.geo.FusedSpatialEvent:1.0.0') @Export('org.wso2.geo.FusedSpatialEvent:1.0.0')
define stream dataOut ( id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, state string, information string, notify bool ); define stream dataOut ( id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, state string, information string, notify bool );
@ -25,5 +25,5 @@ select id, latitude, longitude, timeStamp, type, speed, heading, state , informa
insert into dataOut; insert into dataOut;
from dataOut[notify == true] from dataOut[notify == true]
select id,state,information,timeStamp, latitude, longitude select id, state, information,timeStamp, latitude, longitude, type
insert into alertsOut; insert into alertsOut;

@ -7,8 +7,8 @@
"messageType" : "Point", "messageType" : "Point",
"type": "Feature", "type": "Feature",
"id": {{id}}, "id": {{id}},
"deviceId": "rkxb293yw2t2", "deviceId": {{id}},
"deviceType": "virtual_firealarm", "deviceType": {{type}},
"properties": { "properties": {
"speed": {{speed}}, "speed": {{speed}},
"heading": {{heading}}, "heading": {{heading}},

@ -8,8 +8,8 @@
"messageType" : "Alert", "messageType" : "Alert",
"type": "Feature", "type": "Feature",
"id": {{id}}, "id": {{id}},
"deviceId": "rkxb293yw2t2", "deviceId": {{id}},
"deviceType" : "virtual_firealarm", "deviceType" : "{{type}}",
"state": {{state}}, "state": {{state}},
"information": {{information}}, "information": {{information}},
"longitude" : {{longitude}}, "longitude" : {{longitude}},

@ -27,6 +27,10 @@
{ {
"name": "longitude", "name": "longitude",
"type": "DOUBLE" "type": "DOUBLE"
},
{
"name": "type",
"type": "STRING"
} }
] ]
} }
Loading…
Cancel
Save