Creating a toolbar of globe tools


Purpose
This add-in sample shows how to write ArcObjects code to build a toolbar of tools that work in ArcGlobe, which allows you to interactively create three-dimensional (3D) points, rasterized polylines and polygons, and two-dimensional (2D) text by clicking the globe surface. This sample also shows how to work with globe graphic containers, text elements, polygon elements, polyline elements, and point elements, and how to programmatically adjust various display settings.

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

Running the sample from ArcGlobe
  1. Start ArcGlobe.
  2. Click Customize, click Customize Mode, then click the Toolbars tab.
  3. Select GraphicsToolbar on the Toolbars pane.
  4. Close the Customize dialog box.
  5. To use the Point tool, click the globe surface to digitize a 3D sphere.
  6. To use the Polyline tool, click the globe surface to digitize the polyline vertices, and double-click to end the polyline.
  7. To use the Polygon tool, click the globe surface to digitize the polygon vertices and double-click to close the polygon.
  8. To use the Text tool, click the globe surface to specify where the text should be centered, type text on the dialog box that appears, and press Enter.
  9. Selecting a custom color via the Color tool before using any of the previous tools, causes the color of the digitized geometry or text to change accordingly.

ColorCommand.cs Color command implementation. Sets static color selection to color selected via the color palette.
ColorPalette.cs Color palette implementation. Displays dialog box allowing you to select red, green, and blue (RGB) color.
ColorSelection.cs Color selection implementation. Static class used to persist selected color.
GeographicCoordinates.cs Geographic coordinates implementation. Converts from window to geographic coordinates and allows coordinates to be accessed as individual getters.
Layer.cs Layer implementation. Wrapper class for globe graphics layer, returning element count and allowing elements to be added, removed, and retrieved by index.
PointElement.cs Point element implementation. Sets element properties for a marker element whose symbol is set to 2D or 3D.
PointGeometry.cs Point geometry implementation. Constructs a 3D point from supplied geographic coordinates.
PointTool.cs Point tool implementation. Adds a point element to the globe graphics container and refreshes the display.
PolygonElement.cs Polygon element implementation. Sets element properties for rasterized polygon based on default and supplied parameters.
PolygonGeometry.cs Polygon geometry implementation. Wrapper class, allowing points to be added to the polygon, polygon to be closed and points counted, and resulting geometry to be returned.
PolygonTool.cs Polygon tool implementation. Adds polyline elements to the globe graphics container with each click showing polygon boundaries, completes the polygon with a double-click, and refreshes the display.
PolylineElement.cs Polyline element implementation. Sets element properties for rasterized polyline based on default and supplied parameters.
PolylineGeometry.cs Polyline geometry implementation. Wrapper class, allowing points to be added to polyline and point count, and resulting geometry to be returned.
PolylineTool.cs Polyline tool implementation. Adds polyline elements to the globe graphics container with each click, completes the polyline with a double-click, and refreshes the display.
SpatialReference.cs Spatial reference implementation. Initializes a spatial reference object from a supplied x,y coordinate system.
TableOfContents.cs Table of contents implementation. Wrapper class for scene object, allowing you to check if a globe graphics layer exists, construct a globe graphics layer, and access a globe graphics layer by index.
TextElement.cs Text element implementation. Sets element properties for a text element whose symbol is constructed from default and user-supplied parameters.
TextForm.cs Text form implementation. Form that resizes to fit text box used to obtain user-supplied text to be symbolized.
TextForm.Designer.cs Text form designer implementation. Designer for text form.
TextTool.cs Text tool implementation. Adds a text element to the globe graphics container and refreshes the display.
Download the C# files
ColorCommand.vb Color command implementation. Sets static color selection to color selected via the color palette.
ColorPalette.vb Color palette implementation. Displays dialog box allowing you to select red, green, and blue (RGB) color.
ColorSelection.vb Color selection implementation. Static class used to persist selected color.
GeographicCoordinates.vb Geographic coordinates implementation. Converts from window to geographic coordinates and allows coordinates to be accessed as individual getters.
Layer.vb Layer implementation. Wrapper class for globe graphics layer, returning element count and allowing elements to be added, removed, and retrieved by index.
PointElement.vb Point element implementation. Sets element properties for a marker element whose symbol is set to 2D or 3D.
PointGeometry.vb Point geometry implementation. Constructs a 3D point from supplied geographic coordinates.
PointTool.vb Point tool implementation. Adds a point element to the globe graphics container and refreshes the display.
PolygonElement.vb Polygon element implementation. Sets element properties for rasterized polygon based on default and supplied parameters.
PolygonTool.vb Polygon tool implementation. Adds polyline elements to the globe graphics container with each click showing polygon boundaries, completes the polygon with a double-click, and refreshes the display.
PolygonGeometry.vb Polygon geometry implementation. Wrapper class, allowing points to be added to the polygon, polygon to be closed and points counted, and resulting geometry to be returned.
PolylineElement.vb Polyline element implementation. Sets element properties for rasterized polyline based on default and supplied parameters.
PolylineGeometry.vb Polyline geometry implementation. Wrapper class, allowing points to be added to polyline and point count, and resulting geometry to be returned.
PolylineTool.vb Polyline tool implementation. Adds polyline elements to the globe graphics container with each click, completes the polyline with a double-click, and refreshes the display.
SpatialReference.vb Spatial reference implementation. Initializes a spatial reference object from a supplied x,y coordinate system.
TableOfContents.vb Table of contents implementation. Wrapper class for scene object, allowing you to check if a globe graphics layer exists, construct a globe graphics layer, and access a globe graphics layer by index.
TextElement.vb Text element implementation. Sets element properties for a text element whose symbol is constructed from default and user-supplied parameters.
TextForm.vb Text form implementation. Form that resizes to fit text box used to obtain user-supplied text to be symbolized.
TextForm.Designer.vb Text form designer implementation. Designer for text form.
TextTool.vb Text tool implementation. Adds a text element to the globe graphics container and refreshes the display.
Download the VB.NET files

Download the files for all languages




Development licensing Deployment licensing
ArcGIS for Desktop Basic: 3D Analyst
ArcGIS for Desktop Standard: 3D Analyst
ArcGIS for Desktop Advanced: 3D Analyst