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 OnMouseDown(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); TextForm textForm = new TextForm(); DialogResult dialogResult = textForm.ShowDialog(); if (textForm.InputText.Length > 0) { TextElement textElement = new TextElement(pointGeometry.Geometry, textForm.InputText, TextElementSize); TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (!tableOfContents.LayerExists(GraphicsLayerName)) { tableOfContents.ConstructLayer(GraphicsLayerName); } Layer layer = new Layer(tableOfContents[GraphicsLayerName]); layer.AddElement(textElement.Element, textElement.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(); } } }
protected override void OnMouseDown(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); TextForm textForm = new TextForm(); DialogResult dialogResult = textForm.ShowDialog(); if (textForm.InputText.Length > 0) { TextElement textElement = new TextElement(pointGeometry.Geometry, textForm.InputText, TextElementSize); TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (!tableOfContents.LayerExists(GraphicsLayerName)) { tableOfContents.ConstructLayer(GraphicsLayerName); } Layer layer = new Layer(tableOfContents[GraphicsLayerName]); layer.AddElement(textElement.Element, textElement.ElementProperties); ArcGlobe.Globe.GlobeDisplay.RefreshViewers(); } } }
protected override void OnMouseDown(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); if (_polygonGeometry == null) { _polygonGeometry = new PolygonGeometry(spatialReferenceFactory.SpatialReference); } _polygonGeometry.AddPoint(pointGeometry.Geometry as IPoint); TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (!tableOfContents.LayerExists(GraphicsLayerName)) { tableOfContents.ConstructLayer(GraphicsLayerName); } Layer layer = new Layer(tableOfContents[GraphicsLayerName]); if (_polygonGeometry.PointCount == 1) { PointElement pointElement = new PointElement(pointGeometry.Geometry, PointElementSize, PointElementStyle); layer.AddElement(pointElement.Element, pointElement.ElementProperties); } else { layer.RemoveElement(layer.ElementCount - 1); PolylineGeometry polylineGeometry = new PolylineGeometry(_polygonGeometry.Geometry); PolylineElement polylineElement = new PolylineElement(polylineGeometry.Geometry, PolylineElementWidth, PolylineElementStyle); layer.AddElement(polylineElement.Element, polylineElement.ElementProperties); } ArcGlobe.Globe.GlobeDisplay.RefreshViewers(); } }
protected override void OnMouseDown(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); if (_polygonGeometry == null) { _polygonGeometry = new PolygonGeometry(spatialReferenceFactory.SpatialReference); } _polygonGeometry.AddPoint(pointGeometry.Geometry as IPoint); TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (!tableOfContents.LayerExists(GraphicsLayerName)) { tableOfContents.ConstructLayer(GraphicsLayerName); } Layer layer = new Layer(tableOfContents[GraphicsLayerName]); if (_polygonGeometry.PointCount == 1) { PointElement pointElement = new PointElement(pointGeometry.Geometry, PointElementSize, PointElementStyle); layer.AddElement(pointElement.Element, pointElement.ElementProperties); } else { layer.RemoveElement(layer.ElementCount - 1); PolylineGeometry polylineGeometry = new PolylineGeometry(_polygonGeometry.Geometry); PolylineElement polylineElement = new PolylineElement(polylineGeometry.Geometry, PolylineElementWidth, PolylineElementStyle); layer.AddElement(polylineElement.Element, polylineElement.ElementProperties); } ArcGlobe.Globe.GlobeDisplay.RefreshViewers(); } }
protected override void OnDoubleClick() { if (_polygonGeometry.PointCount > 2) { TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (tableOfContents.LayerExists("Globe Graphics")) { Layer layer = new Layer(tableOfContents["Globe Graphics"]); layer.RemoveElement(layer.ElementCount - 1); _polygonGeometry.Close(); PolygonElement polygonElement = new PolygonElement(_polygonGeometry.Geometry, esriSimpleFillStyle.esriSFSSolid); layer.AddElement(polygonElement.Element, polygonElement.ElementProperties); _polygonGeometry = null; ArcGlobe.Globe.GlobeDisplay.RefreshViewers(); } } }
protected override void OnDoubleClick() { if (_polygonGeometry.PointCount > 2) { TableOfContents tableOfContents = new TableOfContents(ArcGlobe.Globe); if (tableOfContents.LayerExists("Globe Graphics")) { Layer layer = new Layer(tableOfContents["Globe Graphics"]); layer.RemoveElement(layer.ElementCount - 1); _polygonGeometry.Close(); PolygonElement polygonElement = new PolygonElement(_polygonGeometry.Geometry, esriSimpleFillStyle.esriSFSSolid); layer.AddElement(polygonElement.Element, polygonElement.ElementProperties); _polygonGeometry = null; ArcGlobe.Globe.GlobeDisplay.RefreshViewers(); } } }