Esempio n. 1
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. 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();
        }