internal static MapRectangle AddToBoundingBox(MapRectangle box, LatLon ll) { if (box == null) { return new MapRectangle(ll.lat, ll.lon, ll.lat, ll.lon); } return new MapRectangle(Math.Min(ll.lat, box.lat0), Math.Min(ll.lon, box.lon0), Math.Max(ll.lat, box.lat1), Math.Max(ll.lon, box.lon1)); }
public MapRectangle(MashupParseContext context, CoordinateSystemIfc coordSys) { XMLTagReader reader = context.NewTagReader("MapRectangle"); List<LatLon> list = new List<LatLon>(); while (reader.FindNextStartTag()) { if (reader.TagIs(LatLon.GetXMLTag())) { list.Add(new LatLon(context, coordSys)); } } reader.SkipAllSubTags(); if (list.Count != 2) { throw new InvalidMashupFile(context, string.Format("{0} should contain exactly 2 {1} subtags", "MapRectangle", LatLon.GetXMLTag())); } this.ll0 = list[0]; this.ll1 = list[1]; this.AssertOrder(); }
public void lonEdited(double newLon) { LatLon latlon = new LatLon(this.center().llz.lat, newLon); latlon.CheckValid(this.GetCoordinateSystem()); this.center().setPosition(new LatLonZoom(latlon, this.center().llz.zoom)); this.center().ForceInteractiveUpdate(); }
public void UpdatePoint(int index, LatLon newPosition) { this.vertexList[index] = newPosition; this.SetDirty(); }
public MapRectangle(MapRectangle mr) { this.ll0 = mr.ll0; this.ll1 = mr.ll1; this.AssertOrder(); }
public TracedVertex(int originalIndex, LatLon position) { this.originalIndex = originalIndex; this.position = position; }
public static double DistanceInMeters(LatLon p1, LatLon p2) { double num = CoordinateSystemUtilities.DegreesToRadians(p1.lon); double num2 = CoordinateSystemUtilities.DegreesToRadians(p1.lat); double num3 = CoordinateSystemUtilities.DegreesToRadians(p2.lon); double num4 = CoordinateSystemUtilities.DegreesToRadians(p2.lat); double num5 = num3 - num; double num6 = num4 - num2; double d = Math.Pow(Math.Sin(num6 / 2.0), 2.0) + Math.Cos(num2) * Math.Cos(num4) * Math.Pow(Math.Sin(num5 / 2.0), 2.0); double num7 = 2.0 * Math.Asin(Math.Min(1.0, Math.Sqrt(d))); return 6378137.0 * num7; }
public LatLonZoom(MashupParseContext context, CoordinateSystemIfc coordSys) { XMLTagReader xMLTagReader = context.NewTagReader("LatLonZoom"); try { if (context.reader.GetAttribute("zoom") == null) { throw new InvalidLLZ(context, "Missing zoom attribute"); } try { this._zoom = coordSys.GetZoomRange().ParseAllowUndefinedZoom(context, "zoom", context.reader.GetAttribute("zoom")); } catch (InvalidMashupFile invalidMashupFile) { throw new InvalidLLZ(context, invalidMashupFile.Message); } bool flag = false; this._latlon = default(LatLon); while (xMLTagReader.FindNextStartTag()) { if (xMLTagReader.TagIs(LatLon.GetXMLTag())) { this._latlon = new LatLon(context, coordSys); flag = true; } } if (!flag) { throw new InvalidLLZ(context, "Missing LatLong Tag"); } } finally { xMLTagReader.SkipAllSubTags(); } }
public void SetErrorPosition(DisplayablePosition.ErrorMarker errorMarker, LatLon errorPosition) { this._errorPositions[(int)errorMarker] = new ErrorPosition(errorPosition); }
public LatLonZoom(double lat, double lon, int zoom) { this._latlon = new LatLon(lat, lon); this._zoom = zoom; }
public LatLonZoom(LatLon latlon, int zoom) { this._latlon = latlon; this._zoom = zoom; }
public void SetErrorPosition(ErrorMarker errorMarker, LatLon errorPosition) { _errorPositions[(int)errorMarker] = new ErrorPosition(errorPosition); }
public RenderDebug IntersectWithRectangleDebug(MapRectangle mapWindow) { RenderDebug renderDebug = new RenderDebug(); renderDebug.IntersectedVertexList = new List<TracedVertex>(); List<TracedVertex> list = new List<TracedVertex>(); int num = 0; foreach (LatLon current in this.vertexList) { list.Add(new TracedVertex(num, current)); num++; } TracedVertex tracedVertex = list[list.Count - 1]; foreach (TracedVertex current2 in list) { ParametricLine parametricLine = new ParametricLine(tracedVertex.position, current2.position); List<ParametricLine.Intersection> list2 = new List<ParametricLine.Intersection>(); list2.Add(parametricLine.LatitudeIntersection(mapWindow.lat0)); list2.Add(parametricLine.LatitudeIntersection(mapWindow.lat1)); list2.Add(parametricLine.LongitudeIntersection(mapWindow.lon0)); list2.Add(parametricLine.LongitudeIntersection(mapWindow.lon1)); list2.Sort(); foreach (ParametricLine.Intersection current3 in list2) { if (!current3.IsParallel && current3.t > 0.0 && current3.t < 1.0) { LatLon position = parametricLine.t(current3.t); renderDebug.IntersectedVertexList.Add(new TracedVertex(tracedVertex.originalIndex, position)); } } renderDebug.IntersectedVertexList.Add(current2); tracedVertex = current2; } double val; double val2; if (mapWindow.lat1 > mapWindow.lat0) { val = mapWindow.lat0; val2 = mapWindow.lat1; } else { val = mapWindow.lat1; val2 = mapWindow.lat0; } double val3; double val4; if (mapWindow.lon1 > mapWindow.lon0) { val3 = mapWindow.lon0; val4 = mapWindow.lon1; } else { val3 = mapWindow.lon1; val4 = mapWindow.lon0; } renderDebug.FinalClipRegion = new List<TracedVertex>(); tracedVertex = null; foreach (TracedVertex current4 in renderDebug.IntersectedVertexList) { LatLon position2 = current4.position; LatLon position3 = new LatLon(Math.Max(val, Math.Min(position2.lat, val2)), Math.Max(val3, Math.Min(position2.lon, val4))); TracedVertex tracedVertex2 = new TracedVertex(current4.originalIndex, position3); if (tracedVertex == null || tracedVertex.position.lat != tracedVertex2.position.lat || tracedVertex.position.lon != tracedVertex2.position.lon) { renderDebug.FinalClipRegion.Add(tracedVertex2); } tracedVertex = tracedVertex2; } return renderDebug; }
internal void InsertPoint(int index, LatLon newPosition) { this.vertexList.Insert(index, newPosition); this.SetDirty(); }
private PointF MapPositionToPoint(LatLon pos) { Point translationInPixels = this.GetCoordinateSystem().GetTranslationInPixels(this.center().llz, pos); PointF result = new PointF((float)(base.Width / 2 + translationInPixels.X), (float)(base.Height / 2 + translationInPixels.Y)); return result; }
public ParametricLine(LatLon source, LatLon dest) { this.s = source; this.d = dest; }
public static MapRectangle MapRectangleIgnoreOrder(LatLon NW, LatLon SE) { return new MapRectangle { ll0 = new LatLon(SE.lat, NW.lon), ll1 = new LatLon(NW.lat, SE.lon) }; }
public void UpdatePoint(int index, LatLon newPosition) { vertexList[index] = newPosition; SetDirty(); }
public MapRectangle(LatLon NW, LatLon SE) { this.ll0 = new LatLon(SE.lat, NW.lon); this.ll1 = new LatLon(NW.lat, SE.lon); this.AssertOrder(); }
internal void InsertPoint(int index, LatLon newPosition) { vertexList.Insert(index, newPosition); SetDirty(); }
public MapRectangle(double lat0, double lon0, double lat1, double lon1) { this.ll0 = new LatLon(lat0, lon0); this.ll1 = new LatLon(lat1, lon1); this.AssertOrder(); }
public RenderDebug IntersectWithRectangleDebug(MapRectangle mapWindow) { RenderDebug renderDebug = new RenderDebug(); renderDebug.IntersectedVertexList = new List <TracedVertex>(); List <TracedVertex> list = new List <TracedVertex>(); int num = 0; foreach (LatLon current in vertexList) { list.Add(new TracedVertex(num, current)); num++; } TracedVertex tracedVertex = list[list.Count - 1]; foreach (TracedVertex current2 in list) { ParametricLine parametricLine = new ParametricLine(tracedVertex.position, current2.position); List <ParametricLine.Intersection> list2 = new List <ParametricLine.Intersection>(); list2.Add(parametricLine.LatitudeIntersection(mapWindow.lat0)); list2.Add(parametricLine.LatitudeIntersection(mapWindow.lat1)); list2.Add(parametricLine.LongitudeIntersection(mapWindow.lon0)); list2.Add(parametricLine.LongitudeIntersection(mapWindow.lon1)); list2.Sort(); foreach (ParametricLine.Intersection current3 in list2) { if (!current3.IsParallel && current3.t > 0.0 && current3.t < 1.0) { LatLon position = parametricLine.t(current3.t); renderDebug.IntersectedVertexList.Add(new TracedVertex(tracedVertex.originalIndex, position)); } } renderDebug.IntersectedVertexList.Add(current2); tracedVertex = current2; } double val; double val2; if (mapWindow.lat1 > mapWindow.lat0) { val = mapWindow.lat0; val2 = mapWindow.lat1; } else { val = mapWindow.lat1; val2 = mapWindow.lat0; } double val3; double val4; if (mapWindow.lon1 > mapWindow.lon0) { val3 = mapWindow.lon0; val4 = mapWindow.lon1; } else { val3 = mapWindow.lon1; val4 = mapWindow.lon0; } renderDebug.FinalClipRegion = new List <TracedVertex>(); tracedVertex = null; foreach (TracedVertex current4 in renderDebug.IntersectedVertexList) { LatLon position2 = current4.position; LatLon position3 = new LatLon(Math.Max(val, Math.Min(position2.lat, val2)), Math.Max(val3, Math.Min(position2.lon, val4))); TracedVertex tracedVertex2 = new TracedVertex(current4.originalIndex, position3); if (tracedVertex == null || tracedVertex.position.lat != tracedVertex2.position.lat || tracedVertex.position.lon != tracedVertex2.position.lon) { renderDebug.FinalClipRegion.Add(tracedVertex2); } tracedVertex = tracedVertex2; } return(renderDebug); }
public ErrorPosition(LatLon latlon) { this.latlon = latlon; }
public ParametricLine(LatLon source, LatLon dest) { s = source; d = dest; }