예제 #1
0
        public Vector2 this[IDiagramNode node]
        {
            get
            {
                var indexOf = Keys.IndexOf(node.Identifier);
                if (indexOf > -1)
                {
                    return Values[indexOf];
                }

                return node.DefaultLocation;
            }
            set
            {
                var indexOf = Keys.IndexOf(node.Identifier);
                if (indexOf != -1)
                {
                    Values[indexOf] = value;
                }
                else
                {
                    Add(node.Identifier, value);
                }
            }
        }
 public bool HasPosition(IGraphFilter filter, IDiagramNode node)
 {
     if (Positions.ContainsKey(filter.Identifier))
     {
         var filterData = Positions[filter.Identifier];
         if (filterData.Keys.Contains(node.Identifier)) return true;
     }
     return false;
 }
 public static FilterItem ShowInFilter(this IGraphFilter filter, IDiagramNode node, Vector2 position, bool collapsed = false)
 {
     var filterItem = new FilterItem()
     {
         FilterId = filter.Identifier,
         NodeId = node.Identifier,
         Position = position,
         Collapsed = collapsed
     };
     filter.Repository.Add(filterItem);
     var filterNode = filter as IDiagramNode;
     if (filterNode != null)
     {
         filterNode.NodeAddedInFilter(node);
     }
     return filterItem;
 }
        private void AddNode(IDiagramNode diagramNode)
        {
            var diagramNodeUi = (DiagramNodeViewModelBase)_diagramShapeUiFactory.CreateDiagramNodeUi(DiagramService, diagramNode, MiniButtonPanelViewModel);

            diagramNodeUi.SizeChanged += OnDiagramNodeSizeChanged;
            diagramNodeUi.ShowRelatedNodesRequested    += OnShowRelatedNodesRequested;
            diagramNodeUi.RelatedNodeSelectorRequested += OnEntitySelectorRequested;
            diagramNodeUi.RemoveRequested += OnRemoveDiagramNodeRequested;

            _diagramNodeToViewModelMap.Set(diagramNode.Id, diagramNodeUi);

            DiagramService.TryGetContainerNode(diagramNode)
            .Match(
                containerNode =>
            {
                if (IsNodeVisibleOnDiagram(containerNode, out var containerNodeUi))
                {
                    ((IContainerDiagramNodeUi)containerNodeUi).AddChildNode(diagramNodeUi);
                }
            },
                () => DiagramNodeViewModels.Add(diagramNodeUi));
        }
        private static IEnumerable<IGraphFilter> FilterPathInternal(IDiagramNode node)
        {
            var container = node.Container();
            while (container != null)
            {
                yield return container;
                var filterNode = container as IDiagramNode;
                if (filterNode != null)
                {
                    container = filterNode.Container();
                    if (container == filterNode)
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }

            }
        }
예제 #6
0
        private void UpdateParentNodeChildrenAreaSize([NotNull] IDiagramNode updatedNode)
        {
            if (!updatedNode.HasParent)
            {
                return;
            }

            var parentNode = GetDiagramNode(updatedNode.ParentNodeId.Value);

            var newChildrenAreaSize = CalculateChildrenAreaSize(parentNode.Id);

            if (newChildrenAreaSize.IsUndefined && parentNode.ChildrenAreaSize.IsUndefined ||
                newChildrenAreaSize == parentNode.ChildrenAreaSize)
            {
                return;
            }

            UpdateNodeCore(
                parentNode.Id,
                i => i.WithChildrenAreaSize(newChildrenAreaSize),
                DiagramNodeMember.ChildrenAreaSize);
        }
