Classes | Enumerations | Enumerator | Functions
Dgn Region Tool

A sub-class of DgnElementSetTool for the purpose of creating planar regions. More...

Classes

struct  DgnRegionElementTool
 

Enumerations

enum  RegionCreateMode { REGION_CREATE_Elements, REGION_CREATE_ByParams, REGION_CREATE_Points, REGION_CREATE_Fence }
 
enum  RegionToolPhase { REGION_PHASE_SelectBoundaries, REGION_PHASE_CreateRegion, REGION_PHASE_ProcessOriginals }
 

Functions

RegionGraphicsContext * GetRegionContext ()
 Get the current RegionGraphicsContext used by the tool. More...
 
RegionToolPhase GetCurrentToolPhase ()
 Get the current tool phase. More...
 
bool IsFloodRegionSelected ()
 Returns true if there is a valid flood region result preview. More...
 
virtual
DgnPlatform::RegionParams
const & 
_GetRegionParams ()=0
 Return RegionParams to use for REGION_CREATE_ByParams. More...
 
virtual RegionCreateMode _GetRegionCreateMode ()=0
 Return the desired RegionCreateMode. More...
 
virtual BentleyStatus _OnProcessRegionResult (EditElementHandleR elHandle)=0
 Called with region result. The tool is responsible for setting symbology and adding to a DgnModel as needed. More...
 
virtual StatusInt _DoComputeRegionResult (ElementAgendaR result, DgnButtonEventCR ev)
 Create the new region elements that are a result of the given region creation parameters and options. More...
 
virtual void _GetRegionPreviewSymbology (UInt32 &lineColorTBGR, UInt32 &fillColorTBGR, UInt32 &lineWeight, UInt32 &lineStyle, ViewportR, DgnDrawMode)
 Provided to allow sub-classes to override the default symbology used to for region preview and flood dynamic area. More...
 
virtual WCharCP _GetAssociativeRegionName ()
 Default cell name used when creating an Associative Region element. More...
 
virtual StatusInt _OnElementModify (EditElementHandleR eeh)
 Called only if _WantProcessOriginals returns true. Invalidate eeh and return SUCCESS to delete element. More...
 
virtual bool _WantProcessOriginals ()
 Return true if the tool wants to process the original elements that were directly involved in creating the result region. More...
 
virtual bool _WantFloodDynamicArea ()
 Return true if the tool wants region flood dynamics using the current cursor location as the flood seed point. More...
 
virtual bool _AllowPhysicallyClosed ()
 Return true to allow physically closed open paths as boundary candidates. More...
 
virtual bool _AcceptClosedElement (ElementHandleCR eh, WStringR cantAcceptReason)
 Called from _OnPostLocate and _FilterAgendaEntries to reject invalid boundary candidates. More...
 
virtual bool _IsModifyOriginal () override
 Don't copy the originals. More...
 
virtual bool _DoGroups () override
 Whether to allow named and graphic groups. More...
 
virtual bool _WantDynamics () override
 Whether to start tool dynamics. More...
 
virtual bool _WantAccuSnap () override
 Whether to enable AccuSnap. More...
 
virtual bool _WantAdditionalLocate (DgnButtonEventCP ev) override
 Require a minimum number of selected elements/areas, checks for control key to allow additional selection. More...
 
virtual bool _NeedAcceptPoint () override
 Whether an explicit data point is requires to accept the region result. More...
 
virtual bool _AcceptIdentifiesNext () override
 Whether data point to accept can also identify new element/area. More...
 
virtual UsesDragSelect _AllowDragSelect () override
 Whether to allow elements to be selected by crossing line (Allowed for element/boolean modes). More...
 
virtual bool _CheckStop () override
 Allow abort of region creation using reset. More...
 
virtual void _ResetStop () override
 Initialize abort processing. More...
 
virtual void _DrawTransients (ViewContextR context, bool isPreUpdate) override
 Use to preview the region result that will be accepted. More...
 
virtual void _DecorateScreen (ViewportR vp) override
 Used to show dynamic region result under the cursor. More...
 
virtual StatusInt _ProcessAgenda (DgnButtonEventCR ev) override
 
virtual void _HiliteAgendaEntries (bool changed) override
 Show boolean region result preview (IViewTransients). More...
 
virtual void _UnHiliteAgendaEntries (bool empty) override
 Clear boolean region result preview (IViewTransients). More...
 
virtual bool _OnPostLocate (HitPathCP path, WStringR cantAcceptReason) override
 Check for valid boundary candidates. More...
 
virtual bool _FilterAgendaEntries () override
 Check for valid boundary candidates when creating region from a selection set. More...
 
virtual void _SetLocateCriteria () override
 Setup search modelRef list. More...
 
virtual void _SetupAndPromptForNextAction () override
 Output default prompts, enable/disable AccuSnap and AutoLocate. More...
 
virtual void _OnDynamicFrame (DgnButtonEventCR ev) override
 Used for create dynamics when defining a region by points (REGION_CREATE_Points). More...
 
virtual bool _OnModelMotion (DgnButtonEventCR ev) override
 Request _DecorateScreen be called for flood dynamic area. More...
 
