Beispiel #1
0
        /// <summary>
        /// 获取角度
        /// </summary>
        /// <param name="lng">经度</param>
        /// <param name="lat">纬度</param>
        /// <returns></returns>
        private double GetAngle(double lng, double lat)
        {
            MapFrame.Core.Model.MapLngLat point = new MapFrame.Core.Model.MapLngLat(lng, lat);

            //计算角度
            double zqz   = Math.Abs((firstPoint.X - point.Lng)) / Math.Abs((firstPoint.Y - point.Lat));
            double zqzjd = Math.Atan(zqz);
            double jd    = Math.Round(180 / Math.PI * zqzjd, 2);

            if ((firstPoint.X - point.Lng) < 0 && (firstPoint.Y - point.Lat) < 0)//第一象限
            {
            }
            else if ((firstPoint.X - point.Lng) < 0 && (firstPoint.Y - point.Lat) > 0) //第四象限
            {
                jd = 180 - jd;
            }
            else if ((firstPoint.X - point.Lng) > 0 && (firstPoint.Y - point.Lat) > 0) //第三象限
            {
                jd += 180;
            }
            else if ((firstPoint.X - point.Lng) > 0 && (firstPoint.Y - point.Lat) < 0) //第二象限
            {
                jd = 360 - jd;
            }
            return(jd);
        }
Beispiel #2
0
        /// <summary>
        /// 编辑点移动事件
        /// </summary>
        /// <param name="element"></param>
        /// <param name="e"></param>
        void editPoint_MarkerMouseMoveEvent(IElement element, IMapControlEvents2_OnMouseMoveEvent e)
        {
            IPoint newPoint = new PointClass();
            var    mapPoint = new MapFrame.Core.Model.MapLngLat()
            {
                Lng = e.mapX, Lat = e.mapY
            };

            newPoint.PutCoords(e.mapX, e.mapY);
            if (isControlDown)
            {
                centerMarker.MoveTo(newPoint);//圆心点也跟着移动
                circleArcMap.UpdatePosition(mapPoint);
                int i = 0;
                for (float ang = 0; ang <= 270; ang += 90)
                {
                    var point = GetPointByDistanceAndAngle(circleArcMap.GetRadius() * 100000, newPoint, ang);
                    markerList[i].MoveTo(point);
                    i++;
                }
            }
            else
            {
                if (currentMarker.Name == "s")
                {
                    currentMarker.MoveTo(newPoint);
                    circleArcMap.UpdatePosition(mapPoint);
                    int i = 0;
                    for (float ang = 0; ang <= 270; ang += 90)
                    {
                        var point = GetPointByDistanceAndAngle(circleArcMap.GetRadius(), newPoint, ang);
                        markerList[i].MoveTo(point);
                        i++;
                    }
                }
                else
                {
                    IPoint centerDot = new PointClass()
                    {
                        X = circleArcMap.GetCenterDot().Lng, Y = circleArcMap.GetCenterDot().Lat
                    };
                    double radius = MapFrame.Core.Common.Utils.GetDistance(circleArcMap.GetCenterDot(), mapPoint);
                    circleArcMap.UpdatePosition(radius);
                    int i = 0;

                    for (float ang = 0; ang <= 270; ang += 90)
                    {
                        var point = GetPointByDistanceAndAngle(radius, centerDot, ang);
                        markerList[i].MoveTo(point);
                        i++;
                    }
                }
                mapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, circleElement, null);
            }
            currentPoint = new PointClass();
            currentPoint.PutCoords(e.mapX, e.mapY);
        }
Beispiel #3
0
        /// <summary>
        /// 根据两点坐标求距离(GMap、Mgis单位为公里)
        /// </summary>
        /// <param name="p1">坐标点1</param>
        /// <param name="p2">坐标点2</param>
        /// <returns></returns>
        public static double GetDistance(MapFrame.Core.Model.MapLngLat p1, MapFrame.Core.Model.MapLngLat p2)
        {
            double radlat1 = rad(p1.Lat);
            double radlat2 = rad(p2.Lat);
            double a       = radlat1 - radlat2;
            double b       = rad(p1.Lng) - rad(p2.Lng);
            double s       = 2 * Math.Asin(Math.Sqrt(Math.Pow(a / 2, 2) + Math.Cos(radlat1) * Math.Cos(radlat2) * Math.Pow(Math.Sin(b / 2), 2)));

            s = s * Earth;
            return((float)Math.Round(s * 10000) / 10000);
        }
Beispiel #4
0
 /// <summary>
 /// 文字kml构造函数
 /// </summary>
 public KmlText()
 {
     Position = new MapLngLat();
 }
Beispiel #5
0
 public KmlCircle()
 {
     Position = new MapLngLat();
 }
Beispiel #6
0
 public KmlModel3d()
 {
     Position = new MapLngLat();
 }