Exemple #1
0
        /// <summary>
        /// Calculates GPS square from the given centre location using a radius.
        /// </summary>
        /// <param name="Radius">Half of a distance between oposite sides.</param>
        public GpsSquare(GpsLocation Centre, double Radius)
        {
            // We calculate positions of square mid points of top and bottom sides - i.e. points in the center of square sides.
            MidTop    = Centre.GoVector(GpsLocation.BearingNorth, Radius);
            MidBottom = Centre.GoVector(GpsLocation.BearingSouth, Radius);

            // From these mid points, we navigate use West and East bearing to go to the square corners.
            LeftTop     = MidTop.GoVector(GpsLocation.BearingWest, Radius);
            RightTop    = MidTop.GoVector(GpsLocation.BearingEast, Radius);
            LeftBottom  = MidBottom.GoVector(GpsLocation.BearingWest, Radius);
            RightBottom = MidBottom.GoVector(GpsLocation.BearingEast, Radius);
        }
Exemple #2
0
        /// <summary>
        /// Calculates GPS square from the given centre location using a radius.
        /// </summary>
        /// <param name="Radius">Half of a distance between oposite sides.</param>
        /// <returns></returns>
        public GpsSquare GetSquare(double Radius)
        {
            // We calculate positions of square mid points of top and bottom sides - i.e. points in the center of square sides.
            GpsLocation midTop    = GoVector(BearingNorth, Radius);
            GpsLocation midBottom = GoVector(BearingSouth, Radius);

            // From these mid points, we navigate use West and East bearing to go to the square corners.
            GpsLocation leftTop     = midTop.GoVector(BearingWest, Radius);
            GpsLocation rightTop    = midTop.GoVector(BearingEast, Radius);
            GpsLocation leftBottom  = midBottom.GoVector(BearingWest, Radius);
            GpsLocation rightBottom = midBottom.GoVector(BearingEast, Radius);

            GpsSquare res = new GpsSquare(leftTop, rightTop, leftBottom, rightBottom);

            return(res);
        }
Exemple #3
0
        /// <summary>
        /// Basic square constructor.
        /// </summary>
        /// <param name="LeftTop">Location of the left-top corner of the square.</param>
        /// <param name="RightTop">Location of the right-top corner of the square.</param>
        /// <param name="LeftBottom">Location of the left-bottom corner of the square.</param>
        /// <param name="RightBottom">Location of the right-bottom corner of the square.</param>
        public GpsSquare(GpsLocation LeftTop, GpsLocation RightTop, GpsLocation LeftBottom, GpsLocation RightBottom)
        {
            this.LeftTop     = LeftTop;
            this.RightTop    = RightTop;
            this.LeftBottom  = LeftBottom;
            this.RightBottom = RightBottom;

            double bearing  = LeftTop.InitialBearingTo(RightTop);
            double distance = LeftTop.DistanceTo(RightTop) / 2;

            MidTop = LeftTop.GoVector(bearing, distance);

            bearing   = LeftBottom.InitialBearingTo(RightBottom);
            distance  = LeftBottom.DistanceTo(RightBottom) / 2;
            MidBottom = LeftBottom.GoVector(bearing, distance);
        }