예제 #1
0
파일: BusinessLogic.cs 프로젝트: VsPun/DPP
        public IPoint ProjectWgsToPulkovoWithGeoTransformation(IPoint inputPoint, CoordinateSystemModel coordinateSystemModel, esriTransformDirection transformationDirection)
        {
            if (inputPoint == null)
            {
                return(null);
            }

            var bufferPoint = new PointClass {
                X = inputPoint.X, Y = inputPoint.Y, SpatialReference = inputPoint.SpatialReference
            };

            //Create Spatial Reference Factory
            var spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
            var targetSpatialReference  = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID);

            var coordinateFrameGeoTransformation = new CoordinateFrameTransformationClass();

            coordinateFrameGeoTransformation.PutSpatialReferences(bufferPoint.SpatialReference, targetSpatialReference);
            coordinateFrameGeoTransformation.PutParameters(Constants.PulkovoToWGS.XAxisTranslation,
                                                           Constants.PulkovoToWGS.YAxisTranslation,
                                                           Constants.PulkovoToWGS.ZAxisTranslation,
                                                           Constants.PulkovoToWGS.XAxisRotation,
                                                           Constants.PulkovoToWGS.YAxisRotation,
                                                           Constants.PulkovoToWGS.ZAxisRotation,
                                                           Constants.PulkovoToWGS.ScaleDifference);

            var geometry = bufferPoint as IGeometry5;

            geometry.ProjectEx(targetSpatialReference, transformationDirection, coordinateFrameGeoTransformation, false, 0.0, 0.0);

            return(geometry as IPoint);
        }
예제 #2
0
파일: BusinessLogic.cs 프로젝트: VsPun/DPP
        public IPoint CreatePoint(double X, double Y, CoordinateSystemModel geoModel, bool createGeoCoordinateSystem = false)
        {
            var resultPoint = new PointClass();

            resultPoint.PutCoords(X, Y);
            //Create Spatial Reference Factory
            var spatialReferenceFactory = new SpatialReferenceEnvironmentClass();

            ISpatialReference spatialReference;

            if (createGeoCoordinateSystem)
            {
                //Geographical Coordinate System
                spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(geoModel.ESRIWellKnownID);
            }
            else
            {
                //Projected Coordinate System to project into
                spatialReference = spatialReferenceFactory.CreateProjectedCoordinateSystem(geoModel.ESRIWellKnownID);
            }
            spatialReference.SetFalseOriginAndUnits(geoModel.FalseOriginX, geoModel.FalseOriginY, geoModel.Units);

            resultPoint.SpatialReference = spatialReference;

            return(resultPoint);
        }
예제 #3
0
        public IPoint ProjectPoint(IPoint inputPoint, CoordinateSystemModel singleProjectionModel)
        {
            if (inputPoint == null)
            {
                return(null);
            }

            var bufferPoint = new PointClass {
                X = inputPoint.X, Y = inputPoint.Y, SpatialReference = inputPoint.SpatialReference
            };

            //Create Spatial Reference Factory
            var spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
            //Projected Coordinate System to project into
            var projectedCoordinateSystem =
                spatialReferenceFactory.CreateProjectedCoordinateSystem(singleProjectionModel.ESRIWellKnownID);

            projectedCoordinateSystem.SetFalseOriginAndUnits(
                singleProjectionModel.FalseOriginX,
                singleProjectionModel.FalseOriginY,
                singleProjectionModel.Units);

            bufferPoint.Project(projectedCoordinateSystem);

            return(bufferPoint);
        }
예제 #4
0
        public IPoint ConvertToDecimalDegrees(IPoint point, CoordinateSystemModel coordinateSystemModel)
        {
            var spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
            //Create Spatial Reference
            ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID);

            spatialReference.SetFalseOriginAndUnits(coordinateSystemModel.FalseOriginX, coordinateSystemModel.FalseOriginY, coordinateSystemModel.Units);
            point.Project(spatialReference);

            return(point);
        }
