public void GetSketchPointInfo(int index, ref double[] adfX, ref double[] adfY, ref double[] adfZ)
        {
            var marker     = m_pointOverlay.Markers[index];
            var projection = new GaussKrugerProjection();

            projection.Ellipsoid         = ReferenceEllipsoid.International1975;
            projection.LongitudeOfOrigin = Math.Round(marker.Position.Lng / 3) * 3;
            projection.Forward(marker.Position.Lat, marker.Position.Lng, out adfX[0], out adfY[0]);

            adfX[0] = adfX[0] + projection.LongitudeOfOrigin / 3 * 1000000;
        }
示例#2
0
        /// <summary>
        /// 打开KVS文件
        /// </summary>
        /// <param name="kvsFileName">文件名</param>
        /// <param name="sourceCoordinates"></param>
        /// <param name="targetCoordinates"></param>
        public static void Open(string kvsFileName, out List <HorizontalCoordinate> sourceCoordinates, out List <HorizontalCoordinate> targetCoordinates)
        {
            sourceCoordinates = new List <HorizontalCoordinate>();
            targetCoordinates = new List <HorizontalCoordinate>();

            var projection = new GaussKrugerProjection();

            projection.Ellipsoid = ReferenceEllipsoid.International1975;

            var document = new XmlDocument();

            document.Load(kvsFileName);
            var root = document.DocumentElement;

            foreach (XmlNode coordinateNode in root.ChildNodes)
            {
                foreach (XmlNode node in coordinateNode.ChildNodes)
                {
                    double lng = double.MinValue, lat = double.MinValue;
                    foreach (XmlNode lbNode in node.ChildNodes)
                    {
                        switch (lbNode.Name.ToLower())
                        {
                        case "longitude":
                            lng = Convert.ToDouble(lbNode.InnerText.Trim());
                            break;

                        case "latitude":
                            lat = Convert.ToDouble(lbNode.InnerText.Trim());
                            break;
                        }
                    }

                    projection.LongitudeOfOrigin = (int)Math.Round(lng / 3) * 3;
                    double E, N;
                    projection.Forward(lat, lng, out E, out N);

                    switch (node.Name.ToLower())
                    {
                    case "source":
                        sourceCoordinates.Add(new HorizontalCoordinate(E, N));
                        break;

                    case "target":
                        targetCoordinates.Add(new HorizontalCoordinate(E, N));
                        break;
                    }
                }
            }
        }
        public void GetSketchPolygonInfo(int index, ref double[] adfX, ref double[] adfY, ref double[] adfZ)
        {
            var polygon = m_polygonOverlay.Polygons[index];

            var projection = new GaussKrugerProjection();

            projection.Ellipsoid = ReferenceEllipsoid.International1975;

            for (int i = 0; i < polygon.Points.Count; i++)
            {
                projection.LongitudeOfOrigin = Math.Round(polygon.Points[i].Lng / 3) * 3;
                projection.Forward(polygon.Points[i].Lat, polygon.Points[i].Lng, out adfX[i], out adfY[i]);
                adfX[i] = adfX[i] + projection.LongitudeOfOrigin / 3 * 1000000;
            }
        }
        public void GetSketchPointInfo(int index, ref double[] adfX, ref double[] adfY, ref double[] adfZ, Matrix param4)
        {
            var marker     = m_pointOverlay.Markers[index];
            var projection = new GaussKrugerProjection();

            projection.Ellipsoid         = ReferenceEllipsoid.International1975;
            projection.LongitudeOfOrigin = Math.Round(marker.Position.Lng / 3) * 3;
            projection.Forward(marker.Position.Lat, marker.Position.Lng, out adfX[0], out adfY[0]);

            var sourceCoordinate = new HorizontalCoordinate(adfX[0], adfY[0]);
            var targetCoordinate = LinearTransformation.Transform(sourceCoordinate, param4);

            adfX[0] = targetCoordinate.X + projection.LongitudeOfOrigin / 3 * 1000000;
            adfY[0] = targetCoordinate.Y;
        }
        public void GetSketchPolygonInfo(int index, ref double[] adfX, ref double[] adfY, ref double[] adfZ, Matrix param4)
        {
            var polygon = m_polygonOverlay.Polygons[index];

            var projection = new GaussKrugerProjection();

            projection.Ellipsoid = ReferenceEllipsoid.International1975;

            for (int i = 0; i < polygon.Points.Count; i++)
            {
                projection.LongitudeOfOrigin = Math.Round(polygon.Points[i].Lng / 3) * 3;
                projection.Forward(polygon.Points[i].Lat, polygon.Points[i].Lng, out adfX[i], out adfY[i]);

                var sourceCoordinate = new HorizontalCoordinate(adfX[i], adfY[i]);
                var targetCoordinate = LinearTransformation.Transform(sourceCoordinate, param4);

                adfX[i] = targetCoordinate.X + projection.LongitudeOfOrigin / 3 * 1000000;
                adfY[i] = targetCoordinate.Y;
            }
        }