public MapRectangle GetUserBoundingBox(MapTileSourceFactory mapTileSourceFactory) { WarpedMapTileSource warpedMapTileSource = null; try { warpedMapTileSource = mapTileSourceFactory.CreateWarpedSource(this); } catch (InsufficientCorrespondencesException) { } if (warpedMapTileSource == null) { return(null); } var present = warpedMapTileSource.GetUserBounds(null, FutureFeatures.Cached) .Realize("SourceMap.AutoSelectMaxZoom"); if (!(present is BoundsPresent)) { return(null); } var boundsPresent = (BoundsPresent)present; var boundingBox = boundsPresent.GetRenderRegion().GetBoundingBox(); return(boundingBox.ClipTo( CoordinateSystemUtilities.GetRangeAsMapRectangle(MercatorCoordinateSystem.theInstance))); }
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); }