예제 #1
0
 public DiagramNode GetNodeByName(string name)
 {
     return(DiagramNodes.Find(x => string.Equals(name, x.Name)));
 }
예제 #2
0
        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;
        }
예제 #3
0
 public HitResult HitTest(Vector2 hitPosition)
 {
     return(DiagramNodes.Select(x => x.HitTest(hitPosition)).FirstOrDefault(x => x != null));
 }