예제 #1
0
      private SpeedCameraInfo _fromInput(SpeedCamera inputCamera) {
         var ci = new SpeedCameraInfo();

         ci.CameraId = inputCamera.Id;
         ci.Operator = _getOperatorByRegion(inputCamera.Location);
         ci.Type = inputCamera.Type;
         ci.SpeedLimit = inputCamera.SpeedLimit;
         ci.Direction = inputCamera.Direction;
         ci.Orientation = inputCamera.Orientation;
         ci.Location = inputCamera.Location;
         ci.Distance = inputCamera.Distance;
         ci.DataSource = DataSources.Backend;

         return ci;
      }
예제 #2
0
 private void _processCameras(XmlNode data) {
    BplLanguage.RuntimeMode = BplRuntimeMode.Batch;
    var res = new List<SpeedCamera>();
    foreach (XmlNode node in data.ChildNodes) {
       var e = new SpeedCamera {
          Direction = _toAngle(node.Attributes["DIR"].Value),
          Orientation = SpeedCameraOrientation.Current,
          Location = new Coordinate(double.Parse(node.SelectSingleNode("./LAT").InnerText), double.Parse(node.SelectSingleNode("./LON").InnerText)),
          Type = node.Attributes["LASER"].Value == "0" ? SpeedCameraType.Static : SpeedCameraType.Mobile,
          Distance = Distance.Undefined,
          SpeedLimit = Speed.Undefined,
       };
       e.Id = BplIdentity.Get("Netroads-".Append(node.Attributes["ID"].Value));
       res.Add(e);
    }
    if (res.Count > 0) {
       UpdatePoliceTraps(res.ToArray());
    } else {
       Log.Warn("Empty response from cameras service");
    }
 }