Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
		public void UpdatePoint(int index, LatLon newPosition)
		{
			this.vertexList[index] = newPosition;
			this.SetDirty();
		}
Ejemplo n.º 5
0
 public MapRectangle(MapRectangle mr)
 {
     this.ll0 = mr.ll0;
     this.ll1 = mr.ll1;
     this.AssertOrder();
 }
Ejemplo n.º 6
0
 public TracedVertex(int originalIndex, LatLon position)
 {
     this.originalIndex = originalIndex;
     this.position      = position;
 }
Ejemplo n.º 7
0
		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;
		}
Ejemplo n.º 8
0
		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();
			}
		}
Ejemplo n.º 9
0
 public void SetErrorPosition(DisplayablePosition.ErrorMarker errorMarker, LatLon errorPosition)
 {
     this._errorPositions[(int)errorMarker] = new ErrorPosition(errorPosition);
 }
Ejemplo n.º 10
0
		public LatLonZoom(double lat, double lon, int zoom)
		{
			this._latlon = new LatLon(lat, lon);
			this._zoom = zoom;
		}
Ejemplo n.º 11
0
		public LatLonZoom(LatLon latlon, int zoom)
		{
			this._latlon = latlon;
			this._zoom = zoom;
		}
Ejemplo n.º 12
0
 public void SetErrorPosition(ErrorMarker errorMarker, LatLon errorPosition)
 {
     _errorPositions[(int)errorMarker] = new ErrorPosition(errorPosition);
 }
Ejemplo n.º 13
0
		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;
		}
Ejemplo n.º 14
0
		internal void InsertPoint(int index, LatLon newPosition)
		{
			this.vertexList.Insert(index, newPosition);
			this.SetDirty();
		}
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 16
0
		public ParametricLine(LatLon source, LatLon dest)
		{
			this.s = source;
			this.d = dest;
		}
Ejemplo n.º 17
0
 public TracedVertex(int originalIndex, LatLon position)
 {
     this.originalIndex = originalIndex;
     this.position = position;
 }
Ejemplo n.º 18
0
 public LatLonZoom(double lat, double lon, int zoom)
 {
     this._latlon = new LatLon(lat, lon);
     this._zoom   = zoom;
 }
Ejemplo n.º 19
0
		public void SetErrorPosition(DisplayablePosition.ErrorMarker errorMarker, LatLon errorPosition)
		{
			this._errorPositions[(int)errorMarker] = new ErrorPosition(errorPosition);
		}
Ejemplo n.º 20
0
 public LatLonZoom(LatLon latlon, int zoom)
 {
     this._latlon = latlon;
     this._zoom   = zoom;
 }
Ejemplo n.º 21
0
 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)
     };
 }
Ejemplo n.º 22
0
 public void UpdatePoint(int index, LatLon newPosition)
 {
     vertexList[index] = newPosition;
     SetDirty();
 }
Ejemplo n.º 23
0
 public MapRectangle(LatLon NW, LatLon SE)
 {
     this.ll0 = new LatLon(SE.lat, NW.lon);
     this.ll1 = new LatLon(NW.lat, SE.lon);
     this.AssertOrder();
 }
Ejemplo n.º 24
0
 internal void InsertPoint(int index, LatLon newPosition)
 {
     vertexList.Insert(index, newPosition);
     SetDirty();
 }
Ejemplo n.º 25
0
 public MapRectangle(double lat0, double lon0, double lat1, double lon1)
 {
     this.ll0 = new LatLon(lat0, lon0);
     this.ll1 = new LatLon(lat1, lon1);
     this.AssertOrder();
 }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
		public ErrorPosition(LatLon latlon)
		{
			this.latlon = latlon;
		}
Ejemplo n.º 28
0
 public ParametricLine(LatLon source, LatLon dest)
 {
     s = source;
     d = dest;
 }