コード例 #1
0
        /// <summary>
        /// 获取转换后的点
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="param4"></param>
        /// <returns></returns>
        private HorizontalCoordinate GetTransformedPoint(double x, double y, Matrix param4)
        {
            var offset = ((int)x / 1000000) * 1000000;

            // 坐标转换
            x = x - offset;
            var sourceCoordinate = new HorizontalCoordinate(x, y);
            var targetCoordinate = LinearTransformation.Transform(sourceCoordinate, param4);

            return(new HorizontalCoordinate(targetCoordinate.X + offset, targetCoordinate.Y));
        }
コード例 #2
0
ファイル: OverallTransformation.cs プロジェクト: minskowl/MY
        public void Transform(Matrix mat)
        {
            RotationalTransformation rot = new RotationalTransformation();

            rot.Matrix = mat;
            rot.RotateDegreesAroundOrigin(mRotation);

            LinearTransformation lt = new LinearTransformation();

            lt.Matrix = mat;
            if (mAspect < 0)
            {
                lt.StretchX = 1 + mAspect;
                lt.Transform();
            }
            if (mAspect > 0)
            {
                lt.StretchY = 1 - +mAspect;
                lt.Transform();
            }
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        /// <summary>
        /// 取图形范围
        /// </summary>
        /// <param name="adfMinBound"></param>
        /// <param name="adfMaxBound"></param>
        /// <param name="param4"></param>
        /// <returns></returns>
        private RectLatLng GetShapeRect(double[] adfMinBound, double[] adfMaxBound, Matrix param4)
        {
            double minX, minY, maxX, maxY;

            minX = adfMinBound[0];
            minY = adfMinBound[1];

            var minZone = (int)minX / 1000000;

            minX = minX - minZone * 1000000;

            maxX = adfMaxBound[0];
            maxY = adfMaxBound[1];

            var maxZone = (int)maxX / 1000000;

            maxX = maxX - maxZone * 1000000;

            // 坐标转换(不要加大数)
            var minXY = LinearTransformation.Transform(new HorizontalCoordinate(minX, minY), param4);
            var maxXY = LinearTransformation.Transform(new HorizontalCoordinate(maxX, maxY), param4);

            var projection = new GaussKrugerProjection();

            projection.Ellipsoid = ReferenceEllipsoid.International1975;

            // 再转成经纬度(加上大数,因为需要计算投影带号)
            double lat, lng;

            projection.LongitudeOfOrigin = minZone * 3;
            projection.Reverse(minXY.X, minXY.Y, out lat, out lng);
            var minLB = new GeocentricCoordinate(lat, lng);

            projection.LongitudeOfOrigin = maxZone * 3;
            projection.Reverse(maxXY.X, maxXY.Y, out lat, out lng);
            var maxLB = new GeocentricCoordinate(lat, lng);

            // 取得图形范围用于显示
            var rect = new RectLatLng(maxLB.Latitude.Digital, minLB.Longitude.Digital, maxLB.Longitude.Digital - minLB.Longitude.Digital, maxLB.Latitude.Digital - minLB.Latitude.Digital);

            return(rect);
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        /// <summary>
        /// 获取转换后的点
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="param4"></param>
        /// <returns></returns>
        private PointLatLng GetTransformedPoint(double x, double y, Matrix param4)
        {
            var projection = new GaussKrugerProjection();

            projection.Ellipsoid = ReferenceEllipsoid.International1975;

            var zone = (int)x / 1000000;

            x = x - zone * 1000000;

            // 坐标转换(不要加大数)
            var sourceCoordinate = new HorizontalCoordinate(x, y);
            var targetCoordinate = LinearTransformation.Transform(sourceCoordinate, param4);

            // 再转成经纬度(加上大数,因为需要计算投影带号)
            double lat, lng;

            projection.LongitudeOfOrigin = zone * 3;
            projection.Reverse(targetCoordinate.X, targetCoordinate.Y, out lat, out lng);

            return(new PointLatLng(lat, lng));
        }
コード例 #7
0
 /// <summary>
 /// Push a new object space onto the stack and then apply a <see cref="SharpGL.SceneGraph.Transformations.LinearTransformation"/>.
 /// </summary>
 /// <param name="gl">The OpenGL render context.</param>
 /// <param name="tranformation">The <see cref="SharpGL.SceneGraph.Transformations.LinearTransformation"/> to apply</param>
 public void PushObjectSpace(OpenGL gl, LinearTransformation tranformation)
 {
     gl.PushMatrix();
     tranformation.Transform(gl);
     Rotate(gl);
 }
コード例 #8
0
ファイル: RotateTransform.cs プロジェクト: chances/Animatum
 /// <summary>
 /// Push a new object space onto the stack and then apply a <see cref="SharpGL.SceneGraph.Transformations.LinearTransformation"/>.
 /// </summary>
 /// <param name="gl">The OpenGL render context.</param>
 /// <param name="tranformation">The <see cref="SharpGL.SceneGraph.Transformations.LinearTransformation"/> to apply</param>
 public void PushObjectSpace(OpenGL gl, LinearTransformation tranformation)
 {
     gl.PushMatrix();
     tranformation.Transform(gl);
     Rotate(gl);
 }