Пример #1
0
        public static Cartesian3DPoint <T> GeodeticToAverage <T>(IGeodeticPoint geodetic)
            where T : LinearUnit, new()
        {
            //check if not geodetic is Right Handed
            Cartesian3DPoint <T> semiGeodetic = geodetic.ToCartesian <T>();

            double tempOrigionX = geodetic.Datum.DatumTranslation.X.ChangeTo <T>().Value;

            double tempOrigionY = geodetic.Datum.DatumTranslation.Y.ChangeTo <T>().Value;

            double tempOrigionZ = geodetic.Datum.DatumTranslation.Z.ChangeTo <T>().Value;

            Matrix rotationMatrix = Transformation.CalculateEulerElementMatrix(geodetic.Datum.DatumMisalignment);

            Matrix transferMatrix = new Matrix(new double[][] { new double[] { tempOrigionX, tempOrigionY, tempOrigionZ } });

            Matrix tempSemiGeodetic = new Matrix(new double[][] { new double[] { semiGeodetic.X.Value,
                                                                                 semiGeodetic.Y.Value,
                                                                                 semiGeodetic.Z.Value } });

            Matrix tempResult = rotationMatrix * tempSemiGeodetic + transferMatrix;

            return(new Cartesian3DPoint <T>(new T()
            {
                Value = tempResult[0, 0]
            },
                                            new T()
            {
                Value = tempResult[1, 0]
            },
                                            new T()
            {
                Value = tempResult[2, 0]
            }));
        }
Пример #2
0
        public static Cartesian3D <T> LocalGeodeticToGeodetic <T>(ICartesian3D localGeodetic,
                                                                  IGeodeticPoint initialPoint)
            where T : LinearUnit, new()
        {
            //local geodetic is lefthanded
            Cartesian3DPoint <T> shift = Transformation.GeodeticToAverage <T>(initialPoint);

            Matrix rZ = CalculateRotationMatrixAroundZ(new Radian(Math.PI).Subtract(initialPoint.Longitude));

            Matrix rY = CalculateRotationMatrixAroundY(new Radian(Math.PI / 2).Subtract(initialPoint.Latitude));

            Matrix p2 = CalculateReflectionMatrix();

            //G is Right Handed
            return(localGeodetic.Transform(rZ * rY * p2, shift.Negate(), AxisType.RightHanded).ChangeTo <T>());
        }
Пример #3
0
        public Ellipsoid(string name, LinearUnit semiMajorAxis, double inverseFlattening,
                         ICartesian3DPoint datumTranslation, OrientationParameter datumMisalignment, int srid)
        {
            this._datumTranslation = new Cartesian3DPoint <TLinear>(datumTranslation.X, datumTranslation.Y, datumTranslation.Z);

            this._datumMisalignment = new OrientationParameter(datumMisalignment.Omega.ChangeTo <TAngular>(),
                                                               datumMisalignment.Phi.ChangeTo <TAngular>(),
                                                               datumMisalignment.Kappa.ChangeTo <TAngular>());

            this._name = name;

            this._srid = srid;

            this._semiMajorAxis = semiMajorAxis.ChangeTo <TLinear>();

            double tempSemiMajor = this._semiMajorAxis.Value;

            if (inverseFlattening == 0)
            {
                this._semiMinorAxis = new TLinear()
                {
                    Value = tempSemiMajor
                };
            }
            else
            {
                this._semiMinorAxis = new TLinear()
                {
                    Value = tempSemiMajor - tempSemiMajor / inverseFlattening
                };
            }

            double tempSemiMinor = this._semiMinorAxis.Value;

            this._firstEccentricity = Math.Sqrt((tempSemiMajor * tempSemiMajor - tempSemiMinor * tempSemiMinor)
                                                /
                                                (tempSemiMajor * tempSemiMajor));

            this._secondEccentricity = Math.Sqrt((tempSemiMajor * tempSemiMajor - tempSemiMinor * tempSemiMinor)
                                                 /
                                                 (tempSemiMinor * tempSemiMinor));

            this.EsriName = string.Empty;
        }