Ejemplo n.º 1
0
        public static bool ProcessFenceConditionWithOutDuration(ATAlert alert)
        {
            var FencePositionLs = alert.FencePosition.Select(m => new GeoPoint()
            {
                X = Double.Parse(m.Lat), Y = Double.Parse(m.Lang)
            }).ToList();

            if (alert.AlarmType == DeviceAlarmType.FenceInAlarm)
            {
                // Check inside
                return(GeoPolygon.IsInside(FencePositionLs, Double.Parse(alert.CurrentData.VariableNVales["Latitude"]),
                                           Double.Parse(alert.CurrentData.VariableNVales["Longitude"])));
            }
            else if (alert.AlarmType == DeviceAlarmType.FenceOutAlarm)
            {
                // Check outside
                return(!GeoPolygon.IsInside(FencePositionLs, Double.Parse(alert.CurrentData.VariableNVales["Latitude"]),
                                            Double.Parse(alert.CurrentData.VariableNVales["Longitude"])));
            }
            return(true);
        }