예제 #1
0
 void ApiTestForChangingZoomLevels(XNode nodeToShow)
 {
     var assignedZoomLevel = 0;
     var settingsl = (LgLayoutSettings) Graph.LayoutAlgorithmSettings;
     var lgNodeInfo = nodeToShow.LgNodeInfo;
     lgNodeInfo.ZoomLevel = assignedZoomLevel;
     foreach (var edge in lgNodeInfo.GeometryNode.Edges) {
         var lgEdgeInfo = settingsl.GeometryEdgesToLgEdgeInfos[edge];
         lgEdgeInfo.ZoomLevel = assignedZoomLevel;
     }
     ViewChangeEvent(null, null);
 }
예제 #2
0
        XNode CreateNode(DrawingNode node)
        {
            if (drawingObjectsToIViewerObjects.ContainsKey(node)) {
                return null;
            }
            XNode xNode;
            if (vObjectsMapping.ContainsKey(node)) {
                xNode = (XNode) vObjectsMapping[node];
            } else {
                xNode = new XNode(node);
            }
            drawingObjectsToIViewerObjects[node] = xNode;

            Path p = xNode.BoundaryPath;

            int insertPosition = 0;
            foreach (UIElement uie in graphCanvas.Children) {
                Path uipath = uie as Path;
                if (uipath != null && (uipath.Tag is XNode)) {
                    XNode xn = (XNode) uipath.Tag;
                    if (IsAncesterAndDecendant(node, xn.Node)) {
                        break;
                    }
                } else {
                    break;
                }
                insertPosition++;
            }
            graphCanvas.Children.Insert(insertPosition, p);

            FrameworkElement _visuals = xNode.VisualObject;
            if (_visuals != null && _visuals.Parent == null) {
                graphCanvas.Children.Add(_visuals);
                graphObjectsToFrameworkElements[node] = _visuals;
                _visuals.MouseLeftButtonDown += (a, b) =>
                {
                    ApiTestForChangingZoomLevels(xNode);
                };
            }

            xNode.LgNodeInfo = GetCorrespondingLgNode(xNode.Node);
            xNode.Node.GeometryNode.LayoutChangeEvent += xNode.GeometryNodeBeforeLayoutChangeEvent;

            return xNode;
        }
예제 #3
0
        static void ProcessNodes(Dictionary<DrawingObject, IViewerObjectX> vObjectsMapping, Graph g, Dictionary<string, Subgraph> subgraphTable, Microsoft.Msagl.Drawing.Graph drawingGraph)
        {
            foreach (GraphNode gn in g.Nodes) {
                Node drawingNode;
                if (subgraphTable.ContainsKey(gn.Id.LiteralValue)) {
                    var subgraph = new Subgraph(gn.Id.LiteralValue);
                    subgraphTable[subgraph.Id] = subgraph;

                    drawingNode = subgraph;
                } else
                    drawingNode = drawingGraph.AddNode(gn.Id.LiteralValue);

                drawingNode.Label=new Label(gn.Label);

                string category = null;
                if (gn.Categories.Any())
                    category = gn.Categories.ElementAt(0).ToString().Replace("CodeSchema_", "");

                XNode vNode = new XNode(drawingNode, gn);
                vObjectsMapping[drawingNode] = vNode;
            }
        }