예제 #7
0
        private static IEnumerable <IGraphFilter> FilterPathInternal(IDiagramNode node)
        {
            var container = node.Container();

            while (container != null)
            {
                yield return(container);

                var filterNode = container as IDiagramNode;
                if (filterNode != null)
                {
                    container = filterNode.Container();
                    if (container == filterNode)
                    {
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
        }
예제 #8
0
        public override IDiagramNodeUi CreateDiagramNodeUi(
            IDiagramNode diagramNode,
            IFocusTracker <IDiagramShapeUi> focusTracker)
        {
            var payload = diagramNode.ModelNode.Payload;

            if (!(payload is ISymbol symbol))
            {
                return(null);
            }

            var headerUi = CreateDiagramNodeHeaderUi(symbol);

            return(new RoslynDiagramNodeViewModel(
                       ModelEventSource,
                       DiagramEventSource,
                       diagramNode,
                       RelatedNodeTypeProvider,
                       (IWpfFocusTracker <IDiagramShapeUi>)focusTracker,
                       IsDescriptionVisible,
                       symbol,
                       headerUi));
        }
예제 #9
0
        private void AddNode(IDiagramNode diagramNode, ModelNodeId?parentNodeId)
        {
            var diagramNodeUi = (DiagramNodeViewModel)_diagramShapeUiFactory.CreateDiagramNodeUi(DiagramService, diagramNode, MiniButtonPanelViewModel);

            diagramNodeUi.SizeChanged += OnDiagramNodeSizeChanged;
            diagramNodeUi.ShowRelatedNodesRequested    += OnShowRelatedNodesRequested;
            diagramNodeUi.RelatedNodeSelectorRequested += OnEntitySelectorRequested;
            diagramNodeUi.RemoveRequested += OnRemoveDiagramNodeRequested;

            _diagramNodeToViewModelMap.Set(diagramNode.Id, diagramNodeUi);

            if (parentNodeId.HasValue)
            {
                if (IsNodeVisibleOnDiagram(parentNodeId.Value, out var containerNodeUi))
                {
                    containerNodeUi.AddChildNode(diagramNodeUi);
                }
            }
            else
            {
                DiagramNodeViewModels.Add(diagramNodeUi);
            }
        }
    public Vector2 this[IGraphFilter filter, IDiagramNode node]
    {
        get
        {
            if (Positions.ContainsKey(filter.Identifier))
            {
                var filterData = Positions[filter.Identifier];
                if (filterData.Keys.Contains(node.Identifier))
                    return filterData[node];


            }
            return Vector2.zero;
        }
        set
        {
            if (!Positions.ContainsKey(filter.Identifier))
            {
                Positions.Add(filter.Identifier, new FilterLocations());
            }

            Positions[filter.Identifier][node] = value;
        }
    }
    public Vector2 this[IGraphFilter filter, IDiagramNode node]
    {
        get
        {
            if (Positions.ContainsKey(filter.Identifier))
            {
                var filterData = Positions[filter.Identifier];
                if (filterData.Keys.Contains(node.Identifier))
                {
                    return(filterData[node]);
                }
            }
            return(Vector2.zero);
        }
        set
        {
            if (!Positions.ContainsKey(filter.Identifier))
            {
                Positions.Add(filter.Identifier, new FilterLocations());
            }

            Positions[filter.Identifier][node] = value;
        }
    }
예제 #12
0
 private DiagramOperationResult RemoveAllConnectorsOfNode([NotNull] IDiagramNode node, DiagramOperationResult diagramOperationResult)
 {
     return(_allShapesGraph.GetAllEdges(node.Id)
            .Aggregate(diagramOperationResult, (current, connector) => RemoveConnectorCore(connector.Id, current)));
 }
예제 #13
0
 public DiagramNodeAddedEvent([NotNull] IDiagramNode newNode)
 {
     NewNode = newNode;
 }
 public DiagramNodeModelNodeChangedEvent([NotNull] IDiagram newDiagram, [NotNull] IDiagramNode oldNode, [NotNull] IDiagramNode newNode)
     : base(newDiagram, oldNode, newNode)
 {
 }
예제 #15
0
 private void OnRemoveDiagramNodeRequested(DiagramId diagramId, [NotNull] IDiagramNode diagramNode)
 {
     GetDiagramService(diagramId).RemoveNode(diagramNode.Id);
 }
예제 #16
0
 protected ContainerDiagramNodeViewModelBase(IModelService modelService, IDiagramService diagramService,
                                             IFocusTracker <IDiagramShapeUi> focusTracker, IDiagramNode diagramNode)
     : base(modelService, diagramService, focusTracker, diagramNode)
 {
     ChildNodes = new ThreadSafeObservableCollection <DiagramNodeViewModelBase>();
 }
예제 #17
0
 public DiagramConnector(IModelRelationship relationship, IDiagramNode source, IDiagramNode target,
                         ConnectorType connectorType, Route route)
 {
     ModelRelationship = relationship ?? throw new ArgumentNullException(nameof(relationship));
     Source            = source ?? throw new ArgumentNullException(nameof(source));
     Target            = target ?? throw new ArgumentNullException(nameof(target));
     ConnectorType     = connectorType ?? throw new ArgumentNullException(nameof(connectorType));
     Route             = route;
 }
예제 #18
0
 public virtual void NodeAdded(IDiagramNode data)
 {
 }
예제 #19
0
 public void NodeValidated(IDiagramNode node)
 {
     ErrorInfo.Clear();
     Signal<IQueryErrors>(_=>_.QueryErrors(ErrorInfo));
     UpdateList();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NodeMoveThumbPositionChanged"/> class.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 public NodeMoveThumbPositionChanged(IDiagramNode node, Point start, Point end)
     : base(node, start, end)
 {
 }
 public void UpdateNode(IDiagramNode node)
 {
     Surface.Formatter.Layout.SetNodeBounds(node, node.Bounds);
 }
예제 #22
0
 public DiagramNodeModelNodeChangedEvent(IDiagram newDiagram, IDiagramNode oldNode, IDiagramNode newNode)
     : base(newDiagram, oldNode, newNode)
 {
 }
예제 #23
0
        public void AddNode(IDiagramNode data)
        {

        }
예제 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PositionChangedArgs"/> class.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 public PositionChangedArgs(IDiagramNode node, Point start, Point end)
 {
     Start = start;
     End = end;
     Node = node;
 }
예제 #25
0
        public void RemoveNode(IDiagramNode node, bool removePositionData = true)
        {

        }
예제 #26
0
 public DiagramConnector(IModelRelationship relationship, IDiagramNode source, IDiagramNode target,
                         ConnectorType connectorType)
     : this(relationship, source, target, connectorType, Route.Empty)
 {
 }
예제 #27
0
 public IDiagramNode GetOtherNode(IDiagramNode n)
 {
     return Shapes.LineGraph.GetOtherNode(this, n);
 }
예제 #28
0
 private IDiagramConnector CreateInstance(IDiagramNode source, IDiagramNode target, Route route)
 => new DiagramConnector(ModelRelationship, source, target, ConnectorType, route);
예제 #29
0
 protected virtual void OnSelectionChanged(IDiagramNode olddata, IDiagramNode newdata)
 {
     SelectionChangedEventArgs handler = SelectionChanged;
     if (handler != null) handler(olddata, newdata);
 }
예제 #30
0
 private void OnDiagramNodeHeaderSizeChanged(DiagramId diagramId, [NotNull] IDiagramNode diagramNode, Size2D newSize)
 {
     GetDiagramService(diagramId).UpdateNodeHeaderSize(diagramNode.Id, newSize);
 }
예제 #31
0
        //public void UpgradeProject()
        //{
        //    InvertApplication
        //    InvertGraphEditor.ExecuteCommand((n) =>
        //    {
        //        Process15Uprade();
        //    });

        //}

        //public void Process15Uprade()
        //{

        //}

        public FilterItem AddNode(IDiagramNode newNodeData)
        {
            return AddNode(newNodeData, LastMouseEvent.MouseDownPosition);
        }
 public ShowSourceFileCommand(IAppServices appServices, IDiagramNode diagramNode)
     : base(appServices)
 {
     _diagramNode = diagramNode;
 }
예제 #33
0
 private void OnDiagramNodeSizeChanged(DiagramId diagramId, IDiagramNode diagramNode, Size2D newSize)
 {
     GetDiagramService(diagramId).UpdateDiagramNodeSize(diagramNode, newSize);
 }
예제 #34
0
 public override void Remove(IDiagramNode diagramNode)
 {
 }
예제 #35
0
 public void Update([NotNull] IDiagramNode diagramNode)
 {
     SetDiagramShapeProperties(diagramNode);
     SetDiagramNodeProperties(diagramNode);
     UpdateHeader(diagramNode);
 }
예제 #36
0
 private DiagramOperationResult RemoveChildNodes([NotNull] IDiagramNode node, DiagramOperationResult diagramOperationResult)
 {
     return(GetChildNodes(node.Id)
            .Aggregate(diagramOperationResult, (current, childNode) => RemoveNodeCore(childNode.Id, current)));
 }
예제 #37
0
 private static bool GetHasChildren([NotNull] IDiagramNode diagramNode)
 {
     return(diagramNode.ChildrenAreaSize.IsDefined && diagramNode.ChildrenAreaSize != Size2D.Zero);
 }
예제 #38
0
 public DiagramOperationResult Remove([NotNull] IDiagramNode node)
 {
     return(new DiagramOperationResult(Nodes.Remove(node.Id), Connectors, Events));
 }
 public static void HideInFilter(this IGraphFilter filter, IDiagramNode node)
 {
     filter.Repository.RemoveAll<FilterItem>(p => p.FilterId == filter.Identifier && p.NodeId == node.Identifier);
 }
예제 #40
0
 public void NavigateTo(IDiagramNode node)
 {
     // TODO 2.0 Rewrite Navigate To
 }
예제 #41
0
 public static IDiagramNode GetOtherNode(IDiagramLine l, IDiagramNode n)
 {
     if (l.FromPort.Node == n)
     {
         return l.ToPort.Node;
     }
     if (l.ToPort.Node == n)
     {
         return l.FromPort.Node;
     }
     return null;
 }
예제 #42
0
        public FilterItem AddNode(IDiagramNode newNodeData, Vector2 position)
        {
            newNodeData.GraphId = GraphData.Identifier;
            CurrentRepository.Add(newNodeData);

            if (string.IsNullOrEmpty(newNodeData.Name))
                newNodeData.Name =
                    CurrentRepository.GetUniqueName("New" + newNodeData.GetType().Name.Replace("Data", ""));

            return GraphData.CurrentFilter.ShowInFilter(newNodeData, position);
        }
    public override void Remove(IDiagramNode diagramNode)
    {

    }
예제 #44
0
 private void OnRemoveDiagramNodeRequested(DiagramId diagramId, IDiagramNode diagramNode)
 {
     //GetDiagramService(diagramId).HideModelNode(diagramNode.Id);
 }
예제 #45
0
 public override void NodeRemoved(IDiagramNode nodeData)
 {
     base.NodeRemoved(nodeData);
 }
예제 #46
0
 /// <summary>
 /// Subtypes with a different header must override this method.
 /// </summary>
 protected virtual void UpdateHeader([NotNull] IDiagramNode diagramNode)
 {
     HeaderViewModel.Payload = diagramNode.ModelNode.Payload;
 }
예제 #47
0
 public abstract void Remove(IDiagramNode diagramNode);
예제 #48
0
 public DiagramNodeAddedEvent([NotNull] IDiagram newDiagram, [NotNull] IDiagramNode newNode)
     : base(newDiagram)
 {
     NewNode = newNode;
 }
예제 #49
0
 public virtual void Rename(IDiagramNode data, string name)
 {
     Name = name;
 }