Esempio n. 1
0
        /// <summary>
        /// Creates an instance of this class using the provided layer
        /// </summary>
        /// <param name="layerName">The name of the layer</param>
        /// <param name="fileName">The path to the file</param>
        public ImageGDILayer(string layerName, string fileName, config incfg)
            :this(layerName, Image.FromFile(fileName), incfg)
        {
            ImageFilename = fileName;

            SetEnvelope(fileName);
            _envelope = new Envelope(cfg.minX,cfg.maxX,cfg.minY,cfg.maxY); 
        }
Esempio n. 2
0
        //从内存加载图片
        public void addGDIlayer(string layername, IImageDataProvider datapro, config cfg)
        {
            //delete existing same layer
            ILayer layer = this.mapBox.Map.GetLayerByName(layername);

            if (layer != null)
            {
                if (mp != null)
                {
                    mp.Dispose();
                    mp = null;
                }

                if (img != null)
                {
                    img.Dispose();
                    img = null;
                }

                if (p != null)
                {
                    DeleteObject(p);
                }

                this.mapBox.Map.Layers.Remove(layer);
                ((Layer)layer).Dispose();

                GC.Collect();
            }
            //get data from data provider

            if (datapro == null)
            {
                DefaultData dd = new DefaultData();

                mp = dd.GetData();
            }
            else
            {
                mp = datapro.GetData();
            }

            p   = mp.GetHbitmap();
            img = Image.FromHbitmap(p);

            ImageGDILayer gdilayer = new ImageGDILayer(layername, img, cfg);

            this.mapBox.Map.Layers.Insert(0, gdilayer);
            this.mapBox.Map.ZoomToBox(gdilayer.Envelope);
            this.mapBox.Refresh();

            //System.Diagnostics.Process.GetCurrentProcess().MinWorkingSet = new System.IntPtr(5);
        }
Esempio n. 3
0
        //获取shp投影方式
        public ICoordinateTransformation getmapTransform(config.ProjPara proj)
        {
            CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();
            CoordinateSystemFactory cFac = new CoordinateSystemFactory();
            ICoordinateTransformation transform = null;

            //等经纬,shp数据原始投影
            var epsg4326 = cFac.CreateFromWkt("GEOGCS[\"GCS_WGS_1984\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_84\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]");
            //目标坐标系
            var epsg3857 = cFac.CreateFromWkt(getSrcCoordinate(proj));
            transform = ctFac.CreateFromCoordinateSystems(epsg4326, epsg3857);

            return transform;
        }
Esempio n. 4
0
        public short[] getpoints(config cfg)
        {
            //得到选取的所有点大地坐标
            List <PointF> pts = mapControl1.getPoints();

            //选取的点与数据进行筛选
            short[]         selectData;
            SelectImageData imgdata = new SelectImageData();


            selectData = imgdata.getSelectData(pts, cfg.width * cfg.height, cfg, mapControl1.getPixelsize());

            return(selectData);
        }
Esempio n. 5
0
        /// <summary>
        /// Creates an instance of this class using the provided <paramref name="layerName"/> and <paramref name="image"/>.
        /// </summary>
        /// <param name="layerName">The layer name</param>
        /// <param name="image"></param>
        public ImageGDILayer(string layerName, Image image, config incfg)
        {
            InterpolationMode = InterpolationMode.HighQualityBicubic;

            LayerName = layerName;
            _image = image;

            SetEnvelope();
            cfg = incfg;
            //for test purposes
            //cfg.minX = 152203.122f;
            //cfg.maxX = 3158014f;
            //cfg.minY = 3086534.736f;
            //cfg.maxY = 6023337.07f;
            _envelope = new Envelope(cfg.minX, cfg.maxX, cfg.minY, cfg.maxY); 
        }
Esempio n. 6
0
 public double[] getEagleEnvelope(config cfg)
 {
     double[] result = mapControl1.getZoomEnvelope(cfg);
     return(result);
 }
Esempio n. 7
0
 /// <summary>
 /// Creates an instance of this class using the provided layer
 /// </summary>
 /// <param name="fileName">The path to the file</param>
 public ImageGDILayer(string fileName,config incfg)
     : this(Path.GetFileName(fileName), fileName,incfg)
 {
     
 }
Esempio n. 8
0
        public short[] getpoints(config cfg )
        {
            //得到选取的所有点大地坐标
            List<PointF> pts = mapControl1.getPoints();

            //选取的点与数据进行筛选
            short[] selectData;
            SelectImageData imgdata = new SelectImageData();

            selectData = imgdata.getSelectData(pts, cfg.width * cfg.height, cfg,mapControl1.getPixelsize());

            return selectData;
        }
Esempio n. 9
0
 public void setCfg(config incfg)
 {
     cfg = incfg;
     pjPara = incfg.pjPara;
 }
Esempio n. 10
0
 public void setcfg(config cfg)
 {
     mapControl1.setCfg(cfg);
 }
