EdgePicker(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator,
            int nodeCountOnLevel) {
     this.lgData = lgData;
     this.nodeZoomLevelCalculator = nodeZoomLevelCalculator;
     this._nodeCountOnLevel = nodeCountOnLevel;
     zoomLevel = (int) nodeZoomLevelCalculator.SortedLgNodeInfos[nodeCountOnLevel - 1].ZoomLevel;
 }
Exemple #2
0
 static void AssignEdgesToLevels(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator)
 {
     foreach (int nodeCountOnLevel in nodeZoomLevelCalculator.LevelNodeCounts)
     {
         EdgePicker.SetEdgeInfosZoomLevelsAndIcreaseRanks(lgData, nodeZoomLevelCalculator, nodeCountOnLevel);
     }
 }
Exemple #3
0
        static bool AddLevel(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator, int nodeCountOnLevel, LgEdgeInfo[] edgeInfos)
        {
            var zoomLevel        = (int)nodeZoomLevelCalculator.SortedLgNodeInfos[nodeCountOnLevel - 1].ZoomLevel;
            var edgeInfosOfLevel = edgeInfos.TakeWhile(ei => ei.ZoomLevel <= zoomLevel).ToList();

            lgData.AddLevel();
            return(edgeInfosOfLevel.Count() == lgData.GeometryEdgesToLgEdgeInfos.Count);
        }
        internal static void SetEdgeInfosZoomLevelsAndIcreaseRanks(LgData lgData,
                                                                   IZoomLevelCalculator nodeZoomLevelCalculator,
                                                                   int nodeCountOnLevel)
        {
            var edgePicker = new EdgePicker(lgData, nodeZoomLevelCalculator, nodeCountOnLevel);

            edgePicker.Run();
        }
 EdgePicker(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator,
            int nodeCountOnLevel)
 {
     this.lgData = lgData;
     this.nodeZoomLevelCalculator = nodeZoomLevelCalculator;
     this._nodeCountOnLevel       = nodeCountOnLevel;
     zoomLevel = (int)nodeZoomLevelCalculator.SortedLgNodeInfos[nodeCountOnLevel - 1].ZoomLevel;
 }
Exemple #6
0
        public MapZoomInfoCalculator(IZoomLevelCalculator zoomLevelCalculator)
        {
            if (zoomLevelCalculator == null)
            {
                throw new ArgumentNullException(nameof(zoomLevelCalculator));
            }

            this.zoomLevelCalculator = zoomLevelCalculator;
        }
        static void AssignEdges(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator) {
            AssignEdgesToLevels(lgData, nodeZoomLevelCalculator);
            var edgeInfos = SortEdgeInfosByZoomLevel(lgData);

            foreach (int nodeCountOnLevel in nodeZoomLevelCalculator.LevelNodeCounts) {
                bool finished = AddLevel(lgData, nodeZoomLevelCalculator, nodeCountOnLevel, edgeInfos);
                if (finished)
                    break;
            }
        }
Exemple #8
0
        static void AssignEdges(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator)
        {
            AssignEdgesToLevels(lgData, nodeZoomLevelCalculator);
            var edgeInfos = SortEdgeInfosByZoomLevel(lgData);

            foreach (int nodeCountOnLevel in nodeZoomLevelCalculator.LevelNodeCounts)
            {
                bool finished = AddLevel(lgData, nodeZoomLevelCalculator, nodeCountOnLevel, edgeInfos);
                if (finished)
                {
                    break;
                }
            }
        }
Exemple #9
0
        static bool RouteEdgesOnLevel(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator,
                                      LgLayoutSettings lgLayoutSettings, int nodeCountOnLevel, LgEdgeInfo[] edgeInfos, GeometryGraph mainGeomGraph)
        {
            var zoomLevel        = (int)nodeZoomLevelCalculator.SortedLgNodeInfos[nodeCountOnLevel - 1].ZoomLevel;
            var edgeInfosOfLevel = edgeInfos.TakeWhile(ei => ei.ZoomLevel <= zoomLevel).ToList();

            var tmpGraphForRouting = CreateTmpGraphForRouting(lgData, edgeInfosOfLevel, zoomLevel);

            //LayoutAlgorithmSettings.ShowGraph(tmpGraphForRouting);

            var level = lgData.AddLevel(zoomLevel);

            RouteEdges(lgLayoutSettings, tmpGraphForRouting, lgData, level);
            //lgData.ExtractRailsFromRouting(tmpGraphForRouting.Edges, zoomLevel);
            return(edgeInfosOfLevel.Count() == lgData.GeometryEdgesToLgEdgeInfos.Count);
        }
Exemple #10
0
        static void RouteEdgesOnLevels(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator, LgLayoutSettings lgLayoutSettings, GeometryGraph mainGeomGraph)
        {
            AssignEdgesToLevels(lgData, nodeZoomLevelCalculator);

            var edgeInfos = SortEdgeInfosByLevel(lgData);

            foreach (int nodeCountOnLevel in nodeZoomLevelCalculator.LevelNodeCounts)
            {
                bool finished = RouteEdgesOnLevel(lgData, nodeZoomLevelCalculator, lgLayoutSettings, nodeCountOnLevel, edgeInfos,
                                                  mainGeomGraph);
                if (finished)
                {
                    break;
                }
            }
            Console.WriteLine("routing is done");
        }
 static void AssignEdgesToLevels(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator) {
     foreach (int nodeCountOnLevel in nodeZoomLevelCalculator.LevelNodeCounts)
         EdgePicker.SetEdgeInfosZoomLevelsAndIcreaseRanks(lgData, nodeZoomLevelCalculator, nodeCountOnLevel);
 }
 static bool AddLevel(LgData lgData, IZoomLevelCalculator nodeZoomLevelCalculator, int nodeCountOnLevel, LgEdgeInfo[] edgeInfos) {
     var zoomLevel = (int) nodeZoomLevelCalculator.SortedLgNodeInfos[nodeCountOnLevel - 1].ZoomLevel;
     var edgeInfosOfLevel = edgeInfos.TakeWhile(ei => ei.ZoomLevel <= zoomLevel).ToList();
     lgData.AddLevel();
     return edgeInfosOfLevel.Count() == lgData.GeometryEdgesToLgEdgeInfos.Count;
 }
 internal static void SetEdgeInfosZoomLevelsAndIcreaseRanks(LgData lgData,
                                             IZoomLevelCalculator nodeZoomLevelCalculator,
                                             int nodeCountOnLevel) {
     var edgePicker = new EdgePicker(lgData, nodeZoomLevelCalculator, nodeCountOnLevel);
     edgePicker.Run();
 }