예제 #1
0
        public new Map Load(string fileName, IProgressIndicator progress, object userInfo)
        {
            //    LogFactory.WriteLogEntry(Logger.Default, string.Format("Loading CartoCSS project from '{0}' ...", fileName), LogEntryType.Information);

            CartoProject cartoProject = CartoProject.FromFile(File.ReadAllText(fileName), Path.GetExtension(fileName));

            return(CartoProcessor.GetMap(cartoProject, Path.GetDirectoryName(fileName), progress));
        }
예제 #2
0
        protected override Map OnLoad(Stream input, IProgressIndicator progress, object userInfo)
        {
            object[] objArray = (object[])userInfo;
            string   fileName = (string)objArray[0];

//      LogFactory.WriteLogEntry(Logger.Default, string.Format("Loading CartoCSS project from '{0}' ...", fileName), LogEntryType.Information);

            using (StreamReader sr = new StreamReader(input))
            {
                CartoProject cartoProject = CartoProject.FromFile(sr.ReadToEnd(), Path.GetExtension(fileName));
                return(CartoProcessor.GetMap(cartoProject, Path.GetDirectoryName(fileName), progress));
            }
        }
        public void Export(string projectPath, string outPath, Logger logger)
        {
            CartoProject cartoProject = CartoProject.FromFile(File.ReadAllText(projectPath), Path.GetExtension(projectPath));
            Map          map          = CartoProcessor.GetMap(cartoProject, Path.GetDirectoryName(projectPath), new NullProgressIndicator(), logger, 1);

            string dir = Path.GetDirectoryName(outPath);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            if (Path.GetExtension(outPath) != ".msnm")
            {
                outPath = Path.ChangeExtension(outPath, ".msnm");
            }

            map.Save(outPath);
        }