Samples

Label 3D Toolbar

Description:

This tool contains a toolbar providing functionality to create text labels in the 3D environment of ArcScene. The text and location of the labels of the toolbar can be originated from features in a layer, as well as by user defined positions via mouse clicks. Dialogs are provided to allow the modification of the rotation, offset, and orientation of the labels. The labels can also be saved and opened into ArcScene documents via the toolbar.

The 3D label toolbar utilizes a library created from another Developer Sample project which contains the core functionality of the 3D labeling. That code highlights the procedures for using the OpenGL type library to create 3D text using fonts on the system. The Label3DEngine project should be reviewed to gain a more specfic understanding of the OpenGL methods used.

Products:

ArcView: VB6

Platforms: Windows

Minimum ArcGIS Release: 9.0

How to use:
  1. Register the DDDAnalystTextSample.DLL before adding the Label3DToolbar through the Customize dialog.
  2. Start ArcScene and load a feature layer containing an attribute in which to base the label on. The data folder distrubuted with these sample contains the \site1\bldgs3d shapefile which can be used to demostrate use of the toolbar.
  3. In the dropdown 'Layer' listbox on the 3DLabels toolbar, select "bldgs3D" and select "owner" from the dropdown 'Field' listbox.
  4. Place a check in the 'On' checkbox of the toolbar to make the labels visible. Zoom into the dataset to view the labels more closely.
  5. From the 3D Labels dropdown menu, select 'Font' to change the property of the fonts for all the labels; selecting 'Rotation' and 'Offset' will also modify these properties for all the labels in the select layer. Turn the labels of by unchecking the 'On' checkbox.
  6. Select the first layer in the layer dropdown list, 'graphics layer', turn the labels for the layer on, and select the 'Add a label' tool. Click on any geography in the scene, such as a building, and enter the text for the label you have just added.
  7. Choose the 'Select a label' tool and select an existing label by clicking on it. A dialog will open allowing you to change any available properties for the individual label.
  8. Checking 'Billboarding' from the '3D Labels' dropdown menu will result in the labels for the selected layer always rotating to face the observer
  9. Save all the visible labels in the scene to a text file, or open a text file in the appropriate format through the 'Label File' item on the dropdown menu.
[VB6]

Steps for compiling the DLL:

  1. The VB code for this sample makes calls to one or more utility modules that are shared by a number of 3D samples. The shared modules are located in the 'Utilities' folder which is found directly below the main '3D Analyst' ArcObjects sample folder. In order to compile the DLL make sure you have the latest version of the shared modules installed. Additionally, you'll need to reference the VB OpenGL API 1.2 (ANSI) library. It's called vbogl.tlb and should be located in your operating system's system32 folder. If you don't already have it installed you can find it available for download on the internet. One source is http://is6.pacific.net.hk/~edx/tlb.htm

VB6
File Description
cls3DLabelDemo.cls The IToolbarDef class module for the tool.
clsAddLabel.cls ITool implementation to add a label.
clsChkBillboard.cls ICommand implementation to turn on the billboarding for labels.
clsLabel3DMNU.cls ICommand implementation for the main toolbar dropdown menu.
clsLabelEngine.cls The main class module containing the 3D Label Engine used by the toolbar.
clsLabelProps.cls ICommand implementation to open the property dialog for labels.
clsLayerBox.cls ICommand implementation for a listbox contain the layers availabke for labeling.
clsLayerLabels.cls A class containing all labels in a layer.
clsMNUGetDefaults.cls ICommand implementation to reset the labels to default properties.
clsMNULayerBB.cls ICommand implementation for the menu item which turns on the billboarding for labels.
clsMNULayerFont.cls ICommand implementation for the menu item to change the font of labels.
clsMNULayerName.cls ICommand implementation used for the listing of a layer to be labeled.
clsMNULayerOffset.cls ICommand implementation for the menu item to change the offset of labels.
clsMNULayerRotation.cls ICommand implementation for the menu item to change the rotation of labels.
clsMNUOpenLabels.cls ICommand implementation for the menu to open labels from a text file.
clsMNUPersist.cls ICommand implementation for the root level menu to open and save labels.
clsMNUSaveLabels.cls ICommand implementation for the menu to save labels to a text file.
clsSceneGraphEvents.cls Class module containing the event handler for SceneGraph and SceneDocument events important for the tool.
clsSelectLabel.cls ITool implementation to select a label.
clsSGEvents.cls Class module containing the event handler for SceneGraph and SceneDocument events important for the engine.
DDDFont.cls Class module for handling fonts on the system for the tool.
DDDText.cls Class module containing the properties of a label.
IDDDFont.cls Class module containing the interface defining the properties of a font.
IDDDText.cls Class module containing the interface defining the properties of a label.
frmListChoose.frm Dialog for choosing labels.
frmProps.frm Dialog box presenting the properties of labels.
frmSlider.frm Dialog box presenting the properties of labels via a slider.
modLabel3DToolbar.bas Main code module containing code used by the toolbar.
modLabelEngine.bas Main code module containing code used by the labeling engine.
FontUtils.bas Code module containing code used by the toolbar concerning fonts.
Label3DEngine.vbp Project file for the labeling engine.
Label3DToolbar.vbp Project file for the labeling toolbar.
DDDAnalystTextSample.dll The compiled project for the labeling engine.
Label3DToolbar.dll The compiled project for the labeling toolbar.
../../../../Utilities/DDDDevSamplesUtilities.htm This project also references shared code located in Visual Basic code modules (3D Analyst Developer Sample utilties). To compile this project, these files are necessary in the location: '<ARCGIS INSTALL PATH > \ArcObjects Developer Kit\Samples\3D Analyst\Utilities\ '


Key Libraries: 3DAnalyst, Geometry, SystemUI
Key CoClasses:Vector3D
Key Interfaces: ICommand, ITool, IToolbarDef, ISceneGraph, ISceneViewer
Key Members:ISceneGraph::Locate


Feedback Send feedback on this sample