예제 #1
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));
        }
예제 #2
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();
        }