private void AddEmptyRectangles(int numRects) { RectangleViewerControl.Rectangles.RaiseListChangedEvents = false; for (int i = 0; i < numRects; i++) { SelectableBoundingBox.WithTreeNode sbb = new SelectableBoundingBox.WithTreeNode(null, null, 0, 0, 0, 0, Brushes.Transparent); RectangleViewerControl.Rectangles.Add(sbb); } RectangleViewerControl.Rectangles.RaiseListChangedEvents = true; RectangleViewerControl.Rectangles.ResetBindings(); }
private void ClearAllRectangles() { for (int i = 0; i < _usedRectangleCount; i++) { SelectableBoundingBox.WithTreeNode sbb = RectangleViewerControl.Rectangles[i] as SelectableBoundingBox.WithTreeNode; if (sbb.Width > 0) { sbb.Color = Brushes.Transparent; sbb.TreeNode = null; sbb.Left = 0; sbb.Top = 0; sbb.Width = 0; sbb.Height = 0; sbb.IsSelected = false; } } _usedRectangleCount = 0; _currInspection = GetNewRectangle(null, Brushes.Transparent, Brushes.Red); _currInspection.CreationType = SelectableBoundingBox.WithTreeNode.Type.FromClick; }
private void InitializeSubWindowsAndControls() { _progressBarWindow = new ProgressBarWindow(); _progressBarWindow.Visibility = System.Windows.Visibility.Hidden; _progressBarWindow.Owner = this; _runtimeStorageWindow = new RuntimeStorageBrowser(); _runtimeStorageWindow.Owner = this; _runtimeStorageWindow.IsVisibleChanged +=_runtimeStorageWindow_IsVisibleChanged; _runtimeStorageWindow.SearchButton.Click += SearchButton_Click; _prototypeBrowserWindow = new PrototypeBrowserWindow(); _prototypeBrowserWindow.Owner = this; _prototypeBrowserWindow.BrowserPane.PrototypeDeleteClicked += BrowserPane_PrototypeDeleteClicked; _prototypeBrowserWindow.BrowserPane.AddPositiveClicked += BrowserPane_AddPositiveClicked; _prototypeBrowserWindow.BrowserPane.DeleteNegativeClicked += BrowserPane_DeleteNegativeClicked; _prototypeBrowserWindow.BrowserPane.DeletePositiveClicked += BrowserPane_DeletePositiveClicked; _prototypeBrowserWindow.IsVisibleChanged +=_prototypeBrowserWindow_IsVisibleChanged; AddEmptyRectangles(200); string selectorstr = null; switch (_studyCondition) { case StudyCondition.Single: case StudyCondition.Layers: case StudyCondition.Debug: selectorstr = "is_text = true"; break; } Color color = System.Windows.Media.Color.FromArgb(80, 254, 162, 254); Selector s = new Selector(color, selectorstr); SelectorPanelControl.Selectors.Add(s); TreeBrowserControl.ItemMouseUp += TreeBrowserControl_ItemMouseUp; ShowBubbleCursor.IsChecked = false; ShowAnnotationOverlays.IsChecked = false; _currInspection = GetNewRectangle(null, Brushes.Transparent, Brushes.Red); _currInspection.CreationType = SelectableBoundingBox.WithTreeNode.Type.FromClick; }
private void RectangleViewerControl_RectangleSelectionChanged(object sender, EventArgs e) { SelectableBoundingBox.WithTreeNode sbb = sender as SelectableBoundingBox.WithTreeNode; if (sbb.IsSelected) { AddSelectedNode(sbb.TreeNode); if (sbb == _currInspection) { _currInspection = GetNewRectangle(sbb.TreeNode, sbb.Color, sbb.SelectedColor); _currInspection.CreationType = SelectableBoundingBox.WithTreeNode.Type.FromClick; } } else if(sbb.CreationType == SelectableBoundingBox.WithTreeNode.Type.FromClick || sbb.CreationType == SelectableBoundingBox.WithTreeNode.Type.FromTreeBrowser) { RemoveSelectedNode(sbb); } else { var pc = SelectedNodes.FirstOrDefault( p => p.Node == sbb.TreeNode); if(pc != null) SelectedNodes.Remove(pc); } }