コード例 #1
0
		void FillElementItems(ItemList.ElementItem[] elementItems, SynesisRegionRuleModel model) {
			elementItems.ForEach(x => {
				switch (x.name) {
					case "DirectionAlarm":
						model.DirectionAlarm = x.any.Deserialize<synesis.DirectionAlarm>();
						break;
					case "LoiteringAlarm":
						model.LoiteringAlarm = x.any.Deserialize<synesis.LoiteringAlarm>();
						break;
					case "Points":
						model.Points = x.any.Deserialize<synesis.RegionPoints>();
						ScalePointsInput(model.Points);
						break;
					case "SpeedAlarm":
						model.SpeedAlarm = x.any.Deserialize<synesis.SpeedAlarm>();
						break;
					case "AbandonedItemAlarm":
						model.AbandonedItemAlarm = x.any.Deserialize<synesis.AbandonedItemAlarm>();
						break;
					case "RegionMotionAlarm":
						model.RegionMotionAlarm = x.any.Deserialize<synesis.RegionMotionAlarm>();
						break;
				}
			});
		}
コード例 #2
0
 void FillElementItems(ItemList.ElementItem[] elementItems, SynesisTripWireRuleModel model) {
     elementItems.ForEach(x => {
         switch (x.name) {
             case "Points":
                 model.TripPoints = x.any.Deserialize<synesis.TripWirePoints>();
                 ScalePointsInput(model.TripPoints);
                 break;
             //case "Direction":
             //    int i = 0;
             //    //model.TripDirection = x.Any.Deserialize<synesis.TripWireDirection>();
             //    break;
         }
     });
 }
コード例 #3
0
 void FillSimpleItems(ItemList.SimpleItem[] simpleItems, SynesisTripWireRuleModel model) {
     simpleItems.ForEach(x => {
         switch (x.name) {
             case "Direction":
                 switch (x.value) { 
                     case "FromLeft":
                         model.TripDirection = controls.GraphEditor.TripWireEditor.TripWireDirection.FromLeft;
                         break;
                     case "FromRight":
                         model.TripDirection = controls.GraphEditor.TripWireEditor.TripWireDirection.FromRight;
                         break;
                     case "FromBoth":
                         model.TripDirection = controls.GraphEditor.TripWireEditor.TripWireDirection.FromBoth;
                         break;
                 }
                 //model.ruleId = XmlConvert.ToInt32(x.Value);
                 break;
         }
     });
 }
コード例 #4
0
		elementDescr ParseXmlItem(ItemList.ElementItem elemItem) {
			var element = elemItem.any;
			elementDescr elem = new elementDescr() { Name = element.LocalName, XmlElement = element };

			ParseElementDescr(elem);
			
			return elem;
		}
コード例 #5
0
 void FillData(ItemList.SimpleItem[] simpleItems, SynesisAnalyticsModel model) {
     simpleItems.ForEach(simple => {
         switch (simple.name) {
             case "EnableMovingRects":
                 model.EnableMovingRects = DataConverter.StringToBool(simple.value);
                 break;
             case "EnableSpeed":
                 model.EnableSpeed = DataConverter.StringToBool(simple.value);
                 break;
             case "EnableTimestamp":
                 model.EnableTimestamp = DataConverter.StringToBool(simple.value);
                 break;
             case "EnableSystemInformation":
                 model.EnableSystemInformation = DataConverter.StringToBool(simple.value);
                 break;
             case "EnableChannelName":
                 model.EnableChannelName = DataConverter.StringToBool(simple.value);
                 break;
             case "EnableTracking":
                 model.EnableTracking = DataConverter.StringToBool(simple.value);
                 break;
             case "EnableUserRegion":
                 model.EnableUserRegion = DataConverter.StringToBool(simple.value);
                 break;
             case "EnableRules":
                 model.EnableRules = DataConverter.StringToBool(simple.value); 
                 break;
             case "EnableCalibrationResults":
                 model.EnableCalibrationResults = DataConverter.StringToBool(simple.value);
                 break;
         }
     });
 }
