Exemplo n.º 1
0
        private void MapControl_MouseWheel(object sender, MouseEventArgs e)
        {
            if (e.Delta > 0 && _scale >= 1 / 0.01)
            {
                return;
            }
            timerDelayRefresh.Stop();
            _mapDrawEngine.ClearDrawAndShow();
            MapPoint mapPoint = ToMapPoint(e.Location);

            if (e.Delta > 0)//放大
            {
                double left   = (_extent.left + mapPoint.x) * 1 / 2;
                double top    = (_extent.top + mapPoint.y) * 1 / 2;
                double bottom = (mapPoint.y + _extent.bottom) * 1 / 2;
                double right  = (mapPoint.x + _extent.right) * 1 / 2;
                _extent = new MapExtent(left, top, right, bottom);
            }
            else if (e.Delta < 0)//缩小
            {
                double left   = 2 * _extent.left - mapPoint.x;
                double top    = 2 * _extent.top - mapPoint.y;
                double bottom = 2 * _extent.bottom - mapPoint.y;
                double right  = 2 * _extent.right - mapPoint.x;
                _extent = new MapExtent(left, top, right, bottom);
            }
            UpdateScale();
            timerDelayRefresh.Start();
        }
Exemplo n.º 2
0
        public static PointF ToScreenPoint(MapPoint mapPoint, MapExtent extent, int width, int height)
        {
            float fl = (float)((mapPoint.x - extent.left) / extent.Width * width);
            float ft = (float)((extent.top - mapPoint.y) / extent.Height * height);

            return(new PointF(fl, ft));
        }
Exemplo n.º 3
0
 public void RefreshInfo()
 {
     if (_datatable != null)
     {
         _extent = _datatable.GetDataExtent();
     }
 }
Exemplo n.º 4
0
 public DrawLayerTask(Workspace.Workspace workspace, Layer layer, MapExtent extent, int width, int height)
 {
     this.workspace = workspace;
     this.layer     = layer;
     this.width     = width;
     this.height    = height;
     this.extent    = extent;
 }
Exemplo n.º 5
0
 void MainMap_MapExtentChanged(I_GS_MapBase.Portal.Types.MapExtentEventArgs pArgs)
 {
     if (doit)
     {
         MapExtent extent = Utils.MapFun.MainMap.MapExtentFactory.Create(Utils.MapFun.MainMap.MapPointFactory.Create(pArgs.NewExtent.Xy1.X - 0.005, pArgs.NewExtent.Xy1.Y + 0.0027),
                                                                         Utils.MapFun.MainMap.MapPointFactory.Create(pArgs.NewExtent.Xy2.X, pArgs.NewExtent.Xy2.Y));
         LoadJH(extent);
     }
 }
Exemplo n.º 6
0
        public MapServerInfo(JObject pJson)
        {
            MapName = pJson["mapName"].Value <string>();
            JArray            layers     = pJson["layers"].Value <JArray>();
            List <ILayerInfo> layersList = (from JObject layer in layers select new LayerInfo(layer)).Cast <ILayerInfo>().ToList();

            Layers = layersList;
            JToken reference = pJson["spatialReference"].Value <JObject>()["wkid"];

            if (reference == null)
            {
                reference = pJson["spatialReference"].Value <JObject>()["wkt"];
            }
            SpatialReference = reference.Value <string>();
            if (string.IsNullOrWhiteSpace(SpatialReference))
            {
                throw new Exception("地图服务配置错误,缺少“空间参考”数据。");
            }
            SingleFusedMapCache = pJson["singleFusedMapCache"].Value <bool>();
            string units = pJson["units"].Value <string>();

            switch (units.ToLower())
            {
            case "esrimeters":
                Units = MapUnits.Meters;
                break;

            case "esridecimaldegrees":
                Units = MapUnits.Degrees;
                break;
            }
            if (SingleFusedMapCache)
            {
                TileInfo = new MapTileInfo(pJson["tileInfo"].Value <JObject>());
            }
            JObject initialExtent = pJson["initialExtent"].Value <JObject>();

            InitialExtent = new MapExtent(
                new MapPointEx(initialExtent["xmin"].Value <double>(), initialExtent["ymax"].Value <double>()),
                new MapPointEx(initialExtent["xmax"].Value <double>(), initialExtent["ymin"].Value <double>()));
            JObject fullExtent = pJson["fullExtent"].Value <JObject>();

            FullExtent = new MapExtent(
                new MapPointEx(fullExtent["xmin"].Value <double>(), fullExtent["ymax"].Value <double>()),
                new MapPointEx(fullExtent["xmax"].Value <double>(), fullExtent["ymin"].Value <double>()));
        }
