public RelationshipRenderer(NavigatorView parentNavigatorView, IRelationshipProxy relationshipProxy) { Relationship = relationshipProxy; ParentNavigatorView = parentNavigatorView; this.Loaded += new RoutedEventHandler(RelationshipRenderer_Loaded); }
public DescriptorProxy(Guid nodeId, SoapDescriptorType descriptorType, IRelationshipProxy relationship, SoapRelationship soapRelationship) { Relationship = relationship; NodeId = nodeId; DescriptorType = DescriptorTypeProxy.GetDescriptorType(descriptorType); }
public RelationshipContextMenu(IRelationshipProxy relationshipProxy, IMapControl map, INodeService service) : base() { RelationshipProxy = relationshipProxy; NodeService = service; Navigator = map.Navigator; this.Loaded += new RoutedEventHandler(NodeContextMenu_Loaded); }
private bool IsRelated(IRelationshipProxy relationship, Guid nodeId, string descriptorType) { bool result = false; foreach (IDescriptorProxy descriptor in relationship.Descriptors.GetByDescriptorTypeName(descriptorType)) { if (descriptor.NodeId == nodeId) { result = true; break; } } return(result); }
private void RenderNodeAsChild(MetadataContext xPosKey, MetadataContext yPosKey, out IDescriptorTypeProxy descriptorType, out double x, out double y) { x = 0.0; y = 0.0; IRelationshipProxy mapRelationship = GetMapRelationship(Node); descriptorType = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>().GetDescriptorType("From"); xPosKey.DescriptorTypeUid = descriptorType.Id; yPosKey.DescriptorTypeUid = descriptorType.Id; if (mapRelationship != null) { xPosKey.RelationshipUid = mapRelationship.Id; yPosKey.RelationshipUid = mapRelationship.Id; } GetNodeLocation(xPosKey, yPosKey, out x, out y); }
private void CompleteRelationship(IRelationshipProxy relationship) { if (relationship != null) { foreach (DescriptorProxy descriptor in relationship.Descriptors) { if (descriptor.Node == null && descriptor.NodeId != Guid.Empty) { if (_cachedNodes.ContainsKey(descriptor.NodeId)) { descriptor.Node = _cachedNodes[descriptor.NodeId]; foreach (DescriptorProxy innerDesc in descriptor.Node.Descriptors) { CompleteRelationship(innerDesc.Relationship); } } } } } }
public ImprovedArrow(NavigatorView parentNavigatorView, IRelationshipProxy relationship) : base() { Relationship = relationship; ParentNavigatorView = parentNavigatorView; this.SetValue(Canvas.ZIndexProperty, -1); DropShadowEffect selectionEffect = new DropShadowEffect(); selectionEffect.BlurRadius = 0; selectionEffect.ShadowDepth = 0; selectionEffect.Color = Colors.Red; selectionEffect.Direction = 0; this.Effect = selectionEffect; _arrowBody = new LineSegment(); _arrowFigure = new PathFigure(); _arrowFigure.Segments.Add(_arrowBody); _arrow = new PathGeometry(); _arrow.Figures.Add(_arrowFigure); _arrowPath = new Path(); _arrowPath.Stroke = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)); _arrowPath.StrokeEndLineCap = PenLineCap.Triangle; _arrowPath.StrokeThickness = 1.25; _arrowPath.Data = _arrow; _arrowHead = new Line(); _arrowHead.StrokeEndLineCap = PenLineCap.Triangle; _arrowHead.StrokeThickness = 8; _arrowHead.Stroke = new SolidColorBrush(Colors.Black); this.Children.Add(_arrowHead); this.Children.Add(_arrowPath); _toSelectionRect = new Rectangle(); _toSelectionRect.Width = 6; _toSelectionRect.Height = 6; _toSelectionRect.Stroke = new SolidColorBrush(Colors.Black); _toSelectionRect.StrokeThickness = 1; _toSelectionRect.Visibility = Visibility.Collapsed; _toSelectionRect.Fill = new SolidColorBrush(Colors.White); _toSelectionRect.Opacity = 0.7; _toSelectionRect.MouseLeftButtonDown += new MouseButtonEventHandler(_toSelectionRect_MouseLeftButtonDown); _toSelectionRect.MouseLeftButtonUp += new MouseButtonEventHandler(_toSelectionRect_MouseLeftButtonUp); _fromSelectionRect = new Rectangle(); _fromSelectionRect.Width = 6; _fromSelectionRect.Height = 6; _fromSelectionRect.Stroke = new SolidColorBrush(Colors.Black); _fromSelectionRect.StrokeThickness = 1; _fromSelectionRect.Visibility = Visibility.Collapsed; _fromSelectionRect.Fill = new SolidColorBrush(Colors.White); _fromSelectionRect.Opacity = 0.7; _fromSelectionRect.MouseLeftButtonDown += new MouseButtonEventHandler(_fromSelectionRect_MouseLeftButtonDown); _fromSelectionRect.MouseLeftButtonUp += new MouseButtonEventHandler(_fromSelectionRect_MouseLeftButtonUp); this.Children.Add(_toSelectionRect); this.Children.Add(_fromSelectionRect); this.Loaded += new RoutedEventHandler(OnLoaded); }
private bool IsChildRelationship(IRelationshipProxy relationship, Guid parentNodeId) { return IsRelated(relationship, parentNodeId, "To"); }
private bool IsParentRelationship(IRelationshipProxy relationship, Guid childNodeId) { return(IsRelated(relationship, childNodeId, "From")); }
private void cloneMenuItem_Click(object sender, RoutedEventArgs e) { if (MapControl.SelectedNodes != null && MapControl.SelectedNodes.Length <= 1) { Point cloneLocation = new Point(Location.X + 50, Location.Y + 50); Navigator.PasteNodeClone(NodeProxy.Id, cloneLocation); } else { //multi node cloning if (MapControl.SelectedNodes != null) { foreach (INodeProxy nodeProxy in MapControl.SelectedNodes) { double x = 0.0; double y = 0.0; MetadataContext xPosKey = new MetadataContext() { MetadataName = "XPosition", NodeUid = nodeProxy.Id }; MetadataContext yPosKey = new MetadataContext() { MetadataName = "YPosition", NodeUid = nodeProxy.Id }; IDescriptorTypeProxy descriptorType; //The is being drawn as a transclusion representation (i.e. not in it's original parent map) if (nodeProxy.ParentMapNodeUid != Guid.Empty && nodeProxy.ParentMapNodeUid != Navigator.FocalNodeId) { descriptorType = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>().GetDescriptorType("TransclusionMap"); xPosKey.DescriptorTypeUid = descriptorType.Id; yPosKey.DescriptorTypeUid = descriptorType.Id; foreach (IRelationshipProxy relationship in GetTransclusionRelationship(nodeProxy)) { xPosKey.RelationshipUid = relationship.Id; yPosKey.RelationshipUid = relationship.Id; if (nodeProxy.Metadata != null && nodeProxy.HasMetadata(xPosKey) && nodeProxy.HasMetadata(yPosKey)) { double.TryParse(nodeProxy.GetNodeMetadata(xPosKey).MetadataValue, out x); double.TryParse(nodeProxy.GetNodeMetadata(yPosKey).MetadataValue, out y); break; } } } //The node is being drawn in it's parent map (i.e. not a transclusion representation) else { IRelationshipProxy mapRelationship = GetMapRelationship(nodeProxy); descriptorType = IoC.IoCContainer.GetInjectionInstance().GetInstance <TypeManager>().GetDescriptorType("From"); xPosKey.DescriptorTypeUid = descriptorType.Id; yPosKey.DescriptorTypeUid = descriptorType.Id; if (mapRelationship != null) { xPosKey.RelationshipUid = mapRelationship.Id; yPosKey.RelationshipUid = mapRelationship.Id; } if (nodeProxy.Metadata != null && nodeProxy.HasMetadata(xPosKey) && nodeProxy.HasMetadata(yPosKey)) { double.TryParse(nodeProxy.GetNodeMetadata(xPosKey).MetadataValue, out x); double.TryParse(nodeProxy.GetNodeMetadata(yPosKey).MetadataValue, out y); } } Point cloneLocation = new Point(x + 50, y + 50); Navigator.PasteNodeClone(nodeProxy.Id, cloneLocation); } } } }
private void CompendiumMapDepthMap_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { _isLeftMouseButtonDown = false; INodeRenderer nr = ViewManager.GetNodeRenderer(_currentMousePosition); NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance <NodeRelationshipHelper>(); if (nrh != null) { if (nrh.IsEditting) { if (nr != null) { IRelationshipProxy originalRelationship = nrh.Relationship.DataContext as IRelationshipProxy; _nodeService.DeleteRelationship(Navigator.DomainId, originalRelationship.Id); IDescriptorTypeProxy toDescriptorTypeProxy = _typeManager.GetDescriptorType("To"); IDescriptorTypeProxy fromDescriptorTypeProxy = _typeManager.GetDescriptorType("From"); IDescriptorTypeProxy transMapDescriptorTypeProxy = _typeManager.GetDescriptorType("TransclusionMap"); Dictionary <IDescriptorTypeProxy, Guid> nodes = new Dictionary <IDescriptorTypeProxy, Guid>(); INodeProxy fromNode = null, toNode = null; switch (nrh.EdittingSide) { case RelationshipSide.From: fromNode = nr.Node; toNode = originalRelationship.Descriptors.GetByDescriptorTypeName("To").First().Node; break; case RelationshipSide.To: fromNode = originalRelationship.Descriptors.GetByDescriptorTypeName("From").First().Node; toNode = nr.Node; break; default: break; } nodes.Add(toDescriptorTypeProxy, toNode.Id); nodes.Add(fromDescriptorTypeProxy, fromNode.Id); IRelationshipTypeProxy relationshipTypeProxy = null; if (fromNode.ParentMapNodeUid != this.Navigator.FocalNodeId || toNode.ParentMapNodeUid != this.Navigator.FocalNodeId) { nodes.Add(transMapDescriptorTypeProxy, this.Navigator.FocalNodeId); relationshipTypeProxy = _typeManager.GetRelationshipType("TransclusionRelationship"); } else { relationshipTypeProxy = _typeManager.GetRelationshipType("FromToRelationship"); } _navigator.ConnectNodesAsync(nodes, relationshipTypeProxy, originalRelationship.Id.ToString()); _navigator.GetCurrentNodesAsync(); } else { nrh.Relationship.UpdateArrow(); } } nrh.IsEditting = false; } if (_selectionRectangle != null) { this.uxMapSurface.Children.Remove(_selectionRectangle); double topLeftX = (double)_selectionRectangle.GetValue(Canvas.LeftProperty); double topLeftY = (double)_selectionRectangle.GetValue(Canvas.TopProperty); double bottomRightX = _selectionRectangle.Width + topLeftX; double bottomRightY = _selectionRectangle.Height + topLeftY; _selectionRectangle = null; if (!(Double.IsNaN(bottomRightX) && Double.IsNaN(bottomRightY))) { ViewManager.SelectAllWithinBounds(new Point(topLeftX, topLeftY), new Point(bottomRightX, bottomRightY)); } else { ViewManager.UnselectAllNodes(); ViewManager.UnselectAllRelationships(); } } }
private bool IsChildRelationship(IRelationshipProxy relationship, Guid parentNodeId) { return(IsRelated(relationship, parentNodeId, "To")); }
public virtual void DeleteRelationships(IRelationshipProxy[] relationshipsToDelete) { foreach (IRelationshipProxy relationship in relationshipsToDelete) { NodeService.DeleteRelationship(DomainId, relationship.Id); } }
private bool IsRelated(IRelationshipProxy relationship, Guid nodeId, string descriptorType) { bool result = false; foreach (IDescriptorProxy descriptor in relationship.Descriptors.GetByDescriptorTypeName(descriptorType)) { if (descriptor.NodeId == nodeId) { result = true; break; } } return result; }
private bool IsParentRelationship(IRelationshipProxy relationship, Guid childNodeId) { return IsRelated(relationship, childNodeId, "From"); }
public NodesEventArgs(string eventType, IRelationshipProxy contextRelationship) { EventType = eventType; ContextRelationship = contextRelationship; }