Esempio n. 1
0
        public Region GetClipRegion(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
        {
            if (csi is MercatorCoordinateSystem)
            {
                Region region = null;
                for (int i = -360; i <= 0; i += 360)
                {
                    MapRectangle clippedMapWindow = new MapRectangle(mapWindow.lat0,
                                                                     mapWindow.lon0 + i,
                                                                     mapWindow.lat1,
                                                                     mapWindow.lon1 + i);
                    Region clipRegionComponent = GetClipRegionComponent(clippedMapWindow, zoom, csi);
                    if (region == null)
                    {
                        region = clipRegionComponent;
                    }
                    else
                    {
                        region.Union(clipRegionComponent);
                    }
                }

                return(region);
            }

            return(GetClipRegionComponent(mapWindow, zoom, csi));
        }
Esempio n. 2
0
        internal static LatLonZoom DefaultReferenceMapPosition(SourceMap sourceMap,
                                                               MapTileSourceFactory mapTileSourceFactory, ViewControlIfc viewControl, DefaultReferenceView drv)
        {
            if (sourceMap.ReadyToLock())
            {
                try
                {
                    ViewerControlIfc    sMViewerControl               = viewControl.GetSMViewerControl();
                    MapRectangle        bounds                        = sMViewerControl.GetBounds();
                    WarpedMapTileSource warpedMapTileSource           = mapTileSourceFactory.CreateWarpedSource(sourceMap);
                    IPointTransformer   sourceToDestLatLonTransformer =
                        warpedMapTileSource.GetSourceToDestLatLonTransformer();
                    MapRectangle mapRectangle = bounds.Transform(sourceToDestLatLonTransformer);
                    mapRectangle = mapRectangle.ClipTo(new MapRectangle(-180.0, -360.0, 180.0, 360.0));
                    return(viewControl.GetVEViewerControl().GetCoordinateSystem()
                           .GetBestViewContaining(mapRectangle, sMViewerControl.Size));
                }
                catch (CorrespondencesAreSingularException)
                {
                }
                catch (InsufficientCorrespondencesException)
                {
                }
            }

            if (drv != null && drv.present)
            {
                return(drv.llz);
            }

            return(viewControl.GetVEViewerControl().GetCoordinateSystem().GetDefaultView());
        }
Esempio n. 3
0
        //[CompilerGenerated]
        //private static Comparison<ThumbnailRecord> <>9__CachedAnonymousMethodDelegate1;

        public SourceMapRecord(Layer layer, SourceMap sourceMap, MapTileSourceFactory mapTileSourceFactory)
        {
            displayName      = sourceMap.displayName;
            sourceMapInfo    = sourceMap.sourceMapInfo;
            userBoundingRect = sourceMap.GetUserBoundingBox(mapTileSourceFactory);
            maxZoom          = sourceMap.sourceMapRenderOptions.maxZoom;
            try
            {
                imageTransformer =
                    sourceMap.registration.warpStyle.getImageTransformer(sourceMap.registration,
                                                                         InterpolationMode.Invalid);
            }
            catch (Exception)
            {
            }

            foreach (Legend current in sourceMap.legendList)
            {
                legendRecords.Add(new LegendRecord("legends",
                                                   sourceMap.GetLegendFilename(current),
                                                   current.displayName,
                                                   current.GetOutputSizeSynchronously(mapTileSourceFactory.CreateDisplayableUnwarpedSource(sourceMap)
                                                                                      .GetUserBounds(current.latentRegionHolder, FutureFeatures.Cached))));
            }

            sourceMapLegendFrame = new SourceMapLegendFrame(layer,
                                                            sourceMap,
                                                            legendRecords,
                                                            thumbnailForLegendFrame);
        }
Esempio n. 4
0
 internal void AccumulateBoundingBox(ref MapRectangle boundingBox)
 {
     foreach (LatLon current in vertexList)
     {
         boundingBox = MapRectangle.AddToBoundingBox(boundingBox, current);
     }
 }
Esempio n. 5
0
        internal MapRectangle GetBoundingBox()
        {
            MapRectangle result = null;

            AccumulateBoundingBox(ref result);
            return(result);
        }
Esempio n. 6
0
        public bool intersects(MapRectangle othr)
        {
            bool flag  = ((betweenInclusive(this.ll0.lat, othr.ll0.lat, othr.ll1.lat) || betweenInclusive(this.ll1.lat, othr.ll0.lat, othr.ll1.lat)) || betweenInclusive(othr.ll0.lat, this.ll0.lat, this.ll1.lat)) || betweenInclusive(othr.ll1.lat, this.ll0.lat, this.ll1.lat);
            bool flag2 = ((betweenInclusive(this.ll0.lon, othr.ll0.lon, othr.ll1.lon) || betweenInclusive(this.ll1.lon, othr.ll0.lon, othr.ll1.lon)) || betweenInclusive(othr.ll0.lon, this.ll0.lon, this.ll1.lon)) || betweenInclusive(othr.ll1.lon, this.ll0.lon, this.ll1.lon);

            return(flag && flag2);
        }
Esempio n. 7
0
        public MapRectangle GetUserBoundingBox(MapTileSourceFactory mapTileSourceFactory)
        {
            WarpedMapTileSource warpedMapTileSource = null;

            try
            {
                warpedMapTileSource = mapTileSourceFactory.CreateWarpedSource(this);
            }
            catch (InsufficientCorrespondencesException)
            {
            }
            if (warpedMapTileSource == null)
            {
                return(null);
            }
            Present present = warpedMapTileSource.GetUserBounds(null, FutureFeatures.Cached).Realize("SourceMap.AutoSelectMaxZoom");

            if (!(present is BoundsPresent))
            {
                return(null);
            }
            BoundsPresent boundsPresent = (BoundsPresent)present;
            MapRectangle  boundingBox   = boundsPresent.GetRenderRegion().GetBoundingBox();

            return(boundingBox.ClipTo(CoordinateSystemUtilities.GetRangeAsMapRectangle(MercatorCoordinateSystem.theInstance)));
        }
Esempio n. 8
0
        internal LatLonZoom GetDefaultView(Layer layer, Size assumedDisplaySize,
                                           MapTileSourceFactory mapTileSourceFactory, out bool allBoundsValid)
        {
            MapRectangle mapRectangle = null;

            allBoundsValid = true;
            foreach (SourceMap current in layer)
            {
                if (!AccumulateBoundingBox(current, mapTileSourceFactory, ref mapRectangle))
                {
                    allBoundsValid = false;
                }
            }

            LatLonZoom bestViewContaining;

            if (mapRectangle == null)
            {
                bestViewContaining = MercatorCoordinateSystem.theInstance.GetDefaultView();
            }
            else
            {
                bestViewContaining =
                    MercatorCoordinateSystem.theInstance.GetBestViewContaining(mapRectangle, assumedDisplaySize);
            }

            return(CoordinateSystemUtilities.ConstrainLLZ(MercatorCoordinateSystem.theInstance, bestViewContaining));
        }
Esempio n. 9
0
		public SourceMapRecord(MashupParseContext context)
		{
			this.displayName = context.GetRequiredAttribute("DisplayName");
			XMLTagReader xMLTagReader = context.NewTagReader("SourceMapRecord");
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(SourceMapInfo.GetXMLTag()))
				{
					this.sourceMapInfo = new SourceMapInfo(context, new DirtyEvent());
				}
				else
				{
					if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
					{
						this.userBoundingRect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
					}
					else
					{
						if (xMLTagReader.TagIs(LegendRecord.GetXMLTag()))
						{
							this.legendRecords.Add(new LegendRecord(context));
						}
						else
						{
							if (xMLTagReader.TagIs(SourceMapLegendFrame.GetXMLTag()))
							{
								context.AssertUnique(this.sourceMapLegendFrame);
								this.sourceMapLegendFrame = new SourceMapLegendFrame(context);
							}
						}
					}
				}
			}
		}
