Пример #1
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)));
        }
Пример #2
0
 private void StoreRenderRegion(Present present)
 {
     if (this.renderRegion == null && present is BoundsPresent)
     {
         BoundsPresent boundsPresent = (BoundsPresent)present;
         this.renderRegion = boundsPresent.GetRenderRegion().Copy(this.dirtyEvent);
         this.boundsChangedEvent.SetDirty();
     }
 }
Пример #3
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);
        }