virtual bool _OnModifierKeyTransition (bool wentDown, int key) override
 Used to monitor control key up/down event for additional selection. More...
 
virtual bool _OnModifyComplete (DgnButtonEventCR ev) override
 Exit or restart tool after accepting region result. More...
 
virtual bool _OnResetButton (DgnButtonEventCR ev) override
 Accept region by points, cycle between over-lapping elements, restart or exit tool. More...
 
virtual bool _OnDataButton (DgnButtonEventCR ev) override
 Identify elements/area and advance tool state. More...
 
virtual void _OnUndoPreviousStep () override
 Used to undo last point when defining a region by points (REGION_CREATE_Points). More...
 
virtual void _OnCleanup () override
 Add tool instance to registered IViewTransients providers. More...
 
virtual void _OnPostInstall () override
 Drop tool instance from registered IViewTransients providers. More...
 
 DgnRegionElementTool ()
 Default constructor for DgnRegionElementTool. Can only create an instance of a sub-class that implements the required pure-virtual methods. More...
 

Detailed Description

A sub-class of DgnElementSetTool for the purpose of creating planar regions.

Regions can be created through 2d booleans or by flood using one or more seed points. The result regions have the option of being associated with the original boundary elements such that they will update when/if those boundary elements are modified. This tool class provides a wrapper around RegionGraphicsContext to help with interactive region creation.

Remarks
Required library : DgnView<ApiNumber>.lib i.e. DgnView2.lib

Enumeration Type Documentation

enum RegionCreateMode
Enumerator
REGION_CREATE_Elements 

Process existing region elements (elements from ref attachments will be copied)

REGION_CREATE_ByParams 

Create new region from existing elements using boolean or flood (defined by region params)

REGION_CREATE_Points 

Create new region from a shape defined by points.

REGION_CREATE_Fence 

Create new region from a shape created from the active fence.

enum RegionToolPhase
Enumerator
REGION_PHASE_SelectBoundaries 

Choose boundaries candiates for boolean or flood.

REGION_PHASE_CreateRegion 

Create new region from selected boundaries.

REGION_PHASE_ProcessOriginals 

Process boundary candiates actually used to construct region.

Function Documentation

virtual bool _AcceptClosedElement ( ElementHandleCR  eh,
WStringR  cantAcceptReason 
)
protectedvirtual

Called from _OnPostLocate and _FilterAgendaEntries to reject invalid boundary candidates.

virtual bool _AcceptIdentifiesNext ( )
overrideprotectedvirtual

Whether data point to accept can also identify new element/area.

Reimplemented from DgnElementSetTool.

virtual UsesDragSelect _AllowDragSelect ( )
overrideprotectedvirtual

Whether to allow elements to be selected by crossing line (Allowed for element/boolean modes).

Reimplemented from DgnElementSetTool.

virtual bool _AllowPhysicallyClosed ( )
protectedvirtual

Return true to allow physically closed open paths as boundary candidates.

virtual bool _CheckStop ( )
overrideprotectedvirtual

Allow abort of region creation using reset.

Reimplemented from ModifyOp.

virtual void _DecorateScreen ( ViewportR  vp)
overrideprotectedvirtual

Used to show dynamic region result under the cursor.

Reimplemented from DgnElementSetTool.

virtual StatusInt _DoComputeRegionResult ( ElementAgendaR  result,
DgnButtonEventCR  ev 
)
protectedvirtual

Create the new region elements that are a result of the given region creation parameters and options.

Afterwards, _OnProcessRegionResult will be called for each result region to allow the tool to make necessary modifications.

Parameters
[out]resultThe result region elements that have been created.
[in]evThe accept point.
Returns
SUCCESS if region operation was successful.
Note
Override only to completely bypass default REGION_CREATE_ByParams creation.
virtual bool _DoGroups ( )
overrideprotectedvirtual

Whether to allow named and graphic groups.

Reimplemented from DgnElementSetTool.

virtual void _DrawTransients ( ViewContextR  context,
bool  isPreUpdate 
)
overrideprotectedvirtual

Use to preview the region result that will be accepted.

Implements IViewTransients.

virtual bool _FilterAgendaEntries ( )
overrideprotectedvirtual

Check for valid boundary candidates when creating region from a selection set.

Reimplemented from DgnElementSetTool.

virtual WCharCP _GetAssociativeRegionName ( )
protectedvirtual

Default cell name used when creating an Associative Region element.

virtual RegionCreateMode _GetRegionCreateMode ( )
protectedpure virtual

Return the desired RegionCreateMode.

virtual DgnPlatform::RegionParams const& _GetRegionParams ( )
protectedpure virtual

Return RegionParams to use for REGION_CREATE_ByParams.

virtual void _GetRegionPreviewSymbology ( UInt32 lineColorTBGR,
UInt32 fillColorTBGR,
UInt32 lineWeight,
UInt32 lineStyle,
ViewportR  ,
DgnDrawMode   
)
protectedvirtual

Provided to allow sub-classes to override the default symbology used to for region preview and flood dynamic area.