Esempio n. 11
0
        //从内存加载图片
        public void addGDIlayer(string layername, IImageDataProvider datapro, config cfg)
        {
            //delete existing same layer
            ILayer layer = this.mapBox.Map.GetLayerByName(layername);

            if (layer != null)
            {

                if (mp != null)
                {
                    mp.Dispose();
                    mp = null;
                }

                if (img != null)
                {
                    img.Dispose();
                    img = null;
                }

                if (p != null)
                {
                    DeleteObject(p);
                }

                this.mapBox.Map.Layers.Remove(layer);
                ((Layer)layer).Dispose();

                GC.Collect();
            }
            //get data from data provider

            if (datapro == null)
            {
                DefaultData dd = new DefaultData();

                mp = dd.GetData();
            }
            else
            {
                mp = datapro.GetData();
            }

            p = mp.GetHbitmap();
            img = Image.FromHbitmap(p);

            ImageGDILayer gdilayer = new ImageGDILayer(layername, img, cfg);
            this.mapBox.Map.Layers.Insert(0, gdilayer);
            this.mapBox.Map.ZoomToBox(gdilayer.Envelope);
            this.mapBox.Refresh();

            //System.Diagnostics.Process.GetCurrentProcess().MinWorkingSet = new System.IntPtr(5);
        }
Esempio n. 12
0
        public double[] getZoomEnvelope(config cfg)
        {
            double[] scale = new double[4];

            Envelope tmpEv = this.mapBox.Map.Envelope;

            double x_start = (tmpEv.MinX - cfg.minX) / (cfg.maxX - cfg.minX);
            double x_end = (tmpEv.MaxX - cfg.minX) / (cfg.maxX - cfg.minX);
            double y_start = (tmpEv.MinY - cfg.minY) / (cfg.maxY - cfg.minY);
            double y_end = (tmpEv.MaxY - cfg.minY) / (cfg.maxY - cfg.minY);

            scale[0] = x_start;
            scale[1] = x_end;
            scale[2] = y_start;
            scale[3] = y_end;

            for (int i = 0; i < scale.Count(); i++)
            {
                if (scale[i] < 0) scale[i] = 0;
                if (scale[i] > 1) scale[i] = 1;
            }
            return scale;
        }
Esempio n. 13
0
 public double[] getEagleEnvelope(config cfg)
 {
     double[] result = mapControl1.getZoomEnvelope(cfg);
     return result;
 }
Esempio n. 14
0
 //从路径加载图片
 public void addGDIlayer(string layername, string filepath, config cfg)
 {
     ImageGDILayer gdilayer = new ImageGDILayer(layername, filepath, cfg);
     this.mapBox.Map.Layers.Insert(0, gdilayer);
     this.mapBox.Map.ZoomToBox(gdilayer.Envelope);
     this.mapBox.Refresh();
 }
Esempio n. 15
0
 public void getCFG(config inCFG)
 {
     imgCon = inCFG;
     //imgCon.fullPath = "";
 }
Esempio n. 16
0
 public void setcfg(config cfg)
 {
     mapControl1.setCfg(cfg);
 }
Esempio n. 17
0
 //test gdi layer
 public void addgdilayer(string layername, string filepath,config incfg)
 {
     //config cfg = getCoordinate(incfg);
     Envelope en = new Envelope(incfg.minX, incfg.maxX, incfg.minY, incfg.maxY);
     mapControl1.addGDIlayer(layername,filepath,incfg);
 }
Esempio n. 18
0
 public void setCfg(config incfg)
 {
     cfg    = incfg;
     pjPara = incfg.pjPara;
 }
Esempio n. 19
0
 public void addgdilayer(string layername, IImageDataProvider datapro, config incfg)
 {
     //config cfg = getCoordinate(incfg);
     Envelope en = new Envelope(incfg.minX, incfg.maxX, incfg.minY, incfg.maxY);
     mapControl1.addGDIlayer(layername, datapro, incfg);
 }
Esempio n. 20
0
 public void getCFG(config inCFG)
 {
     imgCon = inCFG;
     //imgCon.fullPath = "";
 }
Esempio n. 21
0
        public config getCoordinate(config cfg)
        {
            Projection pj = new Projection();
            PointF p1 = new PointF();
            PointF p2 = new PointF();
            PointF p1_proj = new PointF();
            PointF p2_proj = new PointF();

            p1.X = cfg.upperLeftLon; p1.Y = cfg.upperLeftLat;
            p1_proj = pj.GetXYFromLatLon(p1,cfg.pjPara);

            p2.X = cfg.lowerRightLon; p2.Y = cfg.lowerRightLat;
            p2_proj = pj.GetXYFromLatLon(p2, cfg.pjPara);

            //cfg.maxX = p2_proj.X;
            //cfg.minX = p1_proj.X;
            //cfg.maxY = p1_proj.Y;
            //cfg.minY = p2_proj.Y;

            cfg.minX = p1_proj.X;
            cfg.maxX = cfg.minX + cfg.resolution * cfg.width;
            cfg.minY = p2_proj.Y;
            cfg.maxY = cfg.minY + cfg.resolution * cfg.height;

            return cfg;
        }