示例#1
0
        public override Point fromWgs(WgsPoint point)
        {
            double lat = point.getLatitude() * Math.PI / 180.0;
            double lon = point.getLongitude() * Math.PI / 180.0;
            double n   = Math.Pow(wgsMajorAxis, 2) /
                         Math.Sqrt(
                Math.Pow(wgsMajorAxis, 2) * Math.Pow(Math.Cos(lat), 2) +
                (Math.Pow(wgsMinorAxis, 2) * Math.Pow(Math.Sin(lat), 2)));
            double z;

            if (point.getAltitude() == null)
            {
                z = 0;
            }
            else
            {
                z = (double)point.getAltitude();
            }
            double x = (n + z) * Math.Cos(lat) * Math.Cos(lon);
            double y = (n + z) * Math.Cos(lat) * Math.Sin(lon);

            z = ((Math.Pow((wgsMinorAxis / wgsMajorAxis), 2)) * n + z)
                * Math.Sin(point.getLatitude() * Math.PI / 180.0);

            double x_, y_, z_;

            x_ = -dX + (1 + (-1) * e) * (x - rZ * y + rY * z);
            y_ = -dY + (1 + (-1) * e) * (rZ * x + y - rX * z);
            z_ = -dZ + (1 + (-1) * e) * (-rY * x + rX * y + z);

            double p     = Math.Sqrt(Math.Pow(x_, 2) + Math.Pow(y_, 2));
            double theta = Math.Atan((z_ * hayMajorAxis)
                                     / (p * hayMinorAxis));
            double pow_eccentricity = (Math.Pow(hayMajorAxis, 2)
                                       - Math.Pow(hayMinorAxis, 2))
                                      / Math.Pow(hayMajorAxis, 2);
            double pow_second_eccentricity = (Math.Pow(hayMajorAxis, 2)
                                              - Math.Pow(hayMinorAxis, 2))
                                             / Math.Pow(hayMinorAxis, 2);
            double latf = Math.Atan((z_ + pow_second_eccentricity
                                     * hayMinorAxis * Math.Pow(Math.Sin(theta), 3))
                                    / (p - pow_eccentricity * hayMajorAxis
                                       * Math.Pow(Math.Cos(theta), 3)));
            double lonf = Math.Atan(y_ / x_);
            double nf   = Math.Pow(hayMajorAxis, 2) /
                          Math.Sqrt(
                Math.Pow(hayMajorAxis, 2) * Math.Pow(Math.Cos(latf), 2) +
                Math.Pow(hayMinorAxis, 2) * Math.Pow(Math.Sin(latf), 2));
            double hf = (p / Math.Cos(latf)) - nf;

            latf = latf * 180 / Math.PI;
            lonf = lonf * 180 / Math.PI;
            HayPoint _point = new HayPoint(latf, lonf, hf);

            return(_point);
        }
示例#2
0
        public HayPoint(WgsPoint p)
            : base()
        {
            HayPoint hayPoint = new HayPoint();

            hayPoint       = (HayPoint)hayPoint.fromWgs(p);
            this.latitude  = hayPoint.latitude;
            this.longitude = hayPoint.longitude;
            this.altitude  = hayPoint.altitude;
            this.timeZone  = hayPoint.timeZone;
            this.utmX      = hayPoint.utmX;
            this.utmY      = hayPoint.utmY;
        }
示例#3
0
 public HayPoint(WgsPoint p)
     : base()
 {
     HayPoint hayPoint = new HayPoint();
     hayPoint = (HayPoint)hayPoint.fromWgs(p);
     this.latitude = hayPoint.latitude;
     this.longitude = hayPoint.longitude;
     this.altitude = hayPoint.altitude;
     this.timeZone = hayPoint.timeZone;
     this.utmX = hayPoint.utmX;
     this.utmY = hayPoint.utmY;
 }
示例#4
0
        public override Point fromWgs(WgsPoint point)
        {
            double lat = point.getLatitude() * Math.PI / 180.0;
            double lon = point.getLongitude() * Math.PI / 180.0;
            double n = Math.Pow(wgsMajorAxis, 2) /
            Math.Sqrt(
                Math.Pow(wgsMajorAxis, 2) * Math.Pow(Math.Cos(lat), 2) +
                (Math.Pow(wgsMinorAxis, 2) * Math.Pow(Math.Sin(lat), 2)));
            double z;
            if (point.getAltitude() == null)
                z = 0;
            else
                z = (double)point.getAltitude();
            double x = (n + z) * Math.Cos(lat) * Math.Cos(lon);
            double y = (n + z) * Math.Cos(lat) * Math.Sin(lon);
            z = ((Math.Pow((wgsMinorAxis / wgsMajorAxis), 2)) * n + z)
                * Math.Sin(point.getLatitude() * Math.PI / 180.0);

            double x_, y_, z_;

            x_ = -dX + (1 + (-1) * e) * (x - rZ * y + rY * z);
            y_ = -dY + (1 + (-1) * e) * (rZ * x + y - rX * z);
            z_ = -dZ + (1 + (-1) * e) * (-rY * x + rX * y + z);

            double p = Math.Sqrt(Math.Pow(x_, 2) + Math.Pow(y_, 2));
            double theta = Math.Atan((z_ * hayMajorAxis)
                / (p * hayMinorAxis));
            double pow_eccentricity = (Math.Pow(hayMajorAxis, 2)
                - Math.Pow(hayMinorAxis, 2))
                / Math.Pow(hayMajorAxis, 2);
            double pow_second_eccentricity = (Math.Pow(hayMajorAxis, 2)
                - Math.Pow(hayMinorAxis, 2))
                / Math.Pow(hayMinorAxis, 2);
            double latf = Math.Atan((z_ + pow_second_eccentricity
                * hayMinorAxis * Math.Pow(Math.Sin(theta), 3))
                / (p - pow_eccentricity * hayMajorAxis
                * Math.Pow(Math.Cos(theta), 3)));
            double lonf = Math.Atan(y_ / x_);
            double nf = Math.Pow(hayMajorAxis, 2) /
                Math.Sqrt(
                    Math.Pow(hayMajorAxis, 2) * Math.Pow(Math.Cos(latf), 2) +
                    Math.Pow(hayMinorAxis, 2) * Math.Pow(Math.Sin(latf), 2));
            double hf = (p / Math.Cos(latf)) - nf;
            latf = latf * 180 / Math.PI;
            lonf = lonf * 180 / Math.PI;
            HayPoint _point = new HayPoint(latf, lonf, hf);
            return _point;
        }