예제 #5
0
파일: BusinessLogic.cs 프로젝트: VsPun/DPP
        public IPoint ConvertFromUtm(string utmInputValue, CoordinateSystemModel coordinateSystemModel)
        {
            var resultPoint = new Point();
            //Create Spatial Reference Factory
            var spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
            //Create Spatial Reference
            ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID);

            spatialReference.SetFalseOriginAndUnits(coordinateSystemModel.FalseOriginX, coordinateSystemModel.FalseOriginY, coordinateSystemModel.Units);
            resultPoint.SpatialReference = spatialReference;
            (resultPoint as IConversionNotation).PutCoordsFromUTM(esriUTMConversionOptionsEnum.esriUTMAddSpaces, utmInputValue);
            return(resultPoint);
        }
예제 #6
0
파일: BusinessLogic.cs 프로젝트: VsPun/DPP
        public IPoint ConvertFromMgrs(string mgrsInputValue, CoordinateSystemModel coordinateSystemModel)
        {
            var resultPoint = new Point();
            //Create Spatial Reference Factory
            var spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
            //Create Spatial Reference
            ISpatialReference spatialReference = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID);

            spatialReference.SetFalseOriginAndUnits(coordinateSystemModel.FalseOriginX, coordinateSystemModel.FalseOriginY, coordinateSystemModel.Units);
            resultPoint.SpatialReference = spatialReference;
            (resultPoint as IConversionMGRS).PutCoordsFromMGRS(mgrsInputValue, esriMGRSModeEnum.esriMGRSMode_Automatic);
            return(resultPoint);
        }
예제 #7
0
        public IPoint ProjectWgsToUrkaine2000WithGeoTransformation(
            IPoint inputPoint,
            CoordinateSystemModel coordinateSystemModel,
            esriTransformDirection transformationDirection)
        {
            if (inputPoint == null)
            {
                return(null);
            }

            var bufferPoint = new PointClass {
                X = inputPoint.X, Y = inputPoint.Y, SpatialReference = inputPoint.SpatialReference
            };

            //Create Spatial Reference Factory
            var spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
            var targetSpatialReference  = spatialReferenceFactory.CreateGeographicCoordinateSystem(coordinateSystemModel.ESRIWellKnownID);

            var compositeGeoTransformation  = new CompositeGeoTransformationClass();
            var predefinedGeoTransformation =
                spatialReferenceFactory.CreateGeoTransformation(Constants.ItrfToWgsGeoTransformationID) as IGeoTransformation;

            compositeGeoTransformation.Add(esriTransformDirection.esriTransformReverse, predefinedGeoTransformation);

            var coordinateFrameGeoTransformation = new CoordinateFrameTransformationClass();
            var itrfSpatialReference             =
                spatialReferenceFactory.CreateSpatialReference((int)esriSRGeoCS3Type.esriSRGeoCS_IERSTerrestrialReferenceFrame2000);

            coordinateFrameGeoTransformation.PutSpatialReferences(itrfSpatialReference, targetSpatialReference);
            coordinateFrameGeoTransformation.PutParameters(
                Constants.UkraineToItrf.XAxisTranslation,
                Constants.UkraineToItrf.YAxisTranslation,
                Constants.UkraineToItrf.ZAxisTranslation,
                Constants.UkraineToItrf.XAxisRotation,
                Constants.UkraineToItrf.YAxisRotation,
                Constants.UkraineToItrf.ZAxisRotation,
                Constants.UkraineToItrf.ScaleDifference);
            compositeGeoTransformation.Add(esriTransformDirection.esriTransformForward, coordinateFrameGeoTransformation);

            var geometry = bufferPoint as IGeometry5;

            geometry.ProjectEx(targetSpatialReference, transformationDirection, compositeGeoTransformation, false, 0.0, 0.0);

            return(geometry as IPoint);
        }