Esempio n. 10
0
        public SourceMapRecord(MashupParseContext context)
        {
            this.displayName = context.GetRequiredAttribute("DisplayName");
            XMLTagReader xMLTagReader = context.NewTagReader("SourceMapRecord");

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(SourceMapInfo.GetXMLTag()))
                {
                    this.sourceMapInfo = new SourceMapInfo(context, new DirtyEvent());
                }
                else
                {
                    if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
                    {
                        this.userBoundingRect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
                    }
                    else
                    {
                        if (xMLTagReader.TagIs(LegendRecord.GetXMLTag()))
                        {
                            this.legendRecords.Add(new LegendRecord(context));
                        }
                        else
                        {
                            if (xMLTagReader.TagIs(SourceMapLegendFrame.GetXMLTag()))
                            {
                                context.AssertUnique(this.sourceMapLegendFrame);
                                this.sourceMapLegendFrame = new SourceMapLegendFrame(context);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 11
0
 public RenderRegion(MapRectangle rect, DirtyEvent parentDirty)
 {
     dirtyEvent = new DirtyEvent(parentDirty);
     vertexList.Add(rect.GetNW());
     vertexList.Add(rect.GetSW());
     vertexList.Add(rect.GetSE());
     vertexList.Add(rect.GetNE());
 }
Esempio n. 12
0
		public RenderRegion(MapRectangle rect, DirtyEvent parentDirty)
		{
			this.dirtyEvent = new DirtyEvent(parentDirty);
			this.vertexList.Add(rect.GetNW());
			this.vertexList.Add(rect.GetSW());
			this.vertexList.Add(rect.GetSE());
			this.vertexList.Add(rect.GetNE());
		}
Esempio n. 13
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));
 }
Esempio n. 14
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)));
 }
