/// <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); }
public GeoSquare(GeoPointList points) : base(points) { if (Diagonals[0].Length != Diagonals[1].Length) { throw new GeometryException("Trying to create square with invalid shape (Diaganols != )"); } }
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"); } }
public GeoPointList GetGeoPointList(PointDList pixPointList) { GeoPointList retVal = new GeoPointList(); foreach (PointD pt in pixPointList) { retVal.Add(GetGeoPoint(pt)); } return(retVal); }
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); }
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); }
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); }
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); }
public static GeoPoint WestMost(GeoPointList list) { GeoPoint ret = null; foreach (GeoPoint point in list) { if (ret == null || point.IsWestOf(ret)) { ret = point; } } return(ret); }
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); }
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); }
public GeoLineList(GeoPointList points) : base(points.ToGeoLineList()) { }
public CoordinateMap(PointDList pixPointList, GeoPointList geoPointList) { Initialize(pixPointList, geoPointList); }
public GeoPath(GeoPointList points) : base(points) { }
public GeoPolygon(GeoPointList points) { _points = points; }