public GsHistoricalDataLayer() { _logClient = new LogClient(typeof(GsHistoricalDataLayer)); Checked = false; GsExtension extension = GsExtension.GetExtension(); CycloMediaGroupLayer groupLayer = extension.CycloMediaGroupLayer; if (groupLayer != null) { IList <CycloMediaLayer> layers = groupLayer.Layers; foreach (var layer in layers) { if (layer.IsRemoved) { CycloMediaLayerRemoved(layer); } else { CycloMediaLayerAdded(layer); } } } CycloMediaLayer.LayerAddedEvent += CycloMediaLayerAdded; CycloMediaLayer.LayerRemoveEvent += CycloMediaLayerRemoved; }
protected StreetSmart() { ProjectClosedEvent.Subscribe(OnProjectClosed); _currentDispatcher = Dispatcher.CurrentDispatcher; _inRestart = false; _inClose = false; _apiKey = ApiKey.Instance; _settings = Settings.Instance; _constants = ConstantsViewer.Instance; _login = Login.Instance; _login.PropertyChanged += OnLoginPropertyChanged; _configuration = FileConfiguration.Instance; _configuration.PropertyChanged += OnConfigurationPropertyChanged; _openNearest = new List <string>(); _crossCheck = null; _lastSpatialReference = null; _configurationPropertyChanged = new List <string>(); GetVectorLayerListAsync(); ModulestreetSmart streetSmartModule = ModulestreetSmart.Current; _viewerList = streetSmartModule.ViewerList; _measurementList = streetSmartModule.MeasurementList; _cycloMediaGroupLayer = streetSmartModule.CycloMediaGroupLayer; Initialize(); }
protected override void OnUpdate() { try { GsExtension extension = GsExtension.GetExtension(); if (extension != null) { CycloMediaGroupLayer cyclGroupLayer = extension.CycloMediaGroupLayer; bool historicalEnabled = (cyclGroupLayer != null) && cyclGroupLayer.HistoricalLayerEnabled; if (!historicalEnabled && FrmRecordingHistory.IsVisible) { FrmRecordingHistory.CloseForm(); } Enabled = ((ArcMap.Application != null) && extension.Enabled && historicalEnabled); Checked = FrmRecordingHistory.IsVisible; } } catch (Exception ex) { _logClient.Error("GsRecordingHistory.OnUpdate", ex.Message, ex); Trace.WriteLine(ex.Message, "GsRecordingHistory.OnUpdate"); } }
public void RemoveLayer(string name) { if (CycloMediaGroupLayer != null) { CycloMediaGroupLayer.RemoveLayer(name); } }
public GlobeSpotter() { InitializeComponent(); _apiKey = ApiKey.Instance; _settings = FileSettings.Instance; _constants = ConstantsViewer.Instance; _historicalRecordings = HistoricalRecordings.Instance; _login = FileLogin.Instance; _login.PropertyChanged += OnLoginPropertyChanged; _configuration = FileConfiguration.Instance; _configuration.PropertyChanged += OnConfigurationPropertyChanged; _openNearest = new List <string>(); _crossCheck = null; _lastSpatialReference = null; _layers = new List <CycloMediaLayer>(); _startOpenNearest = false; GetVectorLayerListAsync(); ModuleGlobeSpotter globeSpotterModule = ModuleGlobeSpotter.Current; _viewerList = globeSpotterModule.ViewerList; _measurementList = globeSpotterModule.MeasurementList; _cycloMediaGroupLayer = globeSpotterModule.CycloMediaGroupLayer; Initialize(); }
protected RecordingLayer() { IsChecked = false; ModuleStreetSmart streetSmart = ModuleStreetSmart.Current; CycloMediaGroupLayer groupLayer = streetSmart.CycloMediaGroupLayer; _constantsRecordingLayer = ConstantsRecordingLayer.Instance; if (groupLayer != null) { foreach (var layer in groupLayer) { if (layer.IsRemoved) { IsChecked = layer.Name != _constantsRecordingLayer.RecordingLayerName && IsChecked; } else { IsChecked = layer.Name == _constantsRecordingLayer.RecordingLayerName || IsChecked; } } groupLayer.PropertyChanged += OnLayerPropertyChanged; } }
private async void OnImageIdChanged(object sender, TextChangedEventArgs e) { TextBox textBox = sender as TextBox; string imageId = textBox?.Text ?? string.Empty; PaneImageIdSearch paneImageIdSearch = ((dynamic)DataContext); paneImageIdSearch.ImageInfo.Clear(); if (imageId.Length == 8) { ModulestreetSmart streetSmart = ModulestreetSmart.Current; CycloMediaGroupLayer groupLayer = streetSmart.CycloMediaGroupLayer; foreach (var layer in groupLayer) { SpatialReference spatialReference = await layer.GetSpatialReferenceAsync(); string epsgCode = $"EPSG:{spatialReference.Wkid}"; FeatureCollection featureCollection = FeatureCollection.Load(imageId, epsgCode); if (featureCollection.NumberOfFeatures >= 1) { foreach (Recording recording in featureCollection.FeatureMembers.Recordings) { paneImageIdSearch.ImageInfo.Add(recording); } } } } }
public VectorLayerList() { _updateHeight = false; _currentToolId = string.Empty; ModuleStreetSmart modulestreetSmart = ModuleStreetSmart.Current; _measurementList = modulestreetSmart.MeasurementList; _cycloMediaGroupLayer = modulestreetSmart.CycloMediaGroupLayer; EditTool = EditTools.NoEditTool; }
public VectorLayerList() { _updateHeight = false; _currentToolId = string.Empty; GlobeSpotter moduleGlobeSpotter = GlobeSpotter.Current; _measurementList = moduleGlobeSpotter.MeasurementList; _cycloMediaGroupLayer = moduleGlobeSpotter.CycloMediaGroupLayer; EditTool = EditTools.NoEditTool; }
public void RemoveLayers() { if (CycloMediaGroupLayer != null) { GsShowInCyclorama.RemoveFromMenu(); FrmCycloMediaOptions.CloseForm(); FrmMeasurement.Close(); FrmIdentify.Close(); CycloMediaGroupLayer cycloLayer = CycloMediaGroupLayer; CycloMediaGroupLayer = null; cycloLayer.Dispose(); FrmGlobespotter.ShutDown(true); } }
protected override void OnUpdate() { try { GsExtension extension = GsExtension.GetExtension(); IApplication application = ArcMap.Application; Enabled = ((application != null) && extension.Enabled); if (application != null) { var document = application.Document as IMxDocument; if (document != null) { var tocDisplayView = document.CurrentContentsView as TOCDisplayView; if (tocDisplayView != null) { var selectedItem = tocDisplayView.SelectedItem as ILayer; if (selectedItem != null) { _vectorLayer = VectorLayer.GetLayer(selectedItem); CycloMediaGroupLayer cycloMediaGroupLayer = extension.CycloMediaGroupLayer; _cycloMediaLayer = (cycloMediaGroupLayer == null) ? null : cycloMediaGroupLayer.GetLayer(selectedItem); if (_cycloMediaLayer != null) { Checked = _cycloMediaLayer.IsVisibleInGlobespotter; Enabled = _cycloMediaLayer.IsVisible; } if (_vectorLayer != null) { Checked = _vectorLayer.IsVisibleInGlobespotter; Enabled = _vectorLayer.IsVisible; } } } } } } catch (Exception ex) { _logClient.Error("GsShowInCyclorama.OnUpdate", ex.Message, ex); Trace.WriteLine(ex.Message, "GsShowInCyclorama.OnUpdate"); } }
/// <summary> /// This function calculates the imageId for location on the screen /// </summary> /// <param name="arg">The mouse arguments</param> /// <param name="layer">The layer where the point has been found</param> /// <returns>The imageId of the point</returns> private static string GetImageIdFromPoint(MouseEventArgs arg, out CycloMediaLayer layer) { layer = null; string result = string.Empty; GsExtension extension = GsExtension.GetExtension(); if (extension.InsideScale()) { int x = arg.X; int y = arg.Y; CycloMediaGroupLayer cycloMediaGroupLayer = extension.CycloMediaGroupLayer; result = cycloMediaGroupLayer.GetFeatureFromPoint(x, y, out layer); } return(result); }
public void AddLayers(string name) { if (Enabled) { if (CycloMediaGroupLayer == null) { GsShowInCyclorama.AddToMenu(); FrmCycloMediaOptions.CheckOpenCredentials(); CycloMediaGroupLayer = new CycloMediaGroupLayer(); } if (!string.IsNullOrEmpty(name)) { CycloMediaGroupLayer.AddLayer(name); } } }
private void backgroundImageSearch_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled) { var featureMemberElements = e.Result as List <XElement>; if (featureMemberElements != null) { string imageId = txtImageId.Text; GsExtension extension = GsExtension.GetExtension(); CycloMediaGroupLayer groupLayer = extension.CycloMediaGroupLayer; IList <CycloMediaLayer> layers = groupLayer.Layers; foreach (var layer in layers) { if (layer.IsVisible) { layer.SaveFeatureMembers(featureMemberElements, null); IMappedFeature mappedFeature = layer.GetLocationInfo(imageId); var recording = mappedFeature as Recording; if (recording != null) { DateTime? recordedAt = recording.RecordedAt; CultureInfo ci = CultureInfo.InvariantCulture; string recordedAtString = (recordedAt == null) ? string.Empty : ((DateTime)recordedAt).ToString(ci); string imageIdString = recording.ImageId; IFeature feature = layer.GetFeature(imageId); var items = new[] { imageIdString, recordedAtString }; var listViewItem = new ListViewItem(items) { Tag = new object[] { feature, layer } }; lvResults.Items.Add(listViewItem); } } } } } btnFind.Enabled = true; btnCancel.Enabled = true; prSearching.Visible = false; txtImageId.Enabled = true; }
private bool ContainsCycloMediaLayer() { // ReSharper disable UseIndexedProperty bool result = false; IMap map = ArcUtils.Map; var layers = map.get_Layers(); ILayer layer; while ((layer = layers.Next()) != null) { result = ((CycloMediaGroupLayer == null) ? (layer.Name == "CycloMedia") : CycloMediaGroupLayer.IsKnownName(layer.Name)) || result; } // ReSharper restore UseIndexedProperty return(result); }
private void backgroundImageSearch_DoWork(object sender, DoWorkEventArgs e) { Web web = Web.Instance; string imageId = txtImageId.Text; GsExtension extension = GsExtension.GetExtension(); CycloMediaGroupLayer groupLayer = extension.CycloMediaGroupLayer; IList <CycloMediaLayer> layers = groupLayer.Layers; foreach (var layer in layers) { try { List <XElement> featureMemberElements = web.GetByImageId(imageId, layer); e.Result = featureMemberElements; } catch (Exception) { e.Cancel = true; } } }
protected override async void OnUpdate() { MapView mapView = MapView.Active; IReadOnlyList <Layer> layers = mapView?.GetSelectedLayers(); if (layers?.Count == 1) { Layer layer = layers[0]; GlobeSpotter globeSpotter = GlobeSpotter.Current; CycloMediaGroupLayer groupLayer = globeSpotter.CycloMediaGroupLayer; _cycloMediaLayer = groupLayer?.GetLayer(layer); VectorLayerList vectorLayerList = await globeSpotter.GetVectorLayerListAsync(); _vectorLayer = vectorLayerList.GetLayer(layer); if (_cycloMediaLayer != null) { IsChecked = _cycloMediaLayer.IsVisibleInGlobespotter; Enabled = _cycloMediaLayer.IsVisible; } else if (_vectorLayer != null) { IsChecked = _vectorLayer.IsVisibleInGlobespotter; Enabled = _vectorLayer.IsVisible; } else { IsChecked = false; Enabled = false; } } else { Enabled = false; } base.OnUpdate(); }
private async Task AddLayerAsync(Layer layer) { FeatureLayer featureLayer = layer as FeatureLayer; GlobeSpotter globeSpotter = GlobeSpotter.Current; CycloMediaGroupLayer cycloGrouplayer = globeSpotter?.CycloMediaGroupLayer; if ((featureLayer != null) && (cycloGrouplayer != null) && (!cycloGrouplayer.IsKnownName(featureLayer.Name))) { if (!this.Aggregate(false, (current, vecLayer) => (vecLayer.Layer == layer) || current)) { var vectorLayer = new VectorLayer(featureLayer, this); bool initialized = await vectorLayer.InitializeEventsAsync(); if (initialized) { Add(vectorLayer); vectorLayer.PropertyChanged += OnVectorLayerPropertyChanged; LayerAdded?.Invoke(vectorLayer); } } } }
private async Task AddLayerAsync(Layer layer) { FeatureLayer featureLayer = layer as FeatureLayer; ModuleStreetSmart streetSmart = ModuleStreetSmart.Current; CycloMediaGroupLayer cycloGrouplayer = streetSmart?.CycloMediaGroupLayer; if (featureLayer != null && cycloGrouplayer != null && !cycloGrouplayer.IsKnownName(featureLayer.Name)) { if (!this.Aggregate(false, (current, vecLayer) => vecLayer.Layer == layer || current)) { var vectorLayer = new VectorLayer(featureLayer, this); bool initialized = await vectorLayer.InitializeEventsAsync(); if (initialized) { Add(vectorLayer); vectorLayer.PropertyChanged += OnVectorLayerPropertyChanged; LayerAdded?.Invoke(vectorLayer); } } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string result = string.Empty; string imageId = value as string; ModulestreetSmart streetSmart = ModulestreetSmart.Current; CycloMediaGroupLayer groupLayer = streetSmart.CycloMediaGroupLayer; AutoResetEvent taskWaiter = new AutoResetEvent(false); const int timeOut = 3000; Task.Run(async() => { Recording recording = await groupLayer.GetRecordingAsync(imageId); double stdX = recording == null ? 0 : (recording.LongitudePrecision ?? 0); double stdY = recording == null ? 0 : (recording.LatitudePrecision ?? 0); double stdZ = recording == null ? 0 : (recording.HeightPrecision ?? 0); result = $"{stdX:0.00} {stdY:0.00} {stdZ:0.00}"; taskWaiter.Set(); }); taskWaiter.WaitOne(timeOut); return(result); }
public StreetSmart() { InitializeComponent(); _settings = FileSettings.Instance; _constants = ConstantsViewer.Instance; _login = FileLogin.Instance; _configuration = FileConfiguration.Instance; _openNearest = new List <string>(); _crossCheck = null; _lastSpatialReference = null; _layers = new List <CycloMediaLayer>(); _startOpenNearest = false; GetVectorLayerListAsync(); ModulestreetSmart streetSmartModule = ModulestreetSmart.Current; _viewerList = streetSmartModule.ViewerList; _measurementList = streetSmartModule.MeasurementList; _cycloMediaGroupLayer = streetSmartModule.CycloMediaGroupLayer; }
protected RecentRecordingLayer() { IsChecked = false; GlobeSpotter globeSpotter = GlobeSpotter.Current; CycloMediaGroupLayer groupLayer = globeSpotter.CycloMediaGroupLayer; if (groupLayer != null) { foreach (var layer in groupLayer) { if (layer.IsRemoved) { IsChecked = layer.Name != LayerName && IsChecked; } else { IsChecked = layer.Name == LayerName || IsChecked; } } groupLayer.PropertyChanged += OnLayerPropertyChanged; } }
// ========================================================================= // Private Functions // ========================================================================= private void AddObs(Bitmap bitmap, FrmGlobespotter frmGlobespotter, int entityId, int pointId, MeasurementObservation observation) { if (_entityId != entityId) { _lastPointIdUpd = null; } string imageId = observation.imageId; GsExtension extension = GsExtension.GetExtension(); CycloMediaGroupLayer groupLayer = extension.CycloMediaGroupLayer; IMappedFeature locationInfo = groupLayer.GetLocationInfo(imageId); var recordingInfo = locationInfo as Recording; double stdX = (recordingInfo == null) ? 0 : (recordingInfo.LongitudePrecision ?? 0); double stdY = (recordingInfo == null) ? 0 : (recordingInfo.LatitudePrecision ?? 0); double stdZ = (recordingInfo == null) ? 0 : (recordingInfo.HeightPrecision ?? 0); string std = string.Format("{0:0.00} {1:0.00} {2:0.00}", stdX, stdY, stdZ); if ((_entityId != entityId) || (_pointId != pointId)) { ClearForm(false); _entityId = entityId; _pointId = pointId; _measurementPoint = null; _measurementPointS = null; txtNumber.Text = string.Empty; txtPosition.Text = string.Empty; txtPositionStd.Text = string.Empty; RelO.Image = null; SetOpenClose(false); } Measurement measurement = Measurement.Get(_entityId); if (measurement != null) { _measurementPointS = measurement[_pointId]; _measurementPointS.UpdateObservation(imageId, observation.x, observation.y, observation.z); txtNumber.Text = _measurementPointS.M.ToString(_ci); if (measurement.IsPointMeasurement) { SetOpenClose(true); if (_commandItem == null) { _commandItem = ArcMap.Application.CurrentTool; ArcUtils.SetToolActiveInToolBar("esriEditor.EditTool"); } } } if (bitmap != null) { _bitmapImageId.Add(imageId); _idBitmap.Add(bitmap); } bool add = true; foreach (ListViewItem item in lvObservations.Items) { var obs = item.Tag as MeasurementObservation; if (obs != null) { if (obs.imageId == imageId) { add = false; } } } if (add) { _frmGlobespotter = frmGlobespotter; var items = new[] { imageId, std, "X" }; var listViewItem = new ListViewItem(items) { Tag = observation }; lvObservations.Items.Add(listViewItem); DrawObservations(); RedrawObservationList(); } }
private void Save(bool close) { // determinate smart click permissions bool usernameChanged = (txtUsername.Text != _login.Username) || (txtPassword.Text != _login.Password); // determinate restart bool baseUrlChanged = (txtBaseUrlLocation.Text != _config.BaseUrl) || (ckDefaultBaseUrl.Checked != _config.BaseUrlDefault); bool recordingServiceChanged = (txtRecordingServiceLocation.Text != _config.RecordingsService) || (ckDefaultRecordingService.Checked != _config.RecordingsServiceDefault); bool swfChanged = (_config.SwfUrlDefault != ckDefaultSwfUrl.Checked) || (_config.SwfUrl != txtSwfUrlLocation.Text); bool cycloramaVectorLayerLocationChanged = (_config.CycloramaVectorLayerLocationDefault != ckDefaultCycloramaVectorLayerLocation.Checked) || (_config.CycloramaVectorLayerLocation != txtCycloramaVectorLayerLocation.Text); SpatialReference spat = _config.SpatialReference; var selectedItem = (SpatialReference)cbSpatialReferences.SelectedItem; bool spatChanged = (spat == null) || ((selectedItem != null) && (spat.ToString() != selectedItem.ToString())); bool restart = usernameChanged || baseUrlChanged || swfChanged || spatChanged || recordingServiceChanged; // Save values int proxyPort; bool proxyParsed = int.TryParse(txtProxyPort.Text, out proxyPort); int useProxyPort = proxyParsed ? proxyPort : 80; var maxViewers = (uint)nudMaxViewers.Value; var distLayer = (uint)nudDistVectLayerViewer.Value; bool smartClickEnabled = GlobeSpotterConfiguration.MeasureSmartClick && (!usernameChanged) ? ckEnableSmartClick.Checked : _config.SmartClickEnabled; bool proxyChanged = (ckUseProxyServer.Checked != _config.UseProxyServer); proxyChanged = proxyChanged || (_config.ProxyAddress != txtProxyAddress.Text); proxyChanged = proxyChanged || (_config.ProxyPort != useProxyPort); proxyChanged = proxyChanged || (_config.BypassProxyOnLocal != ckBypassProxyOnLocal.Checked); proxyChanged = proxyChanged || (_config.ProxyUseDefaultCredentials != ckUseDefaultProxyCredentials.Checked); proxyChanged = proxyChanged || (_config.ProxyUsername != txtProxyUsername.Text); proxyChanged = proxyChanged || (_config.ProxyPassword != txtProxyPassword.Text); proxyChanged = proxyChanged || (_config.ProxyDomain != txtProxyDomain.Text); _config.SpatialReference = selectedItem ?? _config.SpatialReference; _config.MaxViewers = maxViewers; _config.DistanceCycloramaVectorLayer = distLayer; _config.BaseUrl = txtBaseUrlLocation.Text; _config.RecordingsService = txtRecordingServiceLocation.Text; _config.SwfUrl = txtSwfUrlLocation.Text; _config.CycloramaVectorLayerLocation = txtCycloramaVectorLayerLocation.Text; _config.BaseUrlDefault = ckDefaultBaseUrl.Checked; _config.RecordingsServiceDefault = ckDefaultRecordingService.Checked; _config.SwfUrlDefault = ckDefaultSwfUrl.Checked; _config.CycloramaVectorLayerLocationDefault = ckDefaultCycloramaVectorLayerLocation.Checked; _config.SmartClickEnabled = smartClickEnabled; _config.DetailImagesEnabled = ckDetailImages.Checked; _config.UseProxyServer = ckUseProxyServer.Checked; _config.ProxyAddress = txtProxyAddress.Text; _config.ProxyPort = useProxyPort; _config.BypassProxyOnLocal = ckBypassProxyOnLocal.Checked; _config.ProxyUseDefaultCredentials = ckUseDefaultProxyCredentials.Checked; _config.ProxyUsername = txtProxyUsername.Text; _config.ProxyPassword = txtProxyPassword.Text; _config.ProxyDomain = txtProxyDomain.Text; _config.Save(); // Check restart GlobeSpotter bool loginSucces = (usernameChanged || baseUrlChanged || proxyChanged) && Login(); if (proxyChanged) { ckEnableSmartClick.Checked = (GlobeSpotterConfiguration.MeasureSmartClick && _config.SmartClickEnabled); ckEnableSmartClick.Enabled = GlobeSpotterConfiguration.MeasureSmartClick; } if (_login.Credentials || loginSucces) { if (restart && FrmGlobespotter.IsStarted()) { FrmGlobespotter.Restart(); } else { FrmGlobespotter.UpdateParameters(); } } // Close form if (close) { Close(); } // Check if the layer has to make empty if (usernameChanged || cycloramaVectorLayerLocationChanged) { GsExtension extension = GsExtension.GetExtension(); CycloMediaGroupLayer groupLayer = extension.CycloMediaGroupLayer; if (groupLayer != null) { if (usernameChanged) { groupLayer.MakeEmpty(); } if (cycloramaVectorLayerLocationChanged) { var layers = groupLayer.Layers; groupLayer.Dispose(); foreach (var layer in layers) { extension.AddLayers(layer.Name); } } } } btnApply.Enabled = false; }
/* * protected async override void OnUpdate() * { * Cursor nowCursor = Cursor; * Cursor = _containsFeatures ? Cursors.Arrow : _thisCursor; * * if (nowCursor != Cursor) * { * await FrameworkApplication.SetCurrentToolAsync("esri_mapping_exploreTool"); * await FrameworkApplication.SetCurrentToolAsync("globeSpotterArcGISPro_openImageTool"); * } * * base.OnUpdate(); * } * * protected override async void OnToolMouseMove(MapViewMouseEventArgs e) * { * await QueuedTask.Run(() => * { * var constants = ConstantsRecordingLayer.Instance; * double size = constants.SizeLayer; * double halfSize = size / 2; * MapView activeView = MapView.Active; * * WinPoint clientPoint = e.ClientPoint; * WinPoint pointScreen = activeView.ClientToScreen(clientPoint); * double x = pointScreen.X; * double y = pointScreen.Y; * WinPoint minPoint = new WinPoint(x - halfSize, y - halfSize); * WinPoint maxPoint = new WinPoint(x + halfSize, y + halfSize); * MapPoint minPoint1 = activeView.ScreenToMap(minPoint); * MapPoint maxPoint1 = activeView.ScreenToMap(maxPoint); * Envelope envelope = EnvelopeBuilder.CreateEnvelope(minPoint1, maxPoint1, minPoint1.SpatialReference); * var features = MapView.Active?.GetFeatures(envelope); * _containsFeatures = (features != null) && (features.Count >= 1); * }); * * base.OnToolMouseMove(e); * } */ protected override Task <bool> OnSketchCompleteAsync(Geometry geometry) { return(QueuedTask.Run(() => { MapPoint point = geometry as MapPoint; MapView activeView = MapView.Active; if (point != null && activeView != null) { var constants = ConstantsRecordingLayer.Instance; double size = constants.SizeLayer; double halfSize = size / 2; SpatialReference pointSpatialReference = point.SpatialReference; var pointScreen = activeView.MapToScreen(point); double x = pointScreen.X; double y = pointScreen.Y; WinPoint pointScreenMin = new WinPoint(x - halfSize, y - halfSize); WinPoint pointScreenMax = new WinPoint(x + halfSize, y + halfSize); var pointMapMin = activeView.ScreenToMap(pointScreenMin); var pointMapMax = activeView.ScreenToMap(pointScreenMax); Envelope envelope = EnvelopeBuilder.CreateEnvelope(pointMapMin, pointMapMax, pointSpatialReference); var features = activeView.GetFeatures(envelope); GlobeSpotter globeSpotter = GlobeSpotter.Current; CycloMediaGroupLayer groupLayer = globeSpotter?.CycloMediaGroupLayer; if (features != null && groupLayer != null) { _nearest = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl); if (_nearest) { Settings settings = Settings.Instance; MySpatialReference cycloCoordSystem = settings.CycloramaViewerCoordinateSystem; if (cycloCoordSystem != null) { SpatialReference cycloSpatialReference = cycloCoordSystem.ArcGisSpatialReference ?? cycloCoordSystem.CreateArcGisSpatialReferenceAsync().Result; if (pointSpatialReference.Wkid != cycloSpatialReference.Wkid) { ProjectionTransformation projection = ProjectionTransformation.Create(pointSpatialReference, cycloSpatialReference); point = GeometryEngine.Instance.ProjectEx(point, projection) as MapPoint; } if (point != null) { CultureInfo ci = CultureInfo.InvariantCulture; _location = string.Format(ci, "{0},{1}", point.X, point.Y); if (!globeSpotter.InsideScale()) { double minimumScale = ConstantsRecordingLayer.Instance.MinimumScale; double scale = minimumScale / 2; Camera camera = new Camera(point.X, point.Y, scale, 0.0); MapView.Active?.ZoomTo(camera); } } } } else { foreach (var feature in features) { Layer layer = feature.Key; CycloMediaLayer cycloMediaLayer = groupLayer.GetLayer(layer); if (cycloMediaLayer != null) { foreach (long uid in feature.Value) { Recording recording = cycloMediaLayer.GetRecordingAsync(uid).Result; if (recording.IsAuthorized == null || (bool)recording.IsAuthorized) { _location = recording.ImageId; } } } } } } } return true; })); }