Esempio n. 15
0
 internal MapRectangle Intersect(MapRectangle other)
 {
     return(new MapRectangle
     {
         ll0 = new LatLon(Math.Max(lat0, other.lat0), Math.Max(lon0, other.lon0)),
         ll1 = new LatLon(Math.Min(lat1, other.lat1), Math.Min(lon1, other.lon1))
     });
 }
Esempio n. 16
0
        internal MapRectangle ClipTo(MapRectangle clipRect)
        {
            double num  = Math.Max(lat0, clipRect.lat0);
            double num2 = Math.Max(lon0, clipRect.lon0);
            double num3 = Math.Max(num, Math.Min(lat1, clipRect.lat1));

            return(new MapRectangle(num, num2, num3, Math.Max(num2, Math.Min(lon1, clipRect.lon1))));
        }
Esempio n. 17
0
        internal MapRectangle GetUserBoundingBox(MapTileSourceFactory mapTileSourceFactory)
        {
            MapRectangle mapRectangle = null;

            foreach (SourceMap current in this.sourceMaps)
            {
                mapRectangle = MapRectangle.Union(mapRectangle, current.GetUserBoundingBox(mapTileSourceFactory));
            }
            return(mapRectangle);
        }
Esempio n. 18
0
        public override bool Equals(object o2)
        {
            MapRectangle rectangle = (MapRectangle)o2;

            if (rectangle == null)
            {
                return(false);
            }
            return(this == rectangle);
        }
Esempio n. 19
0
        internal MapRectangle Transform(IPointTransformer transformer)
        {
            MapRectangle box = null;

            return(AddToBoundingBox(
                       AddToBoundingBox(
                           AddToBoundingBox(AddToBoundingBox(box, transformer.getTransformedPoint(GetSW())),
                                            transformer.getTransformedPoint(GetSE())),
                           transformer.getTransformedPoint(GetNW())),
                       transformer.getTransformedPoint(GetNE())));
        }
        public void Activate()
        {
            ViewerControlIfc  sMViewerControl   = viewControl.GetSMViewerControl();
            UIPositionManager uIPositionManager = viewControl.GetUIPositionManager();

            foreach (SourceMap current in layer.GetBackToFront())
            {
                IDisplayableSource displayableSource = mapTileSourceFactory.CreateDisplayableWarpedSource(current);
                if (displayableSource != null)
                {
                    sMViewerControl.AddLayer(displayableSource);
                }
            }

            uIPositionManager.SetPositionMemory(layer);
            LayerView layerView = (LayerView)layer.lastView;

            viewControl.GetUIPositionManager().switchSlaved();
            if (layerView != null)
            {
                uIPositionManager.GetVEPos().setPosition(layerView.GetReferenceMapView());
                uIPositionManager.GetVEPos().setStyle(layerView.GetReferenceMapView().style);
                return;
            }

            MapRectangle mapRectangle = null;

            try
            {
                mapRectangle = layer.GetUserBoundingBox(mapTileSourceFactory);
            }
            catch (CorrespondencesAreSingularException)
            {
            }
            catch (InsufficientCorrespondencesException)
            {
            }

            LatLonZoom position;

            if (mapRectangle != null)
            {
                Size size = new Size(600, 600);
                position = viewControl.GetVEViewerControl().GetCoordinateSystem()
                           .GetBestViewContaining(mapRectangle, size);
            }
            else
            {
                position = viewControl.GetVEViewerControl().GetCoordinateSystem().GetDefaultView();
            }

            uIPositionManager.GetVEPos().setPosition(position);
        }
