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; } } }
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); }
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; } } }
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)); }
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; } }
private DiagramOperationResult RemoveAllConnectorsOfNode([NotNull] IDiagramNode node, DiagramOperationResult diagramOperationResult) { return(_allShapesGraph.GetAllEdges(node.Id) .Aggregate(diagramOperationResult, (current, connector) => RemoveConnectorCore(connector.Id, current))); }
public DiagramNodeAddedEvent([NotNull] IDiagramNode newNode) { NewNode = newNode; }
public DiagramNodeModelNodeChangedEvent([NotNull] IDiagram newDiagram, [NotNull] IDiagramNode oldNode, [NotNull] IDiagramNode newNode) : base(newDiagram, oldNode, newNode) { }
private void OnRemoveDiagramNodeRequested(DiagramId diagramId, [NotNull] IDiagramNode diagramNode) { GetDiagramService(diagramId).RemoveNode(diagramNode.Id); }
protected ContainerDiagramNodeViewModelBase(IModelService modelService, IDiagramService diagramService, IFocusTracker <IDiagramShapeUi> focusTracker, IDiagramNode diagramNode) : base(modelService, diagramService, focusTracker, diagramNode) { ChildNodes = new ThreadSafeObservableCollection <DiagramNodeViewModelBase>(); }
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; }
public virtual void NodeAdded(IDiagramNode data) { }
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); }
public DiagramNodeModelNodeChangedEvent(IDiagram newDiagram, IDiagramNode oldNode, IDiagramNode newNode) : base(newDiagram, oldNode, newNode) { }
public void AddNode(IDiagramNode data) { }
/// <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; }
public void RemoveNode(IDiagramNode node, bool removePositionData = true) { }
public DiagramConnector(IModelRelationship relationship, IDiagramNode source, IDiagramNode target, ConnectorType connectorType) : this(relationship, source, target, connectorType, Route.Empty) { }
public IDiagramNode GetOtherNode(IDiagramNode n) { return Shapes.LineGraph.GetOtherNode(this, n); }
private IDiagramConnector CreateInstance(IDiagramNode source, IDiagramNode target, Route route) => new DiagramConnector(ModelRelationship, source, target, ConnectorType, route);
protected virtual void OnSelectionChanged(IDiagramNode olddata, IDiagramNode newdata) { SelectionChangedEventArgs handler = SelectionChanged; if (handler != null) handler(olddata, newdata); }
private void OnDiagramNodeHeaderSizeChanged(DiagramId diagramId, [NotNull] IDiagramNode diagramNode, Size2D newSize) { GetDiagramService(diagramId).UpdateNodeHeaderSize(diagramNode.Id, newSize); }
//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; }
private void OnDiagramNodeSizeChanged(DiagramId diagramId, IDiagramNode diagramNode, Size2D newSize) { GetDiagramService(diagramId).UpdateDiagramNodeSize(diagramNode, newSize); }
public override void Remove(IDiagramNode diagramNode) { }
public void Update([NotNull] IDiagramNode diagramNode) { SetDiagramShapeProperties(diagramNode); SetDiagramNodeProperties(diagramNode); UpdateHeader(diagramNode); }
private DiagramOperationResult RemoveChildNodes([NotNull] IDiagramNode node, DiagramOperationResult diagramOperationResult) { return(GetChildNodes(node.Id) .Aggregate(diagramOperationResult, (current, childNode) => RemoveNodeCore(childNode.Id, current))); }
private static bool GetHasChildren([NotNull] IDiagramNode diagramNode) { return(diagramNode.ChildrenAreaSize.IsDefined && diagramNode.ChildrenAreaSize != Size2D.Zero); }
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); }
public void NavigateTo(IDiagramNode node) { // TODO 2.0 Rewrite Navigate To }
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; }
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); }
private void OnRemoveDiagramNodeRequested(DiagramId diagramId, IDiagramNode diagramNode) { //GetDiagramService(diagramId).HideModelNode(diagramNode.Id); }
public override void NodeRemoved(IDiagramNode nodeData) { base.NodeRemoved(nodeData); }
/// <summary> /// Subtypes with a different header must override this method. /// </summary> protected virtual void UpdateHeader([NotNull] IDiagramNode diagramNode) { HeaderViewModel.Payload = diagramNode.ModelNode.Payload; }
public abstract void Remove(IDiagramNode diagramNode);
public DiagramNodeAddedEvent([NotNull] IDiagram newDiagram, [NotNull] IDiagramNode newNode) : base(newDiagram) { NewNode = newNode; }
public virtual void Rename(IDiagramNode data, string name) { Name = name; }