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()); }
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); }
public void Activate() { try { UIPositionManager uIPositionManager = viewControl.GetUIPositionManager(); ViewerControlIfc sMViewerControl = viewControl.GetSMViewerControl(); bool flag = false; if (sourceMap.lastView is SourceMapRegistrationView) { try { SourceMapRegistrationView sourceMapRegistrationView = (SourceMapRegistrationView)sourceMap.lastView; if (sourceMapRegistrationView.locked) { if (sourceMap.ReadyToLock()) { SetupLockedView(); uIPositionManager.GetVEPos() .setPosition(sourceMapRegistrationView.GetReferenceMapView()); flag = true; } } else { SetupUnlockedView(); uIPositionManager.GetSMPos().setPosition(sourceMapRegistrationView.GetSourceMapView()); uIPositionManager.GetVEPos().setPosition(sourceMapRegistrationView.GetReferenceMapView()); flag = true; } viewControl.SetVEMapStyle(sourceMapRegistrationView.GetReferenceMapView().style); } catch (CorrespondencesAreSingularException) { } catch (InsufficientCorrespondencesException) { } } if (!flag) { SetupUnlockedView(); uIPositionManager.GetSMPos().setPosition(new ContinuousCoordinateSystem().GetDefaultView()); uIPositionManager.GetVEPos().setPosition(DefaultReferenceMapPosition(drv)); } uIPositionManager.SetPositionMemory(sourceMap); viewControl.SetOptionsPanelVisibility(OptionsPanelVisibility.SourceMapOptions); viewControl.GetSourceMapInfoPanel().Configure(sourceMap); viewControl.GetSourceMapInfoPanel().Enabled = true; viewControl.GetTransparencyPanel().Configure(sourceMap, sMViewerControl); viewControl.GetTransparencyPanel().Enabled = true; viewControl.GetSMViewerControl().SetSnapViewStore(new SourceSnapView(this)); viewControl.GetVEViewerControl().SetSnapViewStore(new RefSnapView(this)); uIPositionManager.PositionUpdated(); } catch (Exception) { Dispose(); throw; } }
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(); }