Esempio n. 21
0
 internal static MapRectangle Union(MapRectangle box1, MapRectangle box2)
 {
     if (box1 == null)
     {
         return(box2);
     }
     if (box2 == null)
     {
         return(box1);
     }
     return(AddToBoundingBox(AddToBoundingBox(box1, box2.GetSW()), box2.GetNE()));
 }
Esempio n. 22
0
		public RenderClip(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader(RenderClip.GetXMLTag());
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
				{
					context.AssertUnique(this._rect);
					this._rect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
				}
			}
		}
Esempio n. 23
0
        public RenderClip(MashupParseContext context)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(GetXMLTag());

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
                {
                    context.AssertUnique(rect);
                    rect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
                }
            }
        }
Esempio n. 24
0
        private Region GetClipRegionComponent(MapRectangle clippedMapWindow, int zoom, CoordinateSystemIfc csi)
        {
            TracedScreenPoint[] path  = this.GetPath(clippedMapWindow, zoom, csi);
            PointF[]            array = new PointF[path.GetLength(0)];
            for (int i = 0; i < path.GetLength(0); i++)
            {
                array[i] = path[i].pointf;
            }
            GraphicsPath graphicsPath = new GraphicsPath();

            graphicsPath.AddLines(array);
            graphicsPath.CloseFigure();
            return(new Region(graphicsPath));
        }
