Overlay Sample
Overlay Sample demonstrates programming of Overlays
See also All samples
The application
On start the application creates a new overlay with a closed four segment strip
and activates the overlay editor. Select a point or segment and drag it to
modify it (Direct User Access mode). Select a point and press Delete key to
replace adjacent segments with a shortcut. Select a segment and press Delete to
remove the segment.
Select a segment and select Break command in context menu (right mouse click) to
divide the segment in half.
Select "New strip" command in context menu and click a sequence of points to
define a new strip. Hold Control Key to end the sequence
Controls on the right hand side of the application display information about the
current strip and allow modification of its points. Change values in the edit
boxes and press "Modify Point" to make the modification.
Implementation
CreateDefaultOverlay() method of the main view (form) class is where the most
important work is done. The method obtains
IPropertyArray and calls
IPropertyArray.GetPropertyEx("OverlayView", 1, 1) to simultaneously create an
overlay and activate its editor. The GetPropertyEx() method returns an interface
which can be safely cast to (already has type of)
I2DView_KC.
CreateDefaultOverlay() also queries I2DEditor_KC
from the I2DView_KC
and obtains ISection implemented by the overlay
object with a call to II2DEditor_KC.GetObject().
2D model, which belongs to the overlay, is accessed by quering
IModel_KC from ISection
of the overlay.
IModel_KC.AddNewItem(EObjectType.eObjTypeLineStrip) line adds a new
empty 2D line strip scene item and returns its
IItem interface. To acces the actual strip (geometry inside the 2D item)
IStrip is queried from the
IItem.
The ConstructDefaultLoop() method uses methods of
IStripTopol queried from IStrip to add new
points to the strip. GetPoint() and SetPoint() methods are used to obtain or
modify coordinates of a point.
|