Beispiel #1
0
        /// <summary>
        /// 更新位置
        /// </summary>
        /// <param name="lnglat">坐标</param>
        public void UpdatePosition(MapLngLat _lnglat)
        {
            this.Dosomething((Action) delegate()
            {
                IPoint point = new PointClass();
                point.PutCoords(_lnglat.Lng, _lnglat.Lat);
                point.Z = _lnglat.Alt;
                (point as IZAware).ZAware = true;
                base.Geometry             = point;
                graphicLayer.UpdateElementByIndex(index);   // 刷新图元
            }, true);

            this.lngLat = _lnglat;
        }
Beispiel #2
0
        /// <summary>
        /// 地图鼠标右键弹起事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void axMapControl_eventRButtonUp(object sender, _DHOSOFTMapControlEvents_eventRButtonUpEvent e)
        {
            if (Utils.bPublishEvent == false)
            {
                return;
            }
            MapLngLat        lnglat = new MapLngLat(e.dLong, e.dLat);
            MFMouseEventArgs args   = new MFMouseEventArgs(lnglat, MouseButtons.Right, e.x, e.y);

            if (MouseUpEvent != null)
            {
                MouseUpEvent.Invoke(this, args);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 移除点
        /// </summary>
        /// <param name="lnglat"></param>
        public void RemovePoint(MapLngLat lnglat)
        {
            if (listPoint.Count <= 3)
            {
                return;
            }
            var point = listPoint.Find(o => o.Lng == lnglat.Lng || o.Lat == lnglat.Lat);

            if (point != null)
            {
                listPoint.Remove(point);
                DrawNewPolygon(listPoint);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 移动鼠标实时绘制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gmapControl_MouseMove(object sender, MouseEventArgs e)
        {
            if (!drawn)
            {
                return;
            }
            var lngLat    = gmapControl.FromLocalToLatLng(e.X, e.Y);
            var maplngLat = new MapLngLat(lngLat.Lng, lngLat.Lat);

            listMapPoints.Add(maplngLat);              // 添加点
            lineElement.UpdatePosition(listMapPoints); // 更新
            listMapPoints.Remove(maplngLat);           // 移除点
            layer.Refresh();                           // 刷新
        }
Beispiel #5
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     if (flashTimer != null)
     {
         flashTimer.Stop();
         flashTimer.Dispose();
     }
     pHightlight = false;
     pIsFlash    = false;
     isVisible   = true;
     position    = null;
     mapControl  = null;
     mapFactory  = null;
 }
Beispiel #6
0
        //地图控件鼠标左键双击事件
        private void axMapControl_eventLButtonDbClick(object sender, _DHOSOFTMapControlEvents_eventLButtonDbClickEvent e)
        {
            if (Utils.bPublishEvent == false)
            {
                return;
            }
            MapLngLat        lnglat = new MapLngLat(e.dLong, e.dLat);
            MFMouseEventArgs args   = new MFMouseEventArgs(lnglat, MouseButtons.Left, e.x, e.y);

            if (MouseDbClickEvent != null)
            {
                MouseDownEvent.Invoke(this, args);
            }
        }
Beispiel #7
0
        private void 更新位置ToolStripMenuItem1_Click(object sender, System.EventArgs e)
        {
            if (lineElement == null)
            {
                return;
            }
            MapLngLat        map1    = new MapLngLat(56, 48);
            MapLngLat        map2    = new MapLngLat(101, 69);
            List <MapLngLat> listMap = new List <MapLngLat>();

            listMap.Add(map1);
            listMap.Add(map2);
            lineElement.UpdatePosition(listMap);
        }
Beispiel #8
0
        /// <summary>
        /// 字节流转成类对象
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static BeamData ByteToClass(byte[] data)
        {
            BeamData beam = new BeamData();

            beam.SatelliteId = BitConverter.ToInt32(data, 0);
            beam.BeamId      = BitConverter.ToInt32(data, 4);
            beam.PointType   = BitConverter.ToInt32(data, 8);

            byte[] arr = new byte[24];
            Buffer.BlockCopy(data, 12, arr, 0, 24);
            beam.Point = MapLngLat.ByteToClass(arr);

            return(beam);
        }
Beispiel #9
0
        /// <summary>
        /// 添加点
        /// </summary>
        /// <param name="lngLat"></param>
        public void AddPoint(MapLngLat lngLat)
        {
            Dosomething((Action)(delegate
            {
                ESRI.ArcGIS.Geometry.IPoint newPoint = new ESRI.ArcGIS.Geometry.PointClass()
                {
                    X = lngLat.Lng, Y = lngLat.Lat
                };
                pointCollection.AddPoint(newPoint);
                base.Geometry = (IGeometry)pointCollection;
            }), true);

            Update();
            pointList.Add(lngLat);//坐标集合
        }
Beispiel #10
0
        /// <summary>
        /// 添加点
        /// </summary>
        /// <param name="lngLat">地图点</param>
        public void AddPoint(MapLngLat lngLat)
        {
            this.Dosomething((Action) delegate()
            {
                IPoint p = new PointClass();
                p.PutCoords(lngLat.Lng, lngLat.Lat);
                p.Z = lngLat.Alt;

                pointCollection.AddPoint(p);
                base.Geometry = (IGeometry)pointCollection;
            }, true);

            Update();
            pointList.Add(lngLat);//添加到坐标集合
        }
Beispiel #11
0
 /// <summary>
 /// 更新位置
 /// </summary>
 /// <param name="centerDot"></param>
 public void UpdatePosition(MapLngLat centerDot)
 {
     this.centerLnglat = centerDot;
     base.Points.Clear();
     for (int i = 0; i < 360; i++)
     {
         double      seg    = Math.PI * i / 180;
         double      a      = centerDot.Lng + radius * Math.Cos(seg) / 100000;
         double      b      = centerDot.Lat + radius * Math.Sin(seg) / 100000;
         PointLatLng lnglat = new PointLatLng(b, a);
         base.Points.Add(lnglat);
     }
     this.Overlay.Control.UpdatePolygonLocalPosition(this);
     this.Update();
 }
Beispiel #12
0
        /// <summary>
        /// 获取线的经纬度集合
        /// </summary>
        /// <returns></returns>
        public List <MapLngLat> GetLngLat()
        {
            lock (this.Points)
            {
                List <MapLngLat> pointList = new List <MapLngLat>();

                foreach (PointLatLng p in this.Points)
                {
                    MapLngLat point = new MapLngLat(p.Lng, p.Lat);
                    pointList.Add(point);
                }

                return(pointList);
            }
        }
Beispiel #13
0
 /// <summary>
 /// 鼠标按下事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void mapControl_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
 {
     if (e.button == 1 && !isControl && !isMouseDown)
     {
         textCtrl          = new TextInput();
         textCtrl.Location = new Point(e.x, e.y);
         mapControl.CreateControl();//强制创建控件
         mapControl.Controls.Add(textCtrl);
         textCtrl.InputFinished += InputFinish;
         downPoint = new MapLngLat()
         {
             Lng = e.mapX, Lat = e.mapY
         };
         isMouseDown = true;
     }
 }
Beispiel #14
0
        /// <summary>
        /// 添加点  延长线
        /// </summary>
        /// <param name="lngLat"></param>
        public void AddPoint(MapLngLat lngLat)
        {
            IPointCollection pointCollection = base.Geometry as IPointCollection;

            if (pointCollection != null)
            {
                IPoint point = new PointClass();
                point.PutCoords(lngLat.Lng, lngLat.Lat);
                point.Z = lngLat.Alt;
                pointCollection.AddPoint(point);
                Dosomething((Action) delegate()
                {
                    base.Geometry = pointCollection as IGeometry;
                }, true);
            }
        }
Beispiel #15
0
        /// <summary>
        /// 获取线的经纬列表
        /// </summary>
        /// <returns></returns>
        public List <Core.Model.MapLngLat> GetLngLat()
        {
            int count = pointCollection.PointCount;
            List <Core.Model.MapLngLat> lnglatList = new List <MapLngLat>();

            Core.Model.MapLngLat lnglat;
            IPoint point = new PointClass();

            for (int i = 0; i < count; i++)
            {
                point  = pointCollection.get_Point(i);
                lnglat = new MapLngLat(point.X, point.Y);
                lnglatList.Add(lnglat);
            }
            return(lnglatList);
        }
Beispiel #16
0
        /// <summary>
        /// 鼠标按下事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gmapControl_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Clicks == 2)
            {
                return;
            }
            if (e.Button == MouseButtons.Left)
            {
                if (isFinish == true)
                {
                    ReleaseCommond();
                    return;
                }

                var lngLat    = gmapControl.FromLocalToLatLng(e.X, e.Y);
                var maplngLat = new MapLngLat(lngLat.Lng, lngLat.Lat);
                if (pointIndex == 0)//第一个点
                {
                    listMapPoints = new List <MapLngLat>();

                    //加线
                    Kml kmlLine = new Kml();
                    kmlLine.Placemark.Name = lineName;

                    KmlLineString line = new KmlLineString();
                    line.Argb  = Color.Green.ToArgb();
                    line.Width = 2;
                    List <MapLngLat> pList = new List <MapLngLat>();
                    pList.Add(new MapLngLat(lngLat.Lng, lngLat.Lat));
                    line.PositionList       = pList;                    //string.Format("{0},{1}", lngLat.Lng, lngLat.Lat);
                    kmlLine.Placemark.Graph = line;
                    layerCollection.GetLayer(layerName).AddElement(kmlLine);

                    listMapPoints.Add(maplngLat);
                    pointIndex++;
                }
                else
                {
                    pointIndex++;
                    if (!listMapPoints.Contains(maplngLat))
                    {
                        listMapPoints.Add(maplngLat);
                    }
                }
                isMouseDown = true;
            }
        }
Beispiel #17
0
        /// <summary>
        /// 移动鼠标实时绘制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gmapControl_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (isMouseDown == false)
            {
                return;
            }
            if (isFinish)
            {
                return;
            }
            var lngLat    = gmapControl.FromLocalToLatLng(e.X, e.Y);
            var maplngLat = new MapLngLat(lngLat.Lng, lngLat.Lat);

            listMapPoints.Add(maplngLat);                                                                          //添加点
            (layerCollection.GetLayer(layerName).GetElement(lineName) as ILineGMap).UpdatePosition(listMapPoints); //更新
            listMapPoints.Remove(maplngLat);                                                                       //移除点
        }
Beispiel #18
0
 private void ToolStripMenuItemJump_Click(object sender, EventArgs e)
 {
     try
     {
         RealData focusedData = gvRealData.GetFocusedRow() as RealData;
         if (focusedData != null)
         {
             MapLngLat lnglat = new MapLngLat(focusedData.Longitude, focusedData.Latitude, focusedData.Altitude);
             globeBusiness.mapLogic.GetToolBox().ZoomToPosition(lnglat);
             gmapBusiness.mapLogic.GetToolBox().ZoomToPosition(lnglat);
         }
     }
     catch (Exception ex)
     {
         DevExpress.XtraEditors.XtraMessageBox.Show("跳转失败:" + ex.Message);
     }
 }
Beispiel #19
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="_graphcisLayer">图层</param>
        /// <param name="modelKml">模型kml</param>
        public Model3d_ArcGlobe(IGlobeGraphicsLayer _graphicLayer, KmlModel3d modelKml, IImport3DFile import3Dfile)
        {
            graphicLayer = _graphicLayer;

            this.ElementType = ElementTypeEnum.Model3D;   // 图元类型
            this.Description = modelKml.Description;      // 图元描述

            #region  符号

            IGeometry geometry = import3Dfile.Geometry;
            //将模型转为3D符号
            marker3DSymbol       = new Marker3DSymbolClass();
            marker3DSymbol.Shape = geometry;
            markerSymbol         = marker3DSymbol as IMarkerSymbol;
            markerSymbol.Size    = modelKml.Scale;
            markerSymbol.Angle   = modelKml.Azimuth;


            IRgbColor c = new RgbColorClass();
            c.Transparency     = modelKml.Color.A;
            c.Red              = modelKml.Color.R;
            c.Green            = modelKml.Color.G;
            c.Blue             = modelKml.Color.B;
            markerSymbol.Color = c;

            this.scale = modelKml.Scale;
            this.color = modelKml.Color;

            #endregion

            #region  位置

            IPoint p = new PointClass();
            p.PutCoords(modelKml.Position.Lng, modelKml.Position.Lat);
            p.Z = modelKml.Position.Alt;
            (p as IZAware).ZAware = true;
            #endregion
            lngLat = modelKml.Position;

            base.Geometry = p;                                  //指定位置
            base.Symbol   = markerSymbol;                       //指定符号

            flashTimer          = new Timer();
            flashTimer.Elapsed += new ElapsedEventHandler(flashTimer_Elapsed);
            flashTimer.Interval = 500;
        }
Beispiel #20
0
        /// <summary>
        /// 设置编辑点
        /// </summary>
        /// <param name="editPoint">编辑点</param>
        public void SetEditPoint(MapLngLat editPoint)
        {
            bIsEditDirectionLine = true;
            editPointLatLng      = new PointLatLng(editPoint.Lat, editPoint.Lng);

            overlay.Markers.Clear();
            for (int i = 0; i < route.Points.Count; i++)
            {
                // 只添加当前编辑点
                if (editPointLatLng == route.Points[i])
                {
                    EditMarker marker = new EditMarker(route.Points[i]);
                    overlay.Markers.Add(marker);
                    gmapControl.UpdateMarkerLocalPosition(marker);
                    break;
                }
            }
        }
Beispiel #21
0
 private void 添加ToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("添加点程序线程ID" + Thread.CurrentThread.ManagedThreadId);
     for (int i = 0; i < 5000; i++)
     {
         Kml    kml     = new Kml();
         string iconUrl = AppDomain.CurrentDomain.BaseDirectory + @"Image\hoverplane.png";
         kml.Placemark.Name = "point" + i;
         MapLngLat lnglat = new MapLngLat(random.Next(-18000, 18000) / 100, random.Next(-9000, 9000) / 100);
         kml.Placemark.Graph = new KmlPicture()
         {
             Position = lnglat, IconUrl = iconUrl, Scale = 1, TipText = "标牌测试...."
         };
         mapLogic.GetLayer(drawLayerName).AddElement(kml, out element);
         picElement = element as IMFPicture;
         picList.Add(picElement);
     }
 }