Exemplo n.º 7
0
        private void SetExtent(MapExtent extent)
        {
            double dd1 = extent.Width / extent.Height;
            double dd2 = this.Width / (double)this.Height;

            if (dd1 <= dd2)
            {
                double    ew = extent.Height / this.Height * this.Width;
                MapExtent ex = new MapExtent(0, extent.top, 0, extent.bottom);
                ex.left  = extent.left - (ew / 2 - extent.Width / 2);
                ex.right = extent.right + (ew / 2 - extent.Width / 2);
                _extent  = ex;
            }
            else
            {
                double    eh = extent.Width / this.Width * this.Height;
                MapExtent ex = new MapExtent(extent.left, 0, extent.right, 0);
                ex.top    = extent.top - (eh / 2 - extent.Height / 2);
                ex.bottom = extent.bottom + (eh / 2 - extent.Height / 2);
                _extent   = ex;
            }
            UpdateScale();
        }
Exemplo n.º 8
0
        private void LoadJH(MapExtent extent)
        {
            Utils.MapFun.haveStationLayer.ClearSymbolElements();


            if (_fixedPoint.X == 0)
            {
                _fixedPoint.X = extent.Xy1.X;
                _fixedPoint.Y = extent.Xy1.Y;
            }
            List <double[]> list = getJHParam(new double[] { extent.Xy1.X, extent.Xy1.Y }, new double[] { extent.Xy2.X, extent.Xy2.Y }, 50, new double[] { _fixedPoint.X, _fixedPoint.Y });

            JHCondition jhCon = new JHCondition()
            {
                Range = list[0], xInterval = list[1][0], yInterval = list[1][1], CC = list[2][0], LotdOffset = list[2][1]
            };

            List <JHStation> stationList = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.Display.I_CO_IA_Display, List <JHStation> >(channel =>
            {
                return(channel.GetStationToJH(jhCon));
            });

            if (stationList != null && stationList.Count > 0)
            {
                string imgUrl = "/CO_IA.UI.Display;component/Images/station/GIS_SHF4.png";
                for (int i = 0; i < stationList.Count; i++)
                {
                    string id = Utils.stationGroupFlag + stationList[i].GUID;
                    Utils.MapFun.RemoveSymbolElement(id);

                    double x = 0;
                    double y = 0;
                    if (double.TryParse(stationList[i].STAT_LG, out x) && double.TryParse(stationList[i].STAT_LA, out y))
                    {
                        if (x != 0 && y != 0)
                        {
                            double[] p = I_GS_MapBase.Portal.CoordOffset.transform(x, y);//进行坐标校正
                            x = p[1];
                            y = p[0];
                        }
                    }
                    if (x == 0 || y == 0)
                    {
                        continue;
                    }

                    int statCount = Convert.ToInt32(stationList[i].CO);
                    if (statCount == 1)
                    {
                        //重写
                        //Utils.MapFun.DrawPointToStation(x, y, null, id, new List<KeyValuePair<string, object>> {
                        //        new KeyValuePair<string,object>(GraphicStyle.ImageSource.ToString(), "/CO_IA.UI.Display;component/Images/station/map2.png"),
                        //        new KeyValuePair<string,object>("ImageSource2",imgUrl),
                        //        new KeyValuePair<string,object>(GraphicStyle.zIndex.ToString(),Utils.z_index.ToString()),
                        //        new KeyValuePair<string, object>(GraphicStyle.ToolTipText.ToString(),stationList[i].NAME),
                        //        new KeyValuePair<string, object>("data",stationList[i]),
                        //    }, "StationTemplete");
                    }
                    else
                    {
                        //continue;
                        double size = 0;
                        if (statCount < 10)
                        {
                            size = 22;
                        }
                        else if (statCount < 50)
                        {
                            size = 24;
                        }
                        else if (statCount < 100)
                        {
                            size = 27;
                        }
                        else if (statCount < 200)
                        {
                            size = 30;
                        }
                        else if (statCount < 1000)
                        {
                            size = 33;
                        }
                        else
                        {
                            size = 37;
                        }
                        //重写
                        //Utils.MapFun.DrawPointToStation(x, y, null, "jh_"+id, new List<KeyValuePair<string, object>> {
                        //        new KeyValuePair<string,object>("Count",statCount.ToString()),
                        //        new KeyValuePair<string,object>("Size",size),
                        //        new KeyValuePair<string,object>(GraphicStyle.zIndex.ToString(),Utils.z_index.ToString()),
                        //        new KeyValuePair<string, object>("Color",ClustererInterpolateColor(size - 12, 100)),
                        //    }, "ClustererSymbol");
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void LoadJH(MapExtent extent)
        {
            Obj.screenMap.ClearHaveStation();
            if (_fixedPoint.X == 0)
            {
                _fixedPoint.X = extent.Xy1.X;
                _fixedPoint.Y = extent.Xy1.Y;
            }
            List <double[]> list = getJHParam(new double[] { extent.Xy1.X, extent.Xy1.Y }, new double[] { extent.Xy2.X, extent.Xy2.Y }, 50, new double[] { _fixedPoint.X, _fixedPoint.Y });

            JHCondition jhCon = new JHCondition()
            {
                Range = list[0], xInterval = list[1][0], yInterval = list[1][1], CC = list[2][0], LotdOffset = list[2][1]
            };

            List <JHStation> stationList = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.Display.I_CO_IA_Display, List <JHStation> >(channel =>
            {
                return(channel.GetStationToJH(jhCon));
            });

            if (stationList != null && stationList.Count > 0)
            {
                for (int i = 0; i < stationList.Count; i++)
                {
                    double x = 0;
                    double y = 0;
                    if (double.TryParse(stationList[i].STAT_LG, out x) && double.TryParse(stationList[i].STAT_LA, out y))
                    {
                        //if (x != 0 && y != 0)
                        //{
                        //    double[] p = I_GS_MapBase.Portal.CoordOffset.transform(x, y);//进行坐标校正
                        //    x = p[1];
                        //    y = p[0];
                        //}
                    }
                    if (x == 0 || y == 0)
                    {
                        continue;
                    }
                    MapPointEx point     = Obj.screenMap.MainMap.MapPointFactory.Create(x, y);
                    int        statCount = Convert.ToInt32(stationList[i].CO);
                    if (statCount == 1)
                    {
                        Obj.screenMap.DrawStationPoint(point, true, stationList[i], Obj.screenMap.HaveStationLayer);
                    }
                    else
                    {
                        double size = 0;
                        if (statCount < 10)
                        {
                            size = 22;
                        }
                        else if (statCount < 50)
                        {
                            size = 24;
                        }
                        else if (statCount < 100)
                        {
                            size = 27;
                        }
                        else if (statCount < 200)
                        {
                            size = 30;
                        }
                        else if (statCount < 1000)
                        {
                            size = 33;
                        }
                        else
                        {
                            size = 37;
                        }
                        Obj.screenMap.DrawPoint(point, new I_GS_MapBase.Portal.SymbolElement("stationCluser")
                        {
                            ControlTemplate = Obj.screenMap.MainMap.Resources["ClustererSymbol"] as ControlTemplate,
                            DataSources     = new List <KeyValuePair <string, object> > {
                                new KeyValuePair <string, object>("Count", statCount.ToString()),
                                new KeyValuePair <string, object>("Size", size),
                                new KeyValuePair <string, object>("Color", ClustererInterpolateColor(size - 12, 100)),
                                new KeyValuePair <string, object>("Range", new string[] { stationList[i].XMin, stationList[i].YMax, stationList[i].XMax, stationList[i].YMin }),
                            }
                        }, Obj.screenMap.HaveStationLayer);
                    }
                }
            }
        }
Exemplo n.º 10
0
 public DrawRasterTask(Workspace.Workspace workspace, RasterLayer layer, MapExtent extent, int width, int height)
     : base(workspace, layer, extent, width, height)
 {
 }
Exemplo n.º 11
0
 public DrawPolygonTask(Workspace.Workspace workspace, PolygonLayer layer, MapExtent extent, int width, int height)
     : base(workspace, layer, extent, width, height)
 {
 }
Exemplo n.º 12
0
 public DrawLineTask(Workspace.Workspace workspace, LineLayer layer, MapExtent extent, int width, int height)
     : base(workspace, layer, extent, width, height)
 {
 }