Esempio n. 1
0
        /// <summary>
        /// Rotate the coordinate map by the given number of degrees
        /// </summary>
        /// <param name="degrees"></param>
        public void Rotate(Double degrees)
        {
            /**
             * create a new point some ways off from our reference point
             */
            PointD newPoint = _pixelReferencePoint.Clone() as PointD;

            newPoint.X += 100;

            /**
             * save the lat and long of the new point
             */
            GeoPoint geoPoint = GetGeoPoint(newPoint);

            /**
             * rotate the new point about our reference point
             */
            newPoint.Rotate(_pixelReferencePoint, degrees);

            GeoPointList geoPoints = new GeoPointList()
            {
                _geoReferencePoint, geoPoint
            };
            PointDList pixPoints = new PointDList()
            {
                _pixelReferencePoint, newPoint
            };

            /**
             * Reinitialize ourself with the new rotation
             */
            Initialize(pixPoints, geoPoints);
        }
Esempio n. 2
0
 public GeoSquare(GeoPointList points)
     : base(points)
 {
     if (Diagonals[0].Length != Diagonals[1].Length)
     {
         throw new GeometryException("Trying to create square with invalid shape (Diaganols != )");
     }
 }
Esempio n. 3
0
 public GeoRectangle(GeoPointList points)
     : base(new GeoPointList() { points.NorthWest, points.NorthEast, points.SouthEast, points.SouthWest })
 {
     if (points.Count != 4)
     {
         throw new InvalidOperationException("GeoRectangle MUST consist of four points");
     }
 }
Esempio n. 4
0
        public GeoPointList GetGeoPointList(PointDList pixPointList)
        {
            GeoPointList retVal = new GeoPointList();

            foreach (PointD pt in pixPointList)
            {
                retVal.Add(GetGeoPoint(pt));
            }
            return(retVal);
        }
Esempio n. 5
0
        public static GeoPointList WestToEast(GeoPointList list)
        {
            GeoPointList fromList = new GeoPointList(list);
            GeoPointList retList  = new GeoPointList();

            while (fromList.Count > 0)
            {
                retList.Add(WestMost(fromList));
                fromList.Remove(retList.Last());
            }
            return(retList);
        }
Esempio n. 6
0
        public static GeoPointList SouthToNorth(GeoPointList list)
        {
            GeoPointList fromList = new GeoPointList(list);
            GeoPointList retList  = new GeoPointList();

            while (fromList.Count > 0)
            {
                retList.Add(SouthMost(fromList));
                fromList.Remove(retList.Last());
            }
            return(retList);
        }
Esempio n. 7
0
        public GeoPolygon ToGeoPolygon(int sides = 16)
        {
            GeoPointList points    = new GeoPointList();
            Double       angleSize = (360 / (Double)sides);

            for (Double degrees = 0; degrees < 360; degrees += angleSize)
            {
                points.Add(EarthGeo.GetPoint(_center, Radius, degrees));
            }

            GeoPolygon polygon = new GeoPolygon(points);

            return(polygon);
        }
Esempio n. 8
0
        public bool ContainsAnyPoint(GeoPointList points, Double rayLength = DEFAULT_RAY_LENGTH)
        {
            bool result = false;

            foreach (GeoPoint point in points)
            {
                if (Contains(point, rayLength))
                {
                    result = true;
                    break;
                }
            }
            return(result);
        }
Esempio n. 9
0
        public static GeoPoint WestMost(GeoPointList list)
        {
            GeoPoint ret = null;

            foreach (GeoPoint point in list)
            {
                if (ret == null || point.IsWestOf(ret))
                {
                    ret = point;
                }
            }

            return(ret);
        }
Esempio n. 10
0
        public static LineList GeoPointsToLineList(GeoPointList points)
        {
            LineList lines = new LineList();

            GeoPoint lastPoint = null;

            foreach (GeoPoint point in points)
            {
                if (lastPoint != null)
                {
                    lines.Add(new Line(lastPoint, point));
                }
                lastPoint = point;
            }

            return(lines);
        }
Esempio n. 11
0
        void Initialize(PointDList pixPointList, GeoPointList geoPointList)
        {
            // Get and store the difference in pixel orientation to north (Rotation from north)
            double geoBearing = EarthGeo.GetBearing(geoPointList[0], geoPointList[1]);
            double pixBearing = GetPixelBearing(pixPointList[0], pixPointList[1]);

            this.BearingDelta = geoBearing - pixBearing;


            // Get and store the pixel to meter ratio (Scale to meters)
            double geoDistance = EarthGeo.GetDistance(geoPointList[0], geoPointList[1]);
            double pixDistance = new Line(pixPointList[0], pixPointList[1]).Length;

            _pixelsPerMeter = pixDistance / geoDistance;

            // Store a pixel cross reference point, from which all other conversions can happen
            this.PixPoint = new PointD(pixPointList[0].X, pixPointList[0].Y);
            this.GeoPoint = new GeoPoint(geoPointList[0].Y, geoPointList[0].X);
        }
Esempio n. 12
0
 public GeoLineList(GeoPointList points)
     : base(points.ToGeoLineList())
 {
 }
Esempio n. 13
0
 public CoordinateMap(PointDList pixPointList, GeoPointList geoPointList)
 {
     Initialize(pixPointList, geoPointList);
 }
Esempio n. 14
0
 public GeoPath(GeoPointList points)
     : base(points)
 {
 }
Esempio n. 15
0
 public GeoPolygon(GeoPointList points)
 {
     _points = points;
 }