Ejemplo n.º 1
0
        public DCluster AddCluster(DCluster parent, string id)
        {
            if (parent == null)
            {
                Graph.LayoutAlgorithmSettings = new FastIncrementalLayoutSettings();
                Graph.LayoutAlgorithmSettings.EdgeRoutingSettings.KeepOriginalSpline = true;
                var settings = Graph.LayoutAlgorithmSettings as FastIncrementalLayoutSettings;
                settings.AvoidOverlaps = true;
                settings.NodeSeparation = 30;
                settings.RouteEdges = true;
            }

            Subgraph cluster = new Subgraph(id == null ? GetNewNodeID() : id);
            Cluster geometryCluster = new Cluster() { GeometryParent = parent == null ? Graph.GeometryGraph : (GeometryObject)parent.GeometryNode };
            cluster.GeometryNode = geometryCluster;
            geometryCluster.UserData = cluster;

            DCluster ret = new DCluster((DObject)parent ?? this, cluster);
            cluster.LabelText = null;
            SetNodeBoundaryCurve(Graph, cluster);

            if (parent == null)
                m_RootCluster = ret;
            else
                parent.AddCluster(ret);

            if (UpdateGraphBoundingBoxPreservingCenter())
                Invalidate();

            AddCluster(ret, false);

            return ret;
        }
Ejemplo n.º 2
0
 private void PopulateDClusterFromDrawing(DCluster dc, Subgraph drawingc)
 {
     foreach (var drawingn in drawingc.Nodes)
         dc.AddNode(NodeMap[drawingn.Id]);
     foreach (var drawingc2 in drawingc.Subgraphs)
     {
         DCluster dc2 = new DCluster(dc, drawingc2);
         dc.AddCluster(dc2);
         NodeMap[drawingc2.Id] = dc2;
         PopulateDClusterFromDrawing(dc2, drawingc2);
     }
 }