public void Merge(NodeLayers layers)
 {
     for (int i = 0; i < LayerCount(); ++i)
     {
         Layer(i).Merge(layers.Layer(i));
     }
 }
Beispiel #2
0
        public static void MainAlgorithm(List <List <Node> > data)
        {
            NodeLayers layers = new NodeLayers(data);
            // var layerss = new List<NodeLayers>();
            // layerss.Add(layers);
            List <NodeLayers> modsSplit = null;

            if (Settings.placeModTechSeparately)
            {
                modsSplit = layers.SplitLargeMods();
            }
            else
            {
                modsSplit = new List <NodeLayers>();
                modsSplit.Add(layers);
            }

            var allLayers = modsSplit
                            .OrderBy(l => l.NodeCount())
                            .SelectMany(
                ls => ls
                .SplitConnectiveComponents()
                .OrderBy(l => l.NodeCount()))
                            .ToList();

            allLayers.ForEach(l => OrgainzeLayers(l));
            PositionAllLayers(allLayers);
        }
 public NodeLayer(int layer, List <Node> nodes, NodeLayers layers)
 {
     _layer  = layer;
     _layers = layers;
     _nodes  = nodes;
     foreach (var n in _nodes)
     {
         n.layer = this;
         n.lx    = layer;
     }
     AdjustY();
 }
Beispiel #4
0
        private static void FitLayersInBounds(NodeLayers layers, float[] topBounds)
        {
            float dy = -99999;

            for (int i = 0; i < layers.LayerCount(); ++i)
            {
                dy = Math.Max(dy, topBounds[i] - layers.TopPosition(i));
            }
            layers.MoveVertically(dy);
            for (int i = 0; i < layers.LayerCount(); ++i)
            {
                topBounds[i] = Math.Max(topBounds[i], layers.BottomPosition(i) + 1);
            }
        }
Beispiel #5
0
 public static void OrgainzeLayers(NodeLayers layers)
 {
     layers.MinimizeCrossings();
     layers.ApplyGridCoordinates();
     layers.ImproveNodePositionsInLayers();
 }