Beispiel #22
0
        private void 更新位置ToolStripMenuItem2_Click(object sender, System.EventArgs e)
        {
            if (polygonElement == null)
            {
                return;
            }
            MapLngLat        m1      = new MapLngLat(111, 56);
            MapLngLat        m2      = new MapLngLat(89, 76);
            MapLngLat        m3      = new MapLngLat(92, 66);
            MapLngLat        m4      = new MapLngLat(100, 86);
            List <MapLngLat> listMap = new List <MapLngLat>();

            listMap.Add(m1);
            listMap.Add(m2);
            listMap.Add(m3);
            listMap.Add(m4);
            polygonElement.UpdatePosition(listMap);
        }
Beispiel #23
0
        /// <summary>
        /// 获取线的经纬度列表
        /// </summary>
        /// <returns></returns>
        public List <MapLngLat> GetLngLat()
        {
            IPointCollection pointCollection = base.Geometry as IPointCollection;
            List <MapLngLat> pList           = new List <MapLngLat>();

            if (pointCollection != null)
            {
                for (int i = 0; i < pointCollection.PointCount; i++)
                {
                    MapLngLat lnglat = new MapLngLat();
                    lnglat.Lng = pointCollection.get_Point(i).X;
                    lnglat.Lat = pointCollection.get_Point(i).Y;
                    pList.Add(lnglat);
                }
            }

            return(pList);
        }
