DgnRegionElementTool.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
10 #include <DgnPlatform/RegionUtil.h>
12 
14 
15 //=======================================================================================
26 //=======================================================================================
28 {
30 
31 public:
32 
34  {
39  };
40 
42  {
46  };
47 
48 private:
49 
51 
52 RegionToolPhase m_currentPhase;
53 CurveVectorPtr m_dynamicFace;
54 CurveVectorPtr m_resultFaces;
55 DPoint3d m_graphFrustum[8];
56 DPoint3d m_lastFrustum[8];
57 DPoint3d m_toggleFaceViewPt;
58 bvector<DPoint3d> m_regionPoints;
59 int m_resrvedRegionElm[8];
60 
61 void DisplayRegionError (bool noError);
62 void InitializeRegionContext (ViewportP vp);
63 void ValidateRegionViewport (ViewportP vp, bvector<DPoint3d>* seedPoints);
64 BentleyStatus SetupRegionContext (ViewportP vp);
65 
66 void DisplayRegion (CurveVectorCR region, ViewportP vp, DgnPlatform::DgnDrawMode drawMode);
67 void UpdateTransientDisplay (DgnPlatform::DgnDrawMode drawMode);
68 void UpdateRegionResultPreview (ViewportP vp);
69 void UpdateBooleanResultPreview (ViewportP vp);
70 
71 BentleyStatus GetPreSelectedBoundaries ();
72 BentleyStatus CreateRegionFromFence (EditElementHandleR eeh);
73 BentleyStatus CreateRegionByPoints (EditElementHandleR eeh, DgnButtonEventCP ev);
74 
75 protected:
76 
77 DGNVIEW_EXPORT RegionGraphicsContext* GetRegionContext ();
78 DGNVIEW_EXPORT RegionToolPhase GetCurrentToolPhase ();
79 DGNVIEW_EXPORT bool IsFloodRegionSelected ();
80 
81 DGNVIEW_EXPORT virtual DgnPlatform::RegionParams const& _GetRegionParams () = 0;
82 DGNVIEW_EXPORT virtual RegionCreateMode _GetRegionCreateMode () = 0;
83 DGNVIEW_EXPORT virtual BentleyStatus _OnProcessRegionResult (EditElementHandleR elHandle) = 0;
84 
92 DGNVIEW_EXPORT virtual StatusInt _DoComputeRegionResult (ElementAgendaR result, DgnButtonEventCR ev);
93 
96 DGNVIEW_EXPORT virtual void _GetRegionPreviewSymbology (UInt32& lineColorTBGR, UInt32& fillColorTBGR, UInt32& lineWeight, UInt32& lineStyle, ViewportR, DgnDrawMode);
97 
98 DGNVIEW_EXPORT virtual WCharCP _GetAssociativeRegionName () {return L"Associative Region";}
99 DGNVIEW_EXPORT virtual StatusInt _OnElementModify (EditElementHandleR eeh) {return ERROR;}
100 DGNVIEW_EXPORT virtual bool _WantProcessOriginals () {return false;}
101 DGNVIEW_EXPORT virtual bool _WantFloodDynamicArea () {return false;}
102 DGNVIEW_EXPORT virtual bool _AllowPhysicallyClosed () {return REGION_CREATE_ByParams == _GetRegionCreateMode ();}
103 DGNVIEW_EXPORT virtual bool _AcceptClosedElement (ElementHandleCR eh, WStringR cantAcceptReason);
104 
105 DGNVIEW_EXPORT virtual bool _IsModifyOriginal () override {return true;}
106 DGNVIEW_EXPORT virtual bool _DoGroups () override {return REGION_CREATE_Elements == _GetRegionCreateMode ();}
107 DGNVIEW_EXPORT virtual bool _WantDynamics () override {return REGION_CREATE_Points == _GetRegionCreateMode ();}
108 DGNVIEW_EXPORT virtual bool _WantAccuSnap () override {return REGION_CREATE_Points == _GetRegionCreateMode ();}
109 DGNVIEW_EXPORT virtual bool _WantAdditionalLocate (DgnButtonEventCP ev) override;
110 DGNVIEW_EXPORT virtual bool _NeedAcceptPoint () override;
111 DGNVIEW_EXPORT virtual bool _AcceptIdentifiesNext () override;
112 DGNVIEW_EXPORT virtual UsesDragSelect _AllowDragSelect () override;
113 
114 DGNVIEW_EXPORT virtual bool _CheckStop () override;
115 DGNVIEW_EXPORT virtual void _ResetStop () override;
116 
117 DGNVIEW_EXPORT virtual void _DrawTransients (ViewContextR context, bool isPreUpdate) override;
118 DGNVIEW_EXPORT virtual void _DecorateScreen (ViewportR vp) override;
119 
120 DGNVIEW_EXPORT virtual StatusInt _ProcessAgenda (DgnButtonEventCR ev) override;
121 DGNVIEW_EXPORT virtual void _HiliteAgendaEntries (bool changed) override;
122 DGNVIEW_EXPORT virtual void _UnHiliteAgendaEntries (bool empty) override;
123 
124 DGNVIEW_EXPORT virtual bool _OnPostLocate (HitPathCP path, WStringR cantAcceptReason) override;
125 DGNVIEW_EXPORT virtual bool _FilterAgendaEntries () override;
126 DGNVIEW_EXPORT virtual void _SetLocateCriteria () override;
127 DGNVIEW_EXPORT virtual void _SetupAndPromptForNextAction () override;
128 
129 DGNVIEW_EXPORT virtual void _OnDynamicFrame (DgnButtonEventCR ev) override;
130 DGNVIEW_EXPORT virtual bool _OnModelMotion (DgnButtonEventCR ev) override;
131 DGNVIEW_EXPORT virtual bool _OnModifierKeyTransition (bool wentDown, int key) override;
132 DGNVIEW_EXPORT virtual bool _OnModifyComplete (DgnButtonEventCR ev) override;
133 
134 DGNVIEW_EXPORT virtual bool _OnResetButton (DgnButtonEventCR ev) override;
135 DGNVIEW_EXPORT virtual bool _OnDataButton (DgnButtonEventCR ev) override;
136 DGNVIEW_EXPORT virtual void _OnUndoPreviousStep () override;
137 
138 DGNVIEW_EXPORT virtual void _OnCleanup () override;
139 DGNVIEW_EXPORT virtual void _OnPostInstall () override;
140 
142 virtual bool CDECL_ATTRIBUTE DummyDgnRegionElementTool1() {return false;}
143 virtual bool CDECL_ATTRIBUTE DummyDgnRegionElementTool2() {return false;}
144 virtual bool CDECL_ATTRIBUTE DummyDgnRegionElementTool3() {return false;}
145 virtual bool CDECL_ATTRIBUTE DummyDgnRegionElementTool4() {return false;}
146 virtual bool CDECL_ATTRIBUTE DummyDgnRegionElementTool5() {return false;}
148 
149 public:
150 
151 
152 DGNVIEW_EXPORT DgnRegionElementTool ();
153 
154 }; // DgnRegionElementTool
155 //@endgroup
156 
virtual bool _IsModifyOriginal() override
Don't copy the originals.
Definition: DgnRegionElementTool.h:105
bool empty() const
Definition: stdcxx/bstdmap.h:210
Definition: Bentley.h:212
Definition: ViewContext.h:358
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
#define CDECL_ATTRIBUTE
Definition: Bentley.h:68
virtual WCharCP _GetAssociativeRegionName()
Default cell name used when creating an Associative Region element.
Definition: DgnRegionElementTool.h:98
Create new region from a shape defined by points.
Definition: DgnRegionElementTool.h:37
Choose boundaries candiates for boolean or flood.
Definition: DgnRegionElementTool.h:43
virtual bool _WantProcessOriginals()
Return true if the tool wants to process the original elements that were directly involved in creatin...
Definition: DgnRegionElementTool.h:100
Definition: AssocRegionHandler.h:38
struct DgnPlatform::DgnButtonEvent const * DgnButtonEventCP
Definition: DgnPlatform.h:191
A writeable "handle" to an MSElement.
Definition: ElementHandle.h:470
RegionCreateMode
Definition: DgnRegionElementTool.h:33
Create new region from selected boundaries.
Definition: DgnRegionElementTool.h:44
struct CurveVector const & CurveVectorCR
Definition: msgeomstructs_typedefs.h:172
wchar_t const * WCharCP
Definition: Bentley.h:224
uint32_t UInt32
Definition: Bentley.r.h:128
Definition: IViewTransients.h:15
virtual bool _DoGroups() override
Whether to allow named and graphic groups.
Definition: DgnRegionElementTool.h:106
virtual bool _WantFloodDynamicArea()
Return true if the tool wants region flood dynamics using the current cursor location as the flood se...
Definition: DgnRegionElementTool.h:101
struct DgnPlatform::DgnButtonEvent const & DgnButtonEventCR
Definition: DgnPlatform.h:191
Process existing region elements (elements from ref attachments will be copied)
Definition: DgnRegionElementTool.h:35
3d point coordinates.
Definition: dpoint3d.h:19
struct DgnPlatform::HitPath const * HitPathCP
Definition: DgnPlatform.h:274
BentleyStatus
Definition: Bentley.h:208
The DgnElementSetTool class can be used to implement a modify command.
Definition: DgnElementSetTool.h:179
A bvector of EditElementHandle entries to be used for operating on groups of elements.
Definition: ElementAgenda.h:257
Definition: DgnRegionElementTool.h:27
virtual StatusInt _OnElementModify(EditElementHandleR eeh)
Called only if _WantProcessOriginals returns true. Invalidate eeh and return SUCCESS to delete elemen...
Definition: DgnRegionElementTool.h:99
#define DEFINE_T_SUPER(B)
Definition: Bentley.h:167
Create new region from a shape created from the active fence.
Definition: DgnRegionElementTool.h:38
Create new region from existing elements using boolean or flood (defined by region params) ...
Definition: DgnRegionElementTool.h:36
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
Process boundary candiates actually used to construct region.
Definition: DgnRegionElementTool.h:45
virtual bool _WantAccuSnap() override
Whether to enable AccuSnap.
Definition: DgnRegionElementTool.h:108
int StatusInt
Definition: Bentley.h:222
DgnDrawMode
Draw modes for displaying information in viewports.
Definition: DgnPlatform.h:1536
virtual bool _AllowPhysicallyClosed()
Return true to allow physically closed open paths as boundary candidates.
Definition: DgnRegionElementTool.h:102
struct DgnPlatform::ElementHandle const & ElementHandleCR
Definition: DgnPlatform.h:260
RegionToolPhase
Definition: DgnRegionElementTool.h:41
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51
virtual bool _WantDynamics() override
Whether to start tool dynamics.
Definition: DgnRegionElementTool.h:107
Definition: DgnViewport.h:186

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