protected override void OnMouseUp(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg) { if (arg.Button == MouseButtons.Left) { GeographicCoordinates geographicCoordinates = new GeographicCoordinates(ArcGlobe.Globe, arg.X, arg.Y); SpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceFactory((int)GeographicCoordinateSystem); PointGeometry pointGeometry = new PointGeometry(geographicCoordinates.Longitude, geographicCoordinates.Latitude, geographicCoordinates.AltitudeInKilometers, spatialReferenceFactory.SpatialReference); IStyleGalleryItem styleGalleryItem = StyleGallerySelection.GetStyleGalleryItem(); if (styleGalleryItem != null) { StyleElement styleElement = new StyleElement(pointGeometry.Geometry, StyleElementSize, styleGalleryItem); TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (!tableOfContents.LayerExists(GraphicsLayerName)) { tableOfContents.ConstructLayer(GraphicsLayerName); } Layer layer = new Layer(tableOfContents[GraphicsLayerName]); layer.AddElement(styleElement.Element, styleElement.ElementProperties); ArcGlobe.Globe.GlobeDisplay.RefreshViewers(); } } }
protected override void OnMouseUp(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg) { if (arg.Button == MouseButtons.Left) { GeographicCoordinates geographicCoordinates = new GeographicCoordinates(ArcGlobe.Globe, arg.X, arg.Y); SpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceFactory((int)GeographicCoordinateSystem); PointGeometry pointGeometry = new PointGeometry(geographicCoordinates.Longitude, geographicCoordinates.Latitude, geographicCoordinates.AltitudeInKilometers, spatialReferenceFactory.SpatialReference); IStyleGalleryItem styleGalleryItem = StyleGallerySelection.GetStyleGalleryItem(); if (styleGalleryItem != null) { StyleElement styleElement = new StyleElement(pointGeometry.Geometry, StyleElementSize, styleGalleryItem); TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (!tableOfContents.LayerExists(GraphicsLayerName)) { tableOfContents.ConstructLayer(GraphicsLayerName); } Layer layer = new Layer(tableOfContents[GraphicsLayerName]); layer.AddElement(styleElement.Element, styleElement.ElementProperties); ArcGlobe.Globe.GlobeDisplay.RefreshViewers(); } } }