public DiagramNode GetNodeByName(string name) { return(DiagramNodes.Find(x => string.Equals(name, x.Name))); }
public Diagram() { _nodes = new DiagramNodes(this); _edges = new DiagramEdges(this); _selection = new DiagramSelection(this); _itemsInDrawingOrder = new DiagramItemCollection<DiagramItem>(this); _nodes.CollectionChanged += NodeCollectionChanged; _edges.CollectionChanged += EdgeCollectionChanged; _selection.CollectionChanged += SelectionChanged; Background = new SolidColorBrush(Colors.Transparent); _defaultNodeDrawer = new RectangleNodeDrawer(); _defaultEdgeDrawer = new LineEdgeDrawer(); //DefaultLabelDrawer = new BaseLabelDrawer(); _placedItems = new ObservableCollection<IDiagramPlacedItem>(); _placedItems.CollectionChanged += new NotifyCollectionChangedEventHandler(CustomChilren_CollectionChanged); _mouseManager = new DiagramMouseManager(this); _mouseManager.LabelLButtonDblClick += new LabelEventHandler(OnLabelLButtonDblClick); _mouseManager.NodeLButtonDblClick += new NodeEventHandler(OnNodeLButtonDblClick); _mouseManager.EdgeLButtonDblClick += new EdgeEventHandler(OnEdgeLButtonDblClick); _viewport = null; _boundaries = null; CalculateBoundaries(); LockRender = false; LockRecalc = false; _scrollViewer = null; }
public HitResult HitTest(Vector2 hitPosition) { return(DiagramNodes.Select(x => x.HitTest(hitPosition)).FirstOrDefault(x => x != null)); }