A DgnDrawMode of DRAW_MODE_Flash means it for flood dynamic display.

virtual void _HiliteAgendaEntries ( bool  changed)
overrideprotectedvirtual

Show boolean region result preview (IViewTransients).

Reimplemented from DgnElementSetTool.

virtual bool _IsModifyOriginal ( )
overrideprotectedvirtual

Don't copy the originals.

Reimplemented from DgnElementSetTool.

virtual bool _NeedAcceptPoint ( )
overrideprotectedvirtual

Whether an explicit data point is requires to accept the region result.

Reimplemented from DgnElementSetTool.

virtual void _OnCleanup ( )
overrideprotectedvirtual

Add tool instance to registered IViewTransients providers.

Reimplemented from DgnTool.

virtual bool _OnDataButton ( DgnButtonEventCR  ev)
overrideprotectedvirtual

Identify elements/area and advance tool state.

Reimplemented from DgnElementSetTool.

virtual void _OnDynamicFrame ( DgnButtonEventCR  ev)
overrideprotectedvirtual

Used for create dynamics when defining a region by points (REGION_CREATE_Points).

Reimplemented from DgnElementSetTool.

virtual StatusInt _OnElementModify ( EditElementHandleR  eeh)
protectedvirtual

Called only if _WantProcessOriginals returns true. Invalidate eeh and return SUCCESS to delete element.

Implements DgnElementSetTool.

References Bentley::ERROR.

virtual bool _OnModelMotion ( DgnButtonEventCR  ev)
overrideprotectedvirtual

Request _DecorateScreen be called for flood dynamic area.

Reimplemented from DgnElementSetTool.

virtual bool _OnModifierKeyTransition ( bool  wentDown,
int  key 
)
overrideprotectedvirtual

Used to monitor control key up/down event for additional selection.

Reimplemented from DgnElementSetTool.

virtual bool _OnModifyComplete ( DgnButtonEventCR  ev)
overrideprotectedvirtual

Exit or restart tool after accepting region result.

Reimplemented from DgnElementSetTool.

virtual void _OnPostInstall ( )
overrideprotectedvirtual

Drop tool instance from registered IViewTransients providers.

Reimplemented from DgnElementSetTool.

virtual bool _OnPostLocate ( HitPathCP  path,
WStringR  cantAcceptReason 
)
overrideprotectedvirtual

Check for valid boundary candidates.

Reimplemented from DgnElementSetTool.

virtual BentleyStatus _OnProcessRegionResult ( EditElementHandleR  elHandle)
protectedpure virtual

Called with region result. The tool is responsible for setting symbology and adding to a DgnModel as needed.

virtual bool _OnResetButton ( DgnButtonEventCR  ev)
overrideprotectedvirtual

Accept region by points, cycle between over-lapping elements, restart or exit tool.

Reimplemented from DgnElementSetTool.

virtual void _OnUndoPreviousStep ( )
overrideprotectedvirtual

Used to undo last point when defining a region by points (REGION_CREATE_Points).

Reimplemented from DgnPrimitiveTool.

virtual StatusInt _ProcessAgenda ( DgnButtonEventCR  ev)
overrideprotectedvirtual

Reimplemented from DgnElementSetTool.

virtual void _ResetStop ( )
overrideprotectedvirtual

Initialize abort processing.

Reimplemented from ModifyOp.

virtual void _SetLocateCriteria ( )
overrideprotectedvirtual

Setup search modelRef list.

Reimplemented from DgnElementSetTool.

virtual void _SetupAndPromptForNextAction ( )
overrideprotectedvirtual

Output default prompts, enable/disable AccuSnap and AutoLocate.

Reimplemented from DgnElementSetTool.

virtual void _UnHiliteAgendaEntries ( bool  empty)
overrideprotectedvirtual

Clear boolean region result preview (IViewTransients).

Reimplemented from DgnElementSetTool.

virtual bool _WantAccuSnap ( )
overrideprotectedvirtual

Whether to enable AccuSnap.

Reimplemented from DgnElementSetTool.

virtual bool _WantAdditionalLocate ( DgnButtonEventCP  ev)
overrideprotectedvirtual

Require a minimum number of selected elements/areas, checks for control key to allow additional selection.

Reimplemented from DgnElementSetTool.

virtual bool _WantDynamics ( )
overrideprotectedvirtual

Whether to start tool dynamics.

Reimplemented from DgnElementSetTool.

virtual bool _WantFloodDynamicArea ( )
protectedvirtual

Return true if the tool wants region flood dynamics using the current cursor location as the flood seed point.

virtual bool _WantProcessOriginals ( )
protectedvirtual

Return true if the tool wants to process the original elements that were directly involved in creating the result region.

DgnRegionElementTool ( )

Default constructor for DgnRegionElementTool. Can only create an instance of a sub-class that implements the required pure-virtual methods.

RegionToolPhase GetCurrentToolPhase ( )
protected

Get the current tool phase.

RegionGraphicsContext* GetRegionContext ( )
protected

Get the current RegionGraphicsContext used by the tool.

bool IsFloodRegionSelected ( )
protected

Returns true if there is a valid flood region result preview.


Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.