コード例 #6
0
		FrameworkElement GetTypeEditor(XmlSchemaType xtype, ItemList.SimpleItem sitem) {
			FrameworkElement felement = null;
			if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Boolean), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToBoolean(sitem.value);
					felement = new CheckBox() {
						IsChecked = val,
						Margin = new Thickness(3)
					};
					felement.SetUpdateTrigger(
						CheckBox.IsCheckedProperty,
						(bool v) => {
							sitem.value = XmlConvert.ToString(v);
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Integer), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToInt32(sitem.value);
					felement = new IntegerUpDown() {
						Value = val,
						Margin = new Thickness(3),
						Increment = 1,
						VerticalAlignment = VerticalAlignment.Center,
						MinWidth = 50
					};
					felement.SetUpdateTrigger(
						IntegerUpDown.ValueProperty,
						(int v) => {
							sitem.value = v.ToString();
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Float), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToDouble(sitem.value);
					felement = new DoubleUpDown() {
						Value = val,
						CultureInfo = System.Globalization.CultureInfo.InvariantCulture,
						Margin = new Thickness(3),
						Increment = 0.1,
						FormatString = "F1",
						VerticalAlignment = VerticalAlignment.Center,
						MinWidth = 50
					};
					felement.SetUpdateTrigger(
						DoubleUpDown.ValueProperty,
						(double v) => {
							sitem.value = v.ToString();
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else if (XmlSchemaType.IsDerivedFrom(xtype, XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.Double), XmlSchemaDerivationMethod.All)) {
				try {
					var val = XmlConvert.ToDouble(sitem.value);
					felement = new DoubleUpDown() {
						Value = val,
						CultureInfo = System.Globalization.CultureInfo.InvariantCulture,
						Margin = new Thickness(3),
						Increment = 0.1,
						FormatString = "F2",
						VerticalAlignment = VerticalAlignment.Center,
						MinWidth = 50
					};
					felement.SetUpdateTrigger(
						DoubleUpDown.ValueProperty,
						(double v) => {
							sitem.value = v.ToString();
						}
					);
				} catch {
					felement = CreateTextEditor(sitem);
				}
			} else {
				felement = CreateTextEditor(sitem);
			}

			return felement;
		}
コード例 #7
0
		FrameworkElement CreateTextEditor(ItemList.SimpleItem sitem) {
			var tedit = new TextBox() {
				Text = sitem.value,
				MinWidth = 50,
				VerticalAlignment = VerticalAlignment.Center
			};
			tedit.SetUpdateTrigger(
				TextBox.TextProperty,
				(string v) => {
					sitem.value = v;
				}
			);
			return tedit;
		}
コード例 #8
0
		FrameworkElement GetSimpleEditorCtrl(XmlSchemaType xtype, string name, ItemList.SimpleItem sitem) {
			StackPanel spanel = new StackPanel();
			spanel.Orientation = Orientation.Horizontal;

			TextBlock tblock = new TextBlock();
			tblock.Margin = new Thickness(3);
			tblock.Text = name;
			tblock.MinWidth = 150;
			tblock.Foreground = Brushes.DarkGray;
			tblock.FontWeight = FontWeights.Bold;
			tblock.VerticalAlignment = System.Windows.VerticalAlignment.Center;

			spanel.Children.Add(tblock);

			spanel.Children.Add(GetTypeEditor(xtype, sitem));
			return spanel;
		}
コード例 #9
0
		void FillElementItems(ItemList.ElementItem[] elementItems, SynesisAnalyticsModel model) {
			elementItems.ForEach(x => {
				switch (x.name) {
					case "AntishakerCrop":
						model.AntishakerCrop = x.any.Deserialize<synesis.AntishakerCrop>();
						ScaleAntishakerCropInput(model.AntishakerCrop);
						break;
					case "MarkerCalibration":
						model.Markers = x.any.Deserialize<synesis.MarkerCalibration>();
						ScaleMarkersInput(model.Markers);
						break;
					case "UserRegion":
						model.UserRegion = x.any.Deserialize<synesis.UserRegion>();
						ScaleUserRegionInput(model.UserRegion);
						break;
				}
			});
		}
コード例 #10
0
		void FillSimpleItems(ItemList.SimpleItem[] simpleItems, SynesisAnalyticsModel model) {
			simpleItems.ForEach(x => {
				switch (x.name) {
					case "StabilizationTime":
						model.StabilizationTime = DataConverter.StringToInt(x.value);
						break;
					case "ShiftOutputPicture":
						model.ShiftOutputPicture = DataConverter.StringToBool(x.value);
						break;
					case "UseObjectTracker":
						model.UseObjectTracker = DataConverter.StringToBool(x.value);
						break;
					case "MaxObjectArea":
						model.MaxObjectArea = DataConverter.StringToFloat(x.value);
						break;
					case "MinObjectArea":
						model.MinObjectArea = DataConverter.StringToFloat(x.value);
						break;
					case "MaxObjectSpeed":
						model.MaxObjectSpeed = DataConverter.StringToFloat(x.value);
						break;
					case "DisplacementSensitivity":
						model.DisplacementSensivity = DataConverter.StringToInt(x.value);
						break;
					case "CameraObstructed":
						model.CameraObstructed = DataConverter.StringToBool(x.value);
						break;
					case "UseAntishaker":
						model.UseAntishaker = DataConverter.StringToBool(x.value);
						break;
					case "CameraRedirected":
						model.CameraRedirected = DataConverter.StringToBool(x.value);
						break;
					case "ContrastSensitivity":
						model.ContrastSensivity = DataConverter.StringToInt(x.value);
						break;
					case "ImageTooDark":
						model.ImageTooDark = DataConverter.StringToBool(x.value);
						break;
					case "ImageTooBlurry":
						model.ImageTooBlurry = DataConverter.StringToBool(x.value);
						break;
					case "ImageTooBright":
						model.ImageTooBright = DataConverter.StringToBool(x.value);
						break;
					case "ImageTooNoisy":
						model.ImageTooNoisy = DataConverter.StringToBool(x.value);
						break;
				}
			});
		}