private SceneRect GetRect(CaptureSource model) { SceneRect rect = null; if (model.W > 0 && model.H > 0) { var ratio = (double)model.W / (double)model.H; var baseExtent = 0.5; var baseRatio = 16.0 / 9.0; if (ratio > baseRatio) { rect = new SceneRect { W = baseExtent, H = baseExtent * baseRatio / ratio } } ; else { rect = new SceneRect { W = baseExtent * ratio / baseRatio, H = baseExtent } }; } return(rect); }
protected Box(SerializationInfo pInfo, StreamingContext pContext) : base(pInfo, pContext) { // for version evaluation while deserializing int pSerVersion = pInfo.GetInt32("m_SerVersion"); if (m_SerVersion >= 1) { m_DepthMean = pInfo.GetDouble("m_DepthMean"); m_SceneItem = new SceneRect(); } if (m_SerVersion >= 2) { m_MatchPercentageOffset = pInfo.GetDouble("m_MatchPercentageOffset"); } if (m_SerVersion >= 3) { m_LowerThreshold = pInfo.GetInt32("m_LowerThreshold"); m_UpperThreshold = pInfo.GetInt32("m_UpperThreshold"); } updateScene(); }
public Box() : base() { m_SceneItem = new SceneRect(); updateScene(); }
public void UpdateFromModel() { if (!Equals(Rect.Value, Model.Rect)) { Rect.SilentValue = Model.Rect; } Maximize.CanExecute.Value = !Equals(Model.Rect, SceneRect.Full()); Zoom.SetPtz(Model.Ptz, Model.ZoomBehavior, Model.Source?.Device != null); }
protected ObjectDetectionZone(SerializationInfo pInfo, StreamingContext pContext) : base(pInfo, pContext) { // for version evaluation while deserializing int pSerVersion = pInfo.GetInt32("m_SerVersion"); m_Depth = pInfo.GetInt32("m_Depth"); m_DepthMean = pInfo.GetDouble("m_DepthMean"); m_SceneItem = new SceneRect(); updateScene(); }
private void UpdateOrCreateItem(string id, byte[] data) { var source = new SceneItemSource { Image = new SceneItemSourceImage { ResourceId = id } }; if (Editing) { _editedItem.Source = source; } else { var size = _model.ImageHelper.GetSize(data); SceneRect rect = null; if (size.width > 0 && size.height > 0) { var ratio = (double)size.width / (double)size.height; var baseExtent = 0.5; var baseRatio = 16.0 / 9.0; if (ratio > baseRatio) { rect = new SceneRect { W = baseExtent, H = baseExtent * baseRatio / ratio } } ; else { rect = new SceneRect { W = baseExtent * ratio / baseRatio, H = baseExtent } }; } _model.AddSourceToScene(source, false, rect); } }
public ObjectDetectionZone(int pId) : base(pId) { m_SceneItem = new SceneRect(); updateScene(); }
public static void SetRect(DependencyObject element, SceneRect value) => element.SetValue(RectProperty, value);
private void OnDragStarted(object sender, DragStartedEventArgs e) { _startDrag = Mouse.GetPosition(_parent); _startRect = _parent.Rect; }
public Box(int pId) : base(pId) { m_SceneItem = new SceneRect(); updateScene(); }