Esempio n. 25
0
        public TracedScreenPoint[] GetPath(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
        {
            MapRectangle        mapWindow2 = mapWindow.GrowFraction(0.1);
            List <TracedVertex> list       = this.IntersectWithRectangle(mapWindow2);

            TracedScreenPoint[] array = new TracedScreenPoint[list.Count];
            int num = 0;

            foreach (TracedVertex current in list)
            {
                array[num] = new TracedScreenPoint(current.originalIndex, csi.GetTranslationInPixels(new LatLonZoom(mapWindow.GetNW().lat, mapWindow.GetNW().lon, zoom), current.position));
                num++;
            }
            return(array);
        }
Esempio n. 26
0
        public void UnlockMaps()
        {
            if (!this.mapsLocked)
            {
                throw new Exception("uh oh.  trying to unlock maps that are already unlocked!");
            }
            this.SetupUnlockedView();
            ViewerControlIfc    sMViewerControl               = this.viewControl.GetSMViewerControl();
            MapRectangle        bounds                        = this.viewControl.GetVEViewerControl().GetBounds();
            WarpedMapTileSource warpedMapTileSource           = this.mapTileSourceFactory.CreateWarpedSource(this.sourceMap);
            IPointTransformer   destLatLonToSourceTransformer = warpedMapTileSource.GetDestLatLonToSourceTransformer();
            MapRectangle        newBounds                     = bounds.Transform(destLatLonToSourceTransformer);
            LatLonZoom          latLonZoom                    = sMViewerControl.GetCoordinateSystem().GetBestViewContaining(newBounds, sMViewerControl.Size);

            latLonZoom = CoordinateSystemUtilities.ConstrainLLZ(ContinuousCoordinateSystem.theInstance, latLonZoom);
            this.viewControl.GetUIPositionManager().GetSMPos().setPosition(latLonZoom);
            this.viewControl.GetUIPositionManager().PositionUpdated();
        }
Esempio n. 27
0
        //[CompilerGenerated]
        //private static Comparison<ThumbnailRecord> <>9__CachedAnonymousMethodDelegate1;
		
        public SourceMapRecord(Layer layer, SourceMap sourceMap, MapTileSourceFactory mapTileSourceFactory)
		{
			this.displayName = sourceMap.displayName;
			this.sourceMapInfo = sourceMap.sourceMapInfo;
			this.userBoundingRect = sourceMap.GetUserBoundingBox(mapTileSourceFactory);
			this.maxZoom = sourceMap.sourceMapRenderOptions.maxZoom;
			try
			{
				this.imageTransformer = sourceMap.registration.warpStyle.getImageTransformer(sourceMap.registration, InterpolationMode.Invalid);
			}
			catch (Exception)
			{
			}
			foreach (Legend current in sourceMap.legendList)
			{
				this.legendRecords.Add(new LegendRecord("legends", sourceMap.GetLegendFilename(current), current.displayName, current.GetOutputSizeSynchronously(mapTileSourceFactory.CreateDisplayableUnwarpedSource(sourceMap).GetUserBounds(current.latentRegionHolder, FutureFeatures.Cached))));
			}
			this.sourceMapLegendFrame = new SourceMapLegendFrame(layer, sourceMap, this.legendRecords, new SourceMapLegendFrame.ThumbnailDelegate(this.thumbnailForLegendFrame));
		}
Esempio n. 28
0
 public void AutoSelectMaxZoom(MapTileSourceFactory mapTileSourceFactory)
 {
     if (this.sourceMapRenderOptions.maxZoom == -1)
     {
         MapRectangle userBoundingBox = this.GetUserBoundingBox(mapTileSourceFactory);
         if (userBoundingBox == null)
         {
             return;
         }
         Size         size = new Size(600, 600);
         LatLonZoom   bestViewContaining = new MercatorCoordinateSystem().GetBestViewContaining(userBoundingBox, size);
         IntParameter intParameter       = (IntParameter)mapTileSourceFactory.CreateUnwarpedSource(this).GetImageDetailPrototype(FutureFeatures.Cached).Curry(new ParamDict(new object[]
         {
             TermName.ImageDetail,
             new SizeParameter(size)
         })).Realize("SourceMap.AutoSelectMaxZoom");
         this.sourceMapRenderOptions.maxZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().Constrain(bestViewContaining.zoom + intParameter.value + BuildConfig.theConfig.autoMaxZoomOffset);
     }
 }
Esempio n. 29
0
        internal bool AccumulateBoundingBox(SourceMap sourceMap, MapTileSourceFactory mapTileSourceFactory,
                                            ref MapRectangle boundingBox)
        {
            bool result;

            try
            {
                WarpedMapTileSource warpedMapTileSource = mapTileSourceFactory.CreateWarpedSource(sourceMap);
                BoundsPresent       boundsPresent       = (BoundsPresent)warpedMapTileSource
                                                          .GetUserBounds(null, FutureFeatures.Cached).Realize("CrunchedFile.AccumulateBoundingBox");
                boundsPresent.GetRenderRegion().AccumulateBoundingBox(ref boundingBox);
                result = true;
            }
            catch (InsufficientCorrespondencesException)
            {
                result = false;
            }

            return(result);
        }
Esempio n. 30
0
		public Region GetClipRegion(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
		{
			if (csi is MercatorCoordinateSystem)
			{
				Region region = null;
				for (int i = -360; i <= 0; i += 360)
				{
					MapRectangle clippedMapWindow = new MapRectangle(mapWindow.lat0, mapWindow.lon0 + (double)i, mapWindow.lat1, mapWindow.lon1 + (double)i);
					Region clipRegionComponent = this.GetClipRegionComponent(clippedMapWindow, zoom, csi);
					if (region == null)
					{
						region = clipRegionComponent;
					}
					else
					{
						region.Union(clipRegionComponent);
					}
				}
				return region;
			}
			return this.GetClipRegionComponent(mapWindow, zoom, csi);
		}
Esempio n. 31
0
 public MapRectangle(MapRectangle mr)
 {
     ll0 = mr.ll0;
     ll1 = mr.ll1;
     AssertOrder();
 }
Esempio n. 32
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;
		}
Esempio n. 33
0
		private List<TracedVertex> IntersectWithRectangle(MapRectangle mapWindow)
		{
			RenderDebug renderDebug = this.IntersectWithRectangleDebug(mapWindow);
			return renderDebug.FinalClipRegion;
		}
Esempio n. 34
0
		internal void AccumulateBoundingBox(ref MapRectangle boundingBox)
		{
			foreach (LatLon current in this.vertexList)
			{
				boundingBox = MapRectangle.AddToBoundingBox(boundingBox, current);
			}
		}
Esempio n. 35
0
		internal bool AccumulateBoundingBox(SourceMap sourceMap, MapTileSourceFactory mapTileSourceFactory, ref MapRectangle boundingBox)
		{
			bool result;
			try
			{
				WarpedMapTileSource warpedMapTileSource = mapTileSourceFactory.CreateWarpedSource(sourceMap);
				BoundsPresent boundsPresent = (BoundsPresent)warpedMapTileSource.GetUserBounds(null, FutureFeatures.Cached).Realize("CrunchedFile.AccumulateBoundingBox");
				boundsPresent.GetRenderRegion().AccumulateBoundingBox(ref boundingBox);
				result = true;
			}
			catch (InsufficientCorrespondencesException)
			{
				result = false;
			}
			return result;
		}
Esempio n. 36
0
		public TracedScreenPoint[] GetPath(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
		{
			MapRectangle mapWindow2 = mapWindow.GrowFraction(0.1);
			List<TracedVertex> list = this.IntersectWithRectangle(mapWindow2);
			TracedScreenPoint[] array = new TracedScreenPoint[list.Count];
			int num = 0;
			foreach (TracedVertex current in list)
			{
				array[num] = new TracedScreenPoint(current.originalIndex, csi.GetTranslationInPixels(new LatLonZoom(mapWindow.GetNW().lat, mapWindow.GetNW().lon, zoom), current.position));
				num++;
			}
			return array;
		}
Esempio n. 37
0
        private List <TracedVertex> IntersectWithRectangle(MapRectangle mapWindow)
        {
            RenderDebug renderDebug = IntersectWithRectangleDebug(mapWindow);

            return(renderDebug.FinalClipRegion);
        }
Esempio n. 38
0
 internal MapRectangle Intersect(MapRectangle other)
 {
     return new MapRectangle
     {
         ll0 = new LatLon(Math.Max(this.lat0, other.lat0), Math.Max(this.lon0, other.lon0)),
         ll1 = new LatLon(Math.Min(this.lat1, other.lat1), Math.Min(this.lon1, other.lon1))
     };
 }
Esempio n. 39
0
 public SourceMapRecord(SourceMapInfo sourceMapInfo)
 {
     this.displayName      = "";
     this.sourceMapInfo    = sourceMapInfo;
     this.userBoundingRect = null;
 }
Esempio n. 40
0
		private Region GetClipRegionComponent(MapRectangle clippedMapWindow, int zoom, CoordinateSystemIfc csi)
		{
			TracedScreenPoint[] path = this.GetPath(clippedMapWindow, zoom, csi);
			PointF[] array = new PointF[path.GetLength(0)];
			for (int i = 0; i < path.GetLength(0); i++)
			{
				array[i] = path[i].pointf;
			}
			GraphicsPath graphicsPath = new GraphicsPath();
			graphicsPath.AddLines(array);
			graphicsPath.CloseFigure();
			return new Region(graphicsPath);
		}
Esempio n. 41
0
 internal static MapRectangle Union(MapRectangle box1, MapRectangle box2)
 {
     if (box1 == null)
     {
         return box2;
     }
     if (box2 == null)
     {
         return box1;
     }
     return AddToBoundingBox(AddToBoundingBox(box1, box2.GetSW()), box2.GetNE());
 }
Esempio n. 42
0
 public MapRectangle(MapRectangle mr)
 {
     this.ll0 = mr.ll0;
     this.ll1 = mr.ll1;
     this.AssertOrder();
 }
Esempio n. 43
0
 public bool intersects(MapRectangle othr)
 {
     bool flag = ((betweenInclusive(this.ll0.lat, othr.ll0.lat, othr.ll1.lat) || betweenInclusive(this.ll1.lat, othr.ll0.lat, othr.ll1.lat)) || betweenInclusive(othr.ll0.lat, this.ll0.lat, this.ll1.lat)) || betweenInclusive(othr.ll1.lat, this.ll0.lat, this.ll1.lat);
     bool flag2 = ((betweenInclusive(this.ll0.lon, othr.ll0.lon, othr.ll1.lon) || betweenInclusive(this.ll1.lon, othr.ll0.lon, othr.ll1.lon)) || betweenInclusive(othr.ll0.lon, this.ll0.lon, this.ll1.lon)) || betweenInclusive(othr.ll1.lon, this.ll0.lon, this.ll1.lon);
     return (flag && flag2);
 }
Esempio n. 44
0
 internal MapRectangle ClipTo(MapRectangle clipRect)
 {
     double num = Math.Max(this.lat0, clipRect.lat0);
     double num2 = Math.Max(this.lon0, clipRect.lon0);
     double num3 = Math.Max(num, Math.Min(this.lat1, clipRect.lat1));
     return new MapRectangle(num, num2, num3, Math.Max(num2, Math.Min(this.lon1, clipRect.lon1)));
 }
Esempio n. 45
0
 public MapRectangle(MapRectangle mr)
 {
     this.ll0 = mr.ll0;
     this.ll1 = mr.ll1;
     this.AssertOrder();
 }
Esempio n. 46
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);
        }
Esempio n. 47
0
		public SourceMapRecord(SourceMapInfo sourceMapInfo)
		{
			this.displayName = "";
			this.sourceMapInfo = sourceMapInfo;
			this.userBoundingRect = null;
		}