Beispiel #1
0
        public MapService()
        {
            try
            {
                RectangleF fullRect = new RectangleF(-20037510f, -19993420, 40075020f, 39986840f);
                _tileSystemHelper = new TileSystemHelper(fullRect, new Size(256, 256), 20);
                //
                _gen = new MapImageGeneratorDefault();
                try
                {
                    _mintuesOfHostCache = int.Parse(System.Configuration.ConfigurationManager.AppSettings["MintuesOfHostCache"]);
                    _outputImageExtname = System.Configuration.ConfigurationManager.AppSettings["OutputImageFormat"];
                    switch (_outputImageExtname.ToUpper())
                    {
                    case ".JPG":
                        _outputImageFormat = ImageFormat.Jpeg;
                        break;

                    case ".PNG":
                        _outputImageFormat = ImageFormat.Png;
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Log.WriterException(ex);
                }
                _outputdir     = System.Configuration.ConfigurationManager.AppSettings["MapImageOutputDir"];
                _outputUrlBase = System.Configuration.ConfigurationManager.AppSettings["MapImageUrlBaseDir"];
                string mcd = System.Configuration.ConfigurationManager.AppSettings["MapConfigFile"];
                IMap   map = MapFactory.LoadMapFrom(mcd);
                _gen.ApplyMap(map);
            }
            catch (Exception ex)
            {
                Log.WriterException(ex);
            }
        }