Beispiel #24
0
 /// <summary>
 /// 鼠标按下,绘制第一个点,并注册鼠标移动事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void gmapControl_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         var lngLat = gmapControl.FromLocalToLatLng(e.X, e.Y);
         if (index == 0)
         {
             //添加点
             MapLngLat point = new MapLngLat(lngLat.Lng, lngLat.Lat);
             marker             = new EditMarker(lngLat);
             marker.Tag         = "点";
             marker.ToolTipText = string.Format("起点\n经度:{0}\n纬度:{1}\n角度:{2}°", lngLat.Lng, lngLat.Lat, 0);
             marker.ToolTipMode = MarkerTooltipMode.Always;
             mapOverlay.Markers.Add(marker);
             //添加线
             KmlLineString linekml = new KmlLineString();
             linekml.Color = Color.Green;
             linekml.Width = 3;
             List <MapLngLat> pList = new List <MapLngLat>();
             pList.Add(new MapLngLat(lngLat.Lng, lngLat.Lat));
             pList.Add(new MapLngLat(lngLat.Lng, lngLat.Lat));
             linekml.PositionList = pList;
             lineRoute            = new Line_GMap("measure_Angle", linekml);
             mapOverlay.Routes.Add(lineRoute);
             pointList[0] = point;
             //注册移动事件
             gmapControl.MouseMove += new System.Windows.Forms.MouseEventHandler(gmapControl_MouseMove);
             index++;
         }
         else if (index == 1)
         {
             index++;
             gmapControl.MouseMove -= gmapControl_MouseMove;
             RegistCommandExcuteEvent();
             ReleaseCommond();//修改  陈静
         }
         else if (index == 2)
         {
             index = 0;
             mapOverlay.Markers.Remove(marker);
             mapOverlay.Routes.Remove(lineRoute);
         }
     }
 }
