Ejemplo n.º 1
0
        public static void SetColorOfMultiReletionNodes(Microsoft.Msagl.Drawing.Graph graph)
        {
            foreach (Edge item in graph.Edges)
            {
                List <Edge> list = new List <Edge>(item.SourceNode.Edges);

                if (maxReletions == list.Count && maxReletions != 2)
                {
                    IGraphItem graphItem = item.SourceNode.UserData as IGraphItem;
                    if (graphItem.IsSelected)
                    {
                        SetDrawDelegateByNode(item.SourceNode, NodeTypes.MultiRelaitionsSelected);
                    }
                    else
                    {
                        SetDrawDelegateByNode(item.SourceNode, NodeTypes.MultiRelaitions);
                    }
                }

                list = new List <Edge>(item.TargetNode.Edges);

                if (maxReletions == list.Count && maxReletions != 2)
                {
                    IGraphItem graphItem = item.TargetNode.UserData as IGraphItem;
                    if (graphItem.IsSelected)
                    {
                        SetDrawDelegateByNode(item.TargetNode, NodeTypes.MultiRelaitionsSelected);
                    }
                    else
                    {
                        SetDrawDelegateByNode(item.TargetNode, NodeTypes.MultiRelaitions);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        internal void AddReferenceItem(GenericReferenceItem[] mirrorItems, IGraphItem item, NodeConfigSectionBase mirrorSection)
        {
            var current = mirrorItems.FirstOrDefault(p => p.SourceIdentifier == item.Identifier);

            if (current != null && !mirrorSection.AllowDuplicates)
            {
                return;
            }

            if (Node.Repository.GetById <IDiagramNodeItem>(item.Identifier) == null)
            {
                var refItem = item as GenericReferenceItem;
                refItem.Node = this;
                Node.Repository.Add(item);
            }
            else
            {
                var newMirror = Activator.CreateInstance(mirrorSection.SourceType) as GenericReferenceItem;
                newMirror.Node             = this;
                newMirror.SourceIdentifier = item.Identifier;
                Node.Repository.Add(newMirror);
            }
            Node.Repository.Commit();
            //Node.Project.AddItem(newMirror);
        }
Ejemplo n.º 3
0
        protected GraphItemViewModel GetDataViewModel(IGraphItem item)
        {
            var vm = InvertGraphEditor.Container.ResolveRelation <ItemViewModel>(item.GetType(), item, this) as GraphItemViewModel;

            vm.DiagramViewModel = DiagramViewModel;

            return(vm);
        }
Ejemplo n.º 4
0
 public override NodeColor GetColor(IGraphItem obj)
 {
     if (NodeColor == null)
     {
         return(uFrame.Editor.Graphs.Data.NodeColor.Gray);
     }
     return(NodeColor.Literal);
 }
Ejemplo n.º 5
0
 public override NodeColor GetColor(IGraphItem obj)
 {
     if (NodeColor == null)
     {
         return(GraphDesigner.NodeColor.Gray);
     }
     return(NodeColor.Literal);
 }
Ejemplo n.º 6
0
        public IGraphPath FindPath(Entities.WebServiceEntity.ReportQueryItemResult queryItem)
        {
            if (_graph == null || _graph.Paths == null)
            {
                return(null);
            }
            //gLocalViewer.Graph.Edges.Clear();
            //gLocalViewer.Graph.NodeMap.Clear();
            foreach (IGraphPath path in _graph.Paths)
            {
                if (path.DirectFlow.Count == queryItem.Paths.Count)
                {
                    bool isFound = true;
                    for (int i = 0; i < path.DirectFlow.Count; i++)
                    {
                        IGraphItem item = path.DirectFlow[i];
                        Entities.WebServiceEntity.ReportQueryItemPathResult pathItem = queryItem.Paths[i];

                        if (item.Name != pathItem.Name || item.Line != pathItem.Line || item.Column != pathItem.Column)
                        {
                            isFound = false;
                            break;
                        }
                    }

                    if (isFound)
                    {
                        return(path);
                    }
                } // Check in cases when path contain 1 element, graph contain 2
                else if (path.DirectFlow.Count == 2 && queryItem.Paths.Count == 1)
                {
                    IGraphItem item1 = path.DirectFlow[0];
                    IGraphItem item2 = path.DirectFlow[1];
                    Entities.WebServiceEntity.ReportQueryItemPathResult pathItem = queryItem.Paths[0];

                    if (item1.CompareTo(item2) == 0 && item1.CompareTo(pathItem) == 0)
                    {
                        return(path);
                    }
                }
                else if (path.DirectFlow.Count == 2 && queryItem.Paths.Count > 2)
                {
                    GraphItem item1 = path.DirectFlow[0];
                    GraphItem item2 = path.DirectFlow[1];

                    Entities.WebServiceEntity.ReportQueryItemPathResult pathItem1 = queryItem.Paths[0];
                    Entities.WebServiceEntity.ReportQueryItemPathResult pathItem2 = queryItem.Paths[queryItem.Paths.Count - 1];
                    if (item1.CompareTo(pathItem1) == 0 && item2.CompareTo(pathItem2) == 0)
                    {
                        return(path);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 7
0
        public Color GetColor(IGraphItem dataObject)
        {
            var item = dataObject as IDiagramNodeItem;

            if (item != null)
            {
                var node = item.Node as GenericNode;
                if (node != null)
                {
                    var color = node.Config.GetColor(node);
                    switch (color)
                    {
                    case NodeColor.Black:
                        return(Color.black);

                    case NodeColor.Blue:
                        return(new Color(0.25f, 0.25f, 0.65f));

                    case NodeColor.DarkDarkGray:
                        return(new Color(0.25f, 0.25f, 0.25f));

                    case NodeColor.DarkGray:
                        return(new Color(0.45f, 0.45f, 0.45f));

                    case NodeColor.Gray:
                        return(new Color(0.65f, 0.65f, 0.65f));

                    case NodeColor.Green:
                        return(new Color(0.00f, 1f, 0f));

                    case NodeColor.LightGray:
                        return(new Color(0.75f, 0.75f, 0.75f));

                    case NodeColor.Orange:
                        return(new Color(0.059f, 0.98f, 0.314f));

                    case NodeColor.Pink:
                        return(new Color(0.059f, 0.965f, 0.608f));

                    case NodeColor.Purple:
                        return(new Color(0.02f, 0.318f, 0.659f));

                    case NodeColor.Red:
                        return(new Color(1f, 0f, 0f));

                    case NodeColor.Yellow:
                        return(new Color(1f, 0.8f, 0f));

                    case NodeColor.YellowGreen:
                        return(new Color(0.604f, 0.804f, 0.196f));
                    }
                }
            }
            return(Color.white);
        }
Ejemplo n.º 8
0
        public int CompareTo(object obj)
        {
            if (obj is IGraphItem)
            {
                IGraphItem compareItem = (IGraphItem)obj;

                if (compareItem.Name == Name &&
                    compareItem.Line == Line &&
                    compareItem.FileName == FileName &&
                    compareItem.Column == Column && string.Compare(((GraphItem)compareItem).ID, ID) == 0)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            }
            else if (obj is ReportQueryItemPathResult)
            {
                ReportQueryItemPathResult compareItem = (ReportQueryItemPathResult)obj;

                if (compareItem.Name == Name &&
                    compareItem.FileName == FileName &&
                    compareItem.Line == Line &&
                    compareItem.Column == Column)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            }
            else if (obj is CxViewerAction.CxVSWebService.CxWSPathNode)
            {
                CxViewerAction.CxVSWebService.CxWSPathNode compareItem = (CxViewerAction.CxVSWebService.CxWSPathNode)obj;

                if (compareItem.Name == Name &&
                    compareItem.FileName == FileName &&
                    compareItem.Line == Line &&
                    compareItem.Column == Column)
                {
                    return(0);
                }
                else
                {
                    return(1);
                }
            }

            return(1);
        }
Ejemplo n.º 9
0
        public Rect?GetBoundingBox(IGraphItem item)
        {
            AbstractElementVisual visual;

            if (!myDrawingElements.TryGetValue(item.Id, out visual) || visual.Visual == null)
            {
                return(null);
            }

            var bounds = visual.Visual.ContentBounds;

            bounds.Scale(64, 64);
            return(bounds);
        }
Ejemplo n.º 10
0
        public void NavigateTo(IGraphItem item)
        {
            var boundingBox = myGraphVisual.GetBoundingBox(item);

            if (boundingBox == null)
            {
                return;
            }

            var rect = boundingBox.Value;

            // lets do some padding
            rect.Inflate(rect.Width, rect.Height);

            ZoomTo(rect.TopLeft, rect.BottomRight, true);
        }
Ejemplo n.º 11
0
        public IGraphData AddItem(IGraphItem item)
        {
            if (_graphItems.TryGetValue(item.Id, out var graphItem))
            {
                return(this);
            }

            switch (item)
            {
            case INode node:
                break;

            case INodePort port:
                break;
            }

            return(this);
        }
Ejemplo n.º 12
0
        internal void AddReferenceItem(GenericReferenceItem[] mirrorItems, IGraphItem item, NodeConfigSectionBase mirrorSection)
        {
            var current = mirrorItems.FirstOrDefault(p => p.SourceIdentifier == item.Identifier);

            if (current != null && !mirrorSection.AllowDuplicates)
            {
                return;
            }

            var newMirror = Activator.CreateInstance(mirrorSection.SourceType) as GenericReferenceItem;

            newMirror.Node = this;
            Node.Repository.Add(newMirror);
            newMirror.SourceIdentifier = item.Identifier;


            //Node.Project.AddItem(newMirror);
        }
Ejemplo n.º 13
0
        void SelectNodeGraph()
        {
            // TODO: select nodes in selected Path
            Node selectedNode = gLocalViewer.SelectedObject as Node;

            if (selectedNode != null)
            {
                if (_prevSelectedNode != null)
                {
                    IGraphItem prevItem = _prevSelectedNode.UserData as GraphItem;
                    if (prevItem != null)
                    {
                        prevItem.IsSelected        = false;
                        _prevSelectedNode.UserData = prevItem;
                    }
                }

                GraphItem item = selectedNode.UserData as GraphItem;

                ColorButton.ColorButton nodeButton = new ColorButton.ColorButton();
                nodeButton.Text   = selectedNode.Id;
                nodeButton.Anchor = AnchorStyles.Top;
                nodeButton.Tag    = item;
                _selectedPath     = null;
                if (item.CurrentPathIndex > 0)
                {
                    DrawingHelper.SelectedPathItemUniqueID = item.QueryItem.Paths[item.CurrentPathIndex - 1].UniqueID;
                }
                DrawingHelper.SelectedNodeUniqueID = item.UniqueID;
                DrawingHelper.isEdgeSelected       = false;
                //ChangeSelectedFile(nodeButton, null);
                if (_pathItemClick != null)
                {
                    _pathItemClick(item.QueryItem.Paths[item.CurrentPathIndex - 1], null);
                }
                gLocalViewer.Refresh();
                gLocalViewer.ResumeLayout();
                gLocalViewer.Update();
                //_prevSelectedNode = selectedNode;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Find item dependences in previous paths
        /// </summary>
        private void AddRelations()
        {
            if (_paths.Count <= 1)
            {
                return;
            }

            IGraphItem related = null;

            foreach (IGraphItem graphItem in _paths[_paths.Count - 1].DirectFlow)
            {
                for (int i = 0; i < _paths.Count - 1; i++)
                {
                    foreach (IGraphItem prevItem in _paths[i].DirectFlow)
                    {
                        if (prevItem.CompareTo(graphItem) == 0)
                        {
                            related = prevItem;

                            while (related.RelatedTo != null)
                            {
                                related = related.RelatedTo;
                            }

                            graphItem.IsPrimary = false;
                            graphItem.RelatedTo = related;
                            related.RelationsFrom.Add((GraphItem)graphItem);

                            if (_maxRelations < related.RelationsFrom.Count)
                            {
                                _maxRelations = related.RelationsFrom.Count;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 15
0
 public string GetEditableFilePath(IGraphItem item, string name = null)
 {
     return((name ?? Data.Name) + ".cs");
 }
Ejemplo n.º 16
0
        public static GraphItemViewModel GetNodeViewModel(this IQFrameworkContainer container, IGraphItem item,
                                                          DiagramViewModel diagram)
        {
            var vm = InvertApplication.Container.ResolveRelation <ViewModel>(item.GetType(), item, diagram) as
                     GraphItemViewModel;

            return(vm);
        }
Ejemplo n.º 17
0
        public static void DrawArrow(GViewer gLocalViewer, GraphItem nodeId1, GraphItem nodeId2, bool isSelected, Microsoft.Msagl.Drawing.Graph graph, IGraphPath path)
        {
            ReportQueryItemPathResult prevItem = null;
            int  index = 1;
            bool isSelectedEdgeDrawn = false;

            foreach (ReportQueryItemPathResult item in nodeId1.QueryItem.Paths)
            {
                Node sourceNode = graph.FindNode(item.UniqueID);
                if (sourceNode == null)
                {
                    sourceNode = new Node(item.UniqueID);
                    if (item.Name.Length > 12)
                    {
                        sourceNode.Label.Text = string.Format("{0}...", item.Name.Substring(0, 6));
                    }
                    else
                    {
                        sourceNode.Label.Text = item.Name;
                    }

                    graph.AddNode(sourceNode);
                }
                GraphItem newItem = new GraphItem();
                newItem.Column           = nodeId1.Column;
                newItem.CurrentPathIndex = item.NodeId;
                newItem.FileName         = nodeId1.FileName;
                newItem.GraphX           = nodeId1.GraphX;
                newItem.GraphY           = nodeId1.GraphY;
                newItem.IsMultiReletions = nodeId1.IsMultiReletions;
                newItem.IsPrimary        = nodeId1.IsPrimary;
                newItem.IsSelected       = nodeId1.IsSelected;
                newItem.Length           = nodeId1.Length;
                newItem.Line             = nodeId1.Line;
                newItem.Name             = nodeId1.Name;
                newItem.Parent           = nodeId1.Parent;
                newItem.QueryItem        = nodeId1.QueryItem;
                newItem.RelatedTo        = nodeId1.RelatedTo;
                newItem.RelationsFrom    = nodeId1.RelationsFrom;
                sourceNode.UserData      = newItem;


                if (isSelected && item.UniqueID == DrawingHelper.SelectedPathItemUniqueID && !isEdgeSelected)
                {
                    newItem.IsSelected = true;
                    SetDrawDelegateByNode(sourceNode, NodeTypes.NormalSelected);
                }
                else
                {
                    newItem.IsSelected = false;
                    SetDrawDelegateByNode(sourceNode, NodeTypes.Normal);
                }

                if (prevItem != null)
                {
                    Edge edge = IsEdgeExisted(sourceNode, prevItem.UniqueID);
                    if (edge == null)
                    {
                        edge = graph.AddEdge(prevItem.UniqueID, item.UniqueID);
                        edge.Attr.ArrowheadAtTarget = ArrowStyle.Normal;
                        edge.Attr.ArrowheadLength   = 10;
                        edge.Attr.LineWidth         = 2;
                        edge.Attr.Weight            = 2;
                        path.QueryItemResult        = nodeId1.QueryItem;
                        edge.UserData = path;
                    }
                    SetMaxReletions(edge);

                    if (isSelected &&
                        ((SelectedNodeUniqueID == nodeId1.UniqueID && !isEdgeSelected) ||
                         (IsContainPath(nodeId1.QueryItem.Paths) && isEdgeSelected) ||
                         (DrawingHelper.SelectedNodeUniqueID == null)
                        ))
                    {
                        edge.Attr.Color     = Microsoft.Msagl.Drawing.Color.Black;
                        edge.Attr.Weight    = 2;
                        edge.Attr.LineWidth = 2;
                        isSelectedEdgeDrawn = true;
                    }
                    else
                    {
                        edge.Attr.Color     = Microsoft.Msagl.Drawing.Color.DarkGray;
                        edge.Attr.Weight    = 2;
                        edge.Attr.LineWidth = 2;
                    }
                }
                prevItem = item;
                index++;
            }

            prevItem = null;
            index    = 1;
            foreach (ReportQueryItemPathResult item in nodeId2.QueryItem.Paths)
            {
                Node sourceNode = graph.FindNode(item.UniqueID);
                if (sourceNode == null)
                {
                    sourceNode = new Node(item.UniqueID);
                    if (item.Name.Length > 12)
                    {
                        sourceNode.Label.Text = string.Format("{0}...", item.Name.Substring(0, 6));
                    }
                    else
                    {
                        sourceNode.Label.Text = item.Name;
                    }
                    graph.AddNode(sourceNode);
                }

                GraphItem newItem = new GraphItem();
                newItem.Column           = nodeId2.Column;
                newItem.CurrentPathIndex = item.NodeId;
                newItem.FileName         = nodeId2.FileName;
                newItem.GraphX           = nodeId2.GraphX;
                newItem.GraphY           = nodeId2.GraphY;
                newItem.IsMultiReletions = nodeId2.IsMultiReletions;
                newItem.IsPrimary        = nodeId2.IsPrimary;
                newItem.IsSelected       = nodeId2.IsSelected;
                newItem.Length           = nodeId2.Length;
                newItem.Line             = nodeId2.Line;
                newItem.Name             = nodeId2.Name;
                newItem.Parent           = nodeId2.Parent;
                newItem.QueryItem        = nodeId2.QueryItem;
                newItem.RelatedTo        = nodeId2.RelatedTo;
                newItem.RelationsFrom    = nodeId2.RelationsFrom;
                sourceNode.UserData      = newItem;

                if (isSelected && item.UniqueID == DrawingHelper.SelectedPathItemUniqueID && !isEdgeSelected)
                {
                    newItem.IsSelected = true;
                    SetDrawDelegateByNode(sourceNode, NodeTypes.NormalSelected);
                }
                else
                {
                    newItem.IsSelected = false;
                    SetDrawDelegateByNode(sourceNode, NodeTypes.Normal);
                }

                if (prevItem != null)
                {
                    Edge edge = IsEdgeExisted(sourceNode, prevItem.UniqueID);
                    if (edge == null)
                    {
                        edge = graph.AddEdge(prevItem.UniqueID, item.UniqueID);
                        edge.Attr.ArrowheadAtTarget = ArrowStyle.Normal;
                        edge.Attr.ArrowheadLength   = 10;
                        path.QueryItemResult        = nodeId2.QueryItem;
                        edge.UserData = path;
                    }
                    SetMaxReletions(edge);

                    if (isSelected &&
                        ((SelectedNodeUniqueID == nodeId2.UniqueID && !isEdgeSelected) ||
                         (IsContainPath(nodeId2.QueryItem.Paths) && isEdgeSelected) ||
                         (DrawingHelper.SelectedNodeUniqueID == null)
                        ))
                    {
                        if (!isSelectedEdgeDrawn || isEdgeSelected)
                        {
                            edge.Attr.Color     = Microsoft.Msagl.Drawing.Color.Black;
                            edge.Attr.Weight    = 2;
                            edge.Attr.LineWidth = 2;
                        }
                    }
                    else
                    {
                        //if (!isSelectedEdgeDrawn || !isEdgeSelected)
                        if (!isSelectedEdgeDrawn)
                        {
                            edge.Attr.Color     = Microsoft.Msagl.Drawing.Color.DarkGray;
                            edge.Attr.Weight    = 2;
                            edge.Attr.LineWidth = 2;
                        }
                    }
                }
                prevItem = item;
                index++;
            }


            bool isTopNodeFound = false;

            if (isSelected &&
                ((IsContainPath(nodeId1.QueryItem.Paths) && isEdgeSelected) ||
                 (DrawingHelper.SelectedNodeUniqueID == null))
                )
            {
                Node       firstNode = graph.FindNode(nodeId1.QueryItem.Paths[0].UniqueID);
                IGraphItem item      = firstNode.UserData as IGraphItem;
                item.IsSelected = true;
                SetDrawDelegateByNode(firstNode, NodeTypes.NormalSelected);

                isTopNodeFound = true;

                SelectedNodeUniqueID = nodeId1.UniqueID;
            }

            if (!isTopNodeFound && isSelected &&
                ((IsContainPath(nodeId2.QueryItem.Paths) && isEdgeSelected) ||
                 (DrawingHelper.SelectedNodeUniqueID == null))
                )
            {
                Node       firstNode = graph.FindNode(nodeId2.QueryItem.Paths[0].UniqueID);
                IGraphItem item      = firstNode.UserData as IGraphItem;
                item.IsSelected = true;
                SetDrawDelegateByNode(firstNode, NodeTypes.NormalSelected);

                SelectedNodeUniqueID = nodeId2.UniqueID;
            }
        }
Ejemplo n.º 18
0
 public void OnIdUpdate(int oldId, int newId, IGraphItem updatedItem)
 {
 }
Ejemplo n.º 19
0
        public Color GetColor(IGraphItem dataObject)
        {
            try
            {
                var item = dataObject as IDiagramNodeItem;
                if (item != null)
                {
                    var node = item.Node as GenericNode;
                    if (node != null)
                    {
                        var color = node.Config.GetColor(node);
                        switch (color)
                        {
                        case NodeColor.Black:
                            return(Color.black);

                        case NodeColor.Blue:
                            return(new Color(0.25f, 0.25f, 0.65f));

                        case NodeColor.DarkDarkGray:
                            return(new Color(0.25f, 0.25f, 0.25f));

                        case NodeColor.DarkGray:
                            return(new Color(0.45f, 0.45f, 0.45f));

                        case NodeColor.Gray:
                            return(new Color(0.65f, 0.65f, 0.65f));

                        case NodeColor.Green:
                            return(new Color(0.00f, 1f, 0f));

                        case NodeColor.LightGray:
                            return(new Color(0.75f, 0.75f, 0.75f));

                        case NodeColor.Orange:
                            return(new Color(0.059f, 0.98f, 0.314f));

                        case NodeColor.Pink:
                            return(new Color(0.059f, 0.965f, 0.608f));

                        case NodeColor.Purple:
                            return(new Color(0.02f, 0.318f, 0.659f));

                        case NodeColor.Red:
                            return(new Color(1f, 0f, 0f));

                        case NodeColor.Yellow:
                            return(new Color(1f, 0.8f, 0f));

                        case NodeColor.YellowGreen:
                            return(new Color(0.604f, 0.804f, 0.196f));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                InvertApplication.LogError(ex.Message);
                InvertApplication.LogError(string.Format("Node is null on get color {0} : {1}", dataObject.Label, dataObject.Identifier));
            }
            return(Color.white);
        }
Ejemplo n.º 20
0
 public void AddReferenceItem(IGraphItem item, NodeConfigSectionBase mirrorSection)
 {
     AddReferenceItem(PersistedItems.Where(p => p.GetType() == mirrorSection.ReferenceType).Cast <GenericReferenceItem>().ToArray(), item, mirrorSection);
 }
Ejemplo n.º 21
0
        //public void AddOutputGenerator(Func<OutputGenerator> action)
        //{
        //    OutputGenerators.Add(action);
        //}

        public abstract NodeColor GetColor(IGraphItem obj);
Ejemplo n.º 22
0
 public static IWidget Widget(this ICanvas context, IGraphItem item)
 {
     return(context.widgetProvider.GetDecorator(item));
 }
 public string GetEditableFilePath(IGraphItem item, string name = null)
 {
     return (name ?? Data.Name) + ".cs";
 }
Ejemplo n.º 24
0
 public static void SetGraphItem(DependencyObject obj, IGraphItem item)
 {
     obj.SetValue(GraphItemProperty, item);
 }
 public static void SetGraphItem( DependencyObject obj, IGraphItem item )
 {
     obj.SetValue( GraphItemProperty, item );
 }
Ejemplo n.º 26
0
 public System.Drawing.Point GetPosition(IGraphItem item)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 27
0
 public static TWidget Widget <TWidget>(this ICanvas context, IGraphItem item) where TWidget : IWidget
 {
     return(context.widgetProvider.GetDecorator <TWidget>(item));
 }
Ejemplo n.º 28
0
        public Color GetColor(IGraphItem dataObject)
        {
            try
            {
                var item = dataObject as IDiagramNodeItem;
                if (item != null)
                {
                    var node = item.Node as GenericNode;
                    if (node != null)
                    {
                        var color = node.Config.GetColor(node);
                        switch (color)
                        {
                            case NodeColor.Black:
                                return Color.black;
                            case NodeColor.Blue:
                                return new Color(0.25f, 0.25f, 0.65f);
                            case NodeColor.DarkDarkGray:
                                return new Color(0.25f, 0.25f, 0.25f);
                            case NodeColor.DarkGray:
                                return new Color(0.45f, 0.45f, 0.45f);
                            case NodeColor.Gray:
                                return new Color(0.65f, 0.65f, 0.65f);
                            case NodeColor.Green:
                                return new Color(0.00f, 1f, 0f);
                            case NodeColor.LightGray:
                                return new Color(0.75f, 0.75f, 0.75f);
                            case NodeColor.Orange:
                                return new Color(0.059f, 0.98f, 0.314f);
                            case NodeColor.Pink:
                                return new Color(0.059f, 0.965f, 0.608f);
                            case NodeColor.Purple:
                                return new Color(0.02f, 0.318f, 0.659f);
                            case NodeColor.Red:
                                return new Color(1f, 0f, 0f);
                            case NodeColor.Yellow:
                                return new Color(1f, 0.8f, 0f);
                            case NodeColor.YellowGreen:
                                return new Color(0.604f, 0.804f, 0.196f);

                        }

                    }
                }
            }
            catch (Exception ex)
            {
                InvertApplication.LogError(string.Format("Node is null on get color {0} : {1}", dataObject.Label, dataObject.Identifier));
            }
            return Color.white;
        }
Ejemplo n.º 29
0
        protected static void ApplyInputConfiguration(GraphItemConfiguration inputConfig, IGraphItem dataItem, ConnectorViewModel connector, bool alwaysVisible = false)
        {
            if (connector != null)
            {
                connector.AlwaysVisible = alwaysVisible;
            }

            //var slot = dataItem as IDiagramNodeItem;
            //if (slot != null)
            //{
            //    connector.Validator = slot.ValidateInput;
            //}
        }
Ejemplo n.º 30
0
        //public void AddOutputGenerator(Func<OutputGenerator> action)
        //{
        //    OutputGenerators.Add(action);
        //}

        public abstract NodeColor GetColor(IGraphItem obj);
        public void NavigateTo( IGraphItem item )
        {
            var boundingBox = myGraphVisual.GetBoundingBox( item );
            if( boundingBox == null )
            {
                return;
            }

            var rect = boundingBox.Value;

            // lets do some padding
            rect.Inflate( rect.Width, rect.Height );

            ZoomTo( rect.TopLeft, rect.BottomRight );
        }