Exemplo n.º 1
0
        //private static bool CheckIsohypseHasAllSamePoints(
        //    IbfIsohypseDefinition isohypseDefinition,
        //    Point2<double>[] isohypsePoints)
        //{
        //    bool allPointsTheSame = true;

        //    for (int i = 1; i < isohypseDefinition.MovementsCount; i++)
        //    {
        //        if (isohypsePoints[0] != isohypsePoints[i])
        //        {
        //            allPointsTheSame = false;
        //            break;
        //        }
        //    }

        //    return allPointsTheSame;
        //}

        private void LoadRulesIfNecessary()
        {
            if (Settings.ContoursRenderingRules == null)
            {
                consoleLogger.WriteLine(log, Level.Info,
                                        "Fetching contours rendering rules from '{0}'...",
                                        Settings.ContoursRenderingRulesSource);

                using (Stream stream = WikiPageStreamProvider.Open(Settings.ContoursRenderingRulesSource))
                {
                    using (ContoursRulesParser parser = new ContoursRulesParser())
                    {
                        Settings.ContoursRenderingRules = parser.Parse(stream);
                    }
                }
            }
        }
        private void FetchRulesFromWikiPage(
            ITaskRunner taskRunner,
            string wikiPageSource,
            string whatIsBeingFetched)
        {
            consoleLogger.WriteLine(log, Level.Info,
                                    "Fetching {1} from '{0}'...",
                                    wikiPageSource,
                                    whatIsBeingFetched);

            using (Stream stream = WikiPageStreamProvider.Open(wikiPageSource))
            {
                using (WikiRulesParser rulesParser = new WikiRulesParser(
                           stream,
                           taskRunner.MapMakerSettings.TypesRegistry,
                           taskRunner.MapMakerSettings.CharactersConversionDictionary,
                           serializersRegistry))
                {
                    rulesParser.Parse();
                }
            }
        }
Exemplo n.º 3
0
        private void LoadRulesIfNecessary()
        {
            if (Settings.RenderingRules == null)
            {
                consoleLogger.WriteLine(log, Level.Info,
                                        "Fetching rendering rules from '{0}'...",
                                        Settings.RenderingRulesSource);

                using (Stream stream = WikiPageStreamProvider.Open(Settings.RenderingRulesSource))
                {
                    using (WikiRulesParser parser = new WikiRulesParser(
                               stream,
                               Settings.TypesRegistry,
                               Settings.CharactersConversionDictionary,
                               serializersRegistry))
                    {
                        parser.Parse();
                        Settings.RenderingRules = parser.Rules;
                    }
                }
            }
        }