Beispiel #25
0
        /// <summary>
        /// 鼠标按下事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gmapControl_MouseDown(object sender, MouseEventArgs e)
        {
            TimeSpan span = DateTime.Now - fistTimer;

            if (span.TotalMilliseconds < 170)
            {
                return;
            }
            fistTimer = DateTime.Now;
            if (e.Clicks == 2 || e.Button != MouseButtons.Left || mouseDown)
            {
                return;
            }
            var lngLat    = gmapControl.FromLocalToLatLng(e.X, e.Y);
            var maplngLat = new MapLngLat(lngLat.Lng, lngLat.Lat);

            if (listMapPoints.Count == 0)
            {
                //加线
                Kml kmlLine = new Kml();
                kmlLine.Placemark.Name = "draw_line" + Utils.ElementIndex;

                KmlLineString line = new KmlLineString();
                line.Color = Color.Green;
                line.Width = 2;
                List <MapLngLat> pList = new List <MapLngLat>();
                pList.Add(new MapLngLat(lngLat.Lng, lngLat.Lat));
                line.PositionList       = pList;                    //string.Format("{0},{1}", lngLat.Lng, lngLat.Lat);
                kmlLine.Placemark.Graph = line;
                IMFElement element = null;
                drawn       = layer.AddElement(kmlLine, out element);
                lineElement = element as IMFLine;
                listMapPoints.Add(maplngLat);
                gmapControl.MouseMove += gmapControl_MouseMove;
            }
            else
            {
                if (!listMapPoints.Contains(maplngLat))
                {
                    listMapPoints.Add(maplngLat);
                    lineElement.AddPoint(maplngLat);
                }
            }
        }
Beispiel #26
0
        /// <summary>
        /// 鼠标按下
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gmapControl_MouseDown(object sender, MouseEventArgs e)
        {
            TimeSpan span = DateTime.Now - fistTimer;

            if (span.TotalMilliseconds < 170)
            {
                return;
            }
            fistTimer = DateTime.Now;
            if (e.Clicks == 2 || e.Button != MouseButtons.Left || isMouseDown)
            {
                return;
            }

            var lngLat    = gmapControl.FromLocalToLatLng(e.X, e.Y);
            var maplanLat = new MapLngLat(lngLat.Lng, lngLat.Lat);

            if (listMapPoints.Count == 0)//第一个点  生成多边形
            {
                Kml polygonKml = new Kml();
                polygonKml.Placemark.Name = "draw_polygon" + Utils.ElementIndex;

                listMapPoints.Add(maplanLat);     //添加到集合中
                polygonKml.Placemark.Graph = new KmlPolygon()
                {
                    Description  = "",
                    PositionList = listMapPoints,
                    FillColor    = Color.FromArgb(155, Color.AliceBlue),
                    OutLineColor = Color.FromArgb(155, Color.MidnightBlue)
                };
                IMFElement element = null;
                drawn                  = layer.AddElement(polygonKml, out element); // 添加多边形到地图中
                polygonElement         = element as IMFPolygon;
                gmapControl.MouseMove += gmapControl_MouseMove;
            }
            else
            {
                if (!listMapPoints.Contains(maplanLat))
                {
                    listMapPoints.Add(maplanLat);
                    polygonElement.AddPoint(maplanLat);
                }
            }
        }
Beispiel #27
0
        /// <summary>
        /// 鼠标按下事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mapControl_OnMouseDown(object sender, IGlobeControlEvents_OnMouseDownEvent e)
        {
            if (e.button == 1) //鼠标左键
            {
                MapLngLat lnglat = this.SceneToGeographyPoint(e.x, e.y);
                lnglat.Alt = lnglat.Alt * -1;
                pointList.Add(lnglat);
                if (pointList.Count == 2)
                {
                    kml = new Kml();
                    kml.Placemark.Name = "辅助线";
                    KmlLineString lineKml = new KmlLineString();
                    lineKml.Rasterize    = true;
                    lineKml.Description  = "辅助线";
                    lineKml.PositionList = pointList;
                    lineKml.Color        = Color.FromArgb(70, Color.Orange);
                    kml.Placemark.Graph  = lineKml;
                    layer.AddElement(kml);

                    kml.Placemark.Name     = "绘制面" + Utils.Index;
                    polygonKml             = new KmlPolygon();
                    polygonKml.Rasterize   = true;
                    polygonKml.Description = "手动绘制的面";
                    polygonKml.FillColor   = Color.FromArgb(70, Color.Orange);
                    kml.Placemark.Graph    = polygonKml;
                }
                else if (pointList.Count == 3)                      //更新面
                {
                    layer.RemoveElement("辅助线");
                    polygonKml.PositionList = pointList;
                    kml.Placemark.Graph     = polygonKml;
                    drawn = layer.AddElement(kml, out polygonElement);
                }
                else if (pointList.Count > 3)
                {
                    layer.RemoveElement(polygonElement);
                    polygonKml.PositionList = pointList;
                    kml.Placemark.Graph     = polygonKml;
                    drawn = layer.AddElement(kml, out polygonElement);
                }
                layer.Refresh();
            }
        }
Beispiel #28
0
        /// <summary>
        /// 鼠标单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gmapControl_MouseDown(object sender, MouseEventArgs e)
        {
            TimeSpan span = DateTime.Now - fistTimer;

            if (span.TotalMilliseconds < 170)
            {
                return;
            }
            fistTimer = DateTime.Now;
            if (e.Clicks == 2 || e.Button != MouseButtons.Left)
            {
                return;
            }
            PointLatLng point = gmapControl.FromLocalToLatLng(e.X, e.Y);

            currentPoint = new MapLngLat(point.Lng, point.Lat);
            pointList[0] = currentPoint;
            Kml polygonKml = new Kml();

            polygonKml.Placemark.Name = "draw_rectangle" + Utils.ElementIndex;

            List <MapLngLat> pList = new List <MapLngLat>();

            pList.Add(new MapLngLat(point.Lng, point.Lat));
            pList.Add(new MapLngLat(point.Lng, point.Lat));
            pList.Add(new MapLngLat(point.Lng, point.Lat));
            pList.Add(new MapLngLat(point.Lng, point.Lat));

            polygonKml.Placemark.Graph = new KmlPolygon()
            {
                Description  = "手动绘制矩形",
                PositionList = pList,
                FillColor    = Color.FromArgb(155, Color.AliceBlue),
                OutLineColor = Color.FromArgb(155, Color.MidnightBlue)
            };
            IMFElement element = null;

            drawn          = layer.AddElement(polygonKml, out element);
            rectangElement = element as IMFPolygon;

            gmapControl.MouseMove += gmapControl_MouseMove;
            gmapControl.MouseUp   += gmapControl_MouseUp;
        }
Beispiel #29
0
        /// <summary>
        /// 添加航迹点
        /// </summary>
        /// <param name="modelName"></param>
        /// <param name="point"></param>
        public void AddTrackPoint(string modelName, byte type, MapLngLat point)
        {
            try
            {
                if (modelDic.ContainsKey(modelName))
                {
                    TrackPoint tp = new TrackPoint();
                    tp.Index     = index;
                    tp.PointName = modelName + "point_" + index;
                    tp.Position  = point;

                    modelDic[modelName].Points.Add(tp);

                    if (modelDic[modelName].Points.Count > Utils.TrackPointNum)
                    {
                        modelDic[modelName].Points.RemoveAt(0);
                    }
                }
                else
                {
                    TrackPoint tp = new TrackPoint();
                    tp.Index     = index;
                    tp.PointName = modelName + "point_" + index;
                    tp.Position  = point;

                    TrackLine line = new TrackLine();
                    line.LineName  = modelName + "line";
                    line.ModelName = modelName;
                    line.Points    = new List <TrackPoint>();
                    line.Points.Add(tp);
                    line.TargetType = type;

                    modelDic.Add(modelName, line);
                }

                index++;
            }
            catch (Exception ex)
            {
                Log4Allen.WriteLog(typeof(TrackLineManager), ex.Message);
            }
        }
Beispiel #30
0
 /// <summary>
 /// 释放资源
 /// </summary>
 public void Dispose()
 {
     mapControl = null;
     mapLogic   = null;
     if (measureTool != null)
     {
         measureTool.Dispose();
     }
     downPoint            = null;
     listMapPoints        = null;
     toltalLength         = 0;
     segmentLength        = 0;
     measureArea          = 0;
     measureLine          = null;
     measurePolygon       = null;
     isFinish             = false;
     isControl            = false;
     measureType          = string.Empty;
     CommondExecutedEvent = null;
 }