IViewManager.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 
11 #if defined(__GNUC__)
12  #if !defined(GPP0x) && !defined(CPP0x)
13  #include <tr1/array>
14  #else
15  #include <array>
16  #endif
17 #else
18  #include <array>
19 #endif
23 #include <DgnPlatform/ViewInfo.h>
24 #include <DgnPlatform/QvViewport.h>
25 
26 struct StopEvents
27  {
28  bool m_keystrokes:1;
29  bool m_controlC:1;
30  bool m_wheel:1;
31  bool m_button:1;
32  bool m_paint:1;
33  bool m_focus:1;
35 
36  void Clear()
37  {
39  }
40 
41  StopEvents (bool keystrokes, bool controlC, bool wheel, bool button, bool paint, bool focus)
42  {
43  m_keystrokes = keystrokes;
44  m_controlC = controlC;
45  m_wheel = wheel;
46  m_button = button;
47  m_paint = paint;
48  m_focus = focus;
50  }
51 
52  /*---------------------------------------------------------------------------------**/
56  void SetStopOnModifierKey (bool stop) {m_modifierKeyTransition = stop;}
57  };
58 
59 
60 
61 
63 
64 /*=================================================================================**/
74 {
75 protected:
76 
77 /*---------------------------------------------------------------------------------**/
82 virtual bool _DrawDecoration (IndexedViewportR viewport) = 0;
83 };
84 
85 /*=================================================================================**/
89 {
90 
92 {
93  ModelTransientPurpose_Normal = 0,
94  ModelTransientPurpose_PreDisplayList = 1,
95  ModelTransientPurpose_PostDisplayList = 2
96 };
97 
98 protected:
99 /*---------------------------------------------------------------------------------**/
102 virtual void _DrawModelTransients (ViewContextR context, DgnModelRefR modelRef, ModelTransientPurpose purpose, void*& displayListUserData) = 0;
103 };
104 
105 
106 /*=================================================================================**/
112 {
113 
114 protected:
115 
116 /*---------------------------------------------------------------------------------**/
121 virtual void _OnViewChanged (ViewportP viewport) {}
122 
123 /*---------------------------------------------------------------------------------**/
128 virtual void _OnViewOpen (ViewportP viewport) {}
129 
130 /*---------------------------------------------------------------------------------**/
135 virtual void _OnViewClose (ViewportP viewport) {}
136 
137 /*---------------------------------------------------------------------------------**/
145 virtual void _OnGetViewTitle (ViewportP viewport, WStringR title) {}
146 
147 /*---------------------------------------------------------------------------------**/
153 virtual void _OnViewEnterOrExit (ViewportP viewport, int changeType) {}
154 
155 /*---------------------------------------------------------------------------------**/
161 virtual void _OnViewChangeJournalled (ViewportP viewport, ViewChangeType changeType) {}
162 
163 };
164 
166  {
179  };
180 /*=================================================================================**/
186 {
187 }; // IndexedViewport
188 
189 /*=================================================================================**/
194  {
195 public:
197  {
198  private:
199 
200  StopEvents m_stopEvents;
201  DgnModelRefListP m_includeList;
202  bool m_incremental;
203  bool m_deferShadows;
204  bool m_startEndMsg;
205  bool m_startAbortState;
206  bool m_useCachedElems;
207  BSIRect const* m_subRect;
208  FenceParamsP m_fp;
209 
210  public:
211  FullUpdateInfo () : m_stopEvents (false, true, true, true, false, false) // ctrl-c, wheel, button...
212  {
213  m_includeList = NULL;
214  m_incremental = false;
215  m_deferShadows = true;
216  m_startEndMsg = false;
217  m_startAbortState = false;
218  m_useCachedElems = true;
219  m_subRect = NULL;
220  m_fp = NULL;
221  }
222 
223  void SetStopEvents (StopEvents stopEvents) {m_stopEvents = stopEvents;}
224  void SetIncludeList (DgnModelRefListP includeList) {m_includeList = includeList;}
225  void SetIncremental (bool incremental) {m_incremental = incremental;}
226  void SetDeferShadows (bool deferShadows) {m_deferShadows = deferShadows;}
227  void SetStartEndMsg (bool startEndMsg) {m_startEndMsg = startEndMsg;}
228  void SetStartAbortState (bool startAbortState) {m_startAbortState = startAbortState;}
229  void SetUseCachedElems (bool useCachedElems) {m_useCachedElems = useCachedElems;}
230  void SetSubRect (BSIRect const* subRect) {m_subRect = subRect;}
231  void SetFenceParams (FenceParamsP fp) {m_fp = fp;}
232 
233  bool GetIncremental () const {return m_incremental;}
234  bool GetStartEndMsg() const {return m_startEndMsg;}
235  };
236 
238  {
239  private:
240 
241  StopEvents m_stopEvents;
242  DgnModelRefListP m_includeList;
243  bool m_doBackingStore;
244  bool m_deferShadows;
245  int m_maxFrameTime;
246  int m_dynamicsStopInterval;
247  int m_dynamicsMotionTolerance;
248  int m_minLodDelta;
249  bool m_haveLastMotion;
250  int m_lastTotalMotion;
251  Point2d m_lastCursorPos;
252 
253  public:
254  DGNVIEW_EXPORT DynamicUpdateInfo ();
255  Point2d& GetLastCursorPos() {return m_lastCursorPos;}
256  void ClearLastMotion () {m_haveLastMotion = false; m_lastTotalMotion = 0; m_lastCursorPos.x = m_lastCursorPos.y = 0;}
257  void SetStopEvents (StopEvents stopEvents) {m_stopEvents = stopEvents;}
258  void SetIncludeList (DgnModelRefListP includeList) {m_includeList = includeList;}
259  void SetDoBackingStore (bool doBackingStore) {m_doBackingStore = doBackingStore;}
260  void SetDeferShadows (bool deferShadows) {m_deferShadows = deferShadows;}
261  void SetMaxFrameTime (int maxFrameTime) {m_maxFrameTime = maxFrameTime;}
262  void SetMinLODDelta (int minLodDelta) {m_minLodDelta = minLodDelta;}
263  void SetDynamicsStopInterval (int dynamicsStopInterval) {m_dynamicsStopInterval = dynamicsStopInterval;}
264  void SetDynamicsMotionTolerance (int dynamicsMotionTolerance) {m_dynamicsMotionTolerance = dynamicsMotionTolerance;}
265  };
266 
267  typedef std::tr1::array<IndexedViewportP,MAX_VIEWS>::const_iterator const_iterator;
268  typedef const_iterator iterator; // we offer only a const_iterator, so tell FOR_EACH to choose it even when working with a non-const instance of this collection
269  DGNVIEW_EXPORT const_iterator begin () const;
270  DGNVIEW_EXPORT const_iterator end () const;
271 
272  DGNVIEW_EXPORT DgnHostR GetDgnHost();
273  DGNVIEW_EXPORT bool IsHealingEnabled();
274  DGNVIEW_EXPORT IndexedViewportP GetSelectedViewport();
275  DGNVIEW_EXPORT IndexedViewportP GetFirstOpenView();
276  DGNVIEW_EXPORT int GetSelectedView ();
277  DGNVIEW_EXPORT void GetViewTitle (WStringR viewTitle, int viewIndex);
278  DGNVIEW_EXPORT IndexedViewportP GetViewport (int viewNum);
279  DGNVIEW_EXPORT StatusInt SetViewport (int viewNum, IndexedViewportP vp);
280  DGNVIEW_EXPORT StatusInt ForgetViewport (int viewNum);
281  DGNVIEW_EXPORT UpdateAbortReason UpdateViewDynamic (IndexedViewportP vp, DynamicUpdateInfo& info);
282  DGNVIEW_EXPORT bool UpdateView (IndexedViewportP vp, DgnDrawMode drawMode, DrawPurpose drawPurpose, FullUpdateInfo& info);
283  DGNVIEW_EXPORT BentleyStatus SetSelectedView ( IndexedViewportP inVp, bool setActiveModel, bool fromButtonEvent );
284  };
285 
286 
287 /*=================================================================================**/
292 {
293 private:
294  virtual void MakeClassAbstract() = 0;
295 public:
296 public:
297  DGNVIEW_EXPORT static IViewManagerR GetManager();
298  DGNVIEW_EXPORT static IndexedViewSetR GetActiveViewSet();
300  DGNVIEW_EXPORT int GetCurrentViewNumber();
301  DGNVIEW_EXPORT bool IsGraphicsOn ();
302 
304 
305  DGNVIEW_EXPORT void AddViewDecoration (IViewDecoration* decorator);
306  DGNVIEW_EXPORT void DropViewDecoration (IViewDecoration* decoratorToDrop);
307  DGNVIEW_EXPORT void AddElementDecorator (IViewDecoration* decorator);
308  DGNVIEW_EXPORT void DropElementDecorator (IViewDecoration* decoratorToDrop);
309  DGNVIEW_EXPORT void AddViewMonitor (IViewMonitor* viewMonitor);
310  DGNVIEW_EXPORT void DropViewMonitor (IViewMonitor* viewMonitorToDrop);
311  DGNVIEW_EXPORT void AddViewTransientHandler (IViewTransientsP viewTransient);
312  DGNVIEW_EXPORT void DropViewTransientHandler (IViewTransientsP viewTransientToDrop);
313  DGNVIEW_EXPORT void AddModelTransientHandler (IModelTransientHandler& modelTransient);
314  DGNVIEW_EXPORT void DropModelTransientHandler (IModelTransientHandler& modelTransientToDrop);
315 
317 };
318 
320 
322 
const_iterator iterator
Definition: IViewManager.h:268
Definition: IViewManager.h:193
virtual void _OnViewEnterOrExit(ViewportP viewport, int changeType)
Called after the cursor enters or exits a viewport.
Definition: IViewManager.h:153
UpdateAbortReason
Definition: IViewManager.h:165
bool m_paint
Definition: IViewManager.h:32
Definition: ViewContext.h:358
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
Point2d & GetLastCursorPos()
Definition: IViewManager.h:255
Definition: IViewManager.h:176
bool m_controlC
Definition: IViewManager.h:29
virtual void _OnViewClose(ViewportP viewport)
Called after a view is closed.
Definition: IViewManager.h:135
void SetMinLODDelta(int minLodDelta)
Definition: IViewManager.h:262
Integer x,y rectangle coordinates.
Definition: BSIRect.h:24
Definition: IViewManager.h:167
FullUpdateInfo()
Definition: IViewManager.h:211
void SetIncludeList(DgnModelRefListP includeList)
Definition: IViewManager.h:224
Definition: IViewManager.h:173
Definition: IViewManager.h:174
void SetDynamicsStopInterval(int dynamicsStopInterval)
Definition: IViewManager.h:263
iterator begin()
Definition: stdcxx/bstdmap.h:178
ModelTransientPurpose
Definition: IViewManager.h:91
Definition: IViewManager.h:175
iterator end()
Definition: stdcxx/bstdmap.h:186
ViewChangeType
Enumeration describing the difference between two ViewInfo's.
Definition: ViewInfo.h:126
void SetDeferShadows(bool deferShadows)
Definition: IViewManager.h:260
DrawPurpose
Definition: DgnPlatform.h:1548
void Clear()
Definition: IViewManager.h:36
std::tr1::array< IndexedViewportP, MAX_VIEWS >::const_iterator const_iterator
Definition: IViewManager.h:267
void SetDynamicsMotionTolerance(int dynamicsMotionTolerance)
Definition: IViewManager.h:264
void SetMaxFrameTime(int maxFrameTime)
Definition: IViewManager.h:261
void SetStopEvents(StopEvents stopEvents)
Definition: IViewManager.h:223
Definition: IViewManager.h:169
Template to simplify the task of writing a class that implements the reference-counting pattern...
Definition: RefCounted.h:90
#define NULL
Definition: Bentley.h:157
Definition: IViewTransients.h:15
bool m_wheel
Definition: IViewManager.h:30
void SetSubRect(BSIRect const *subRect)
Definition: IViewManager.h:230
virtual void _OnViewChangeJournalled(ViewportP viewport, ViewChangeType changeType)
Called when a view change is saved to view Undo.
Definition: IViewManager.h:161
void SetDeferShadows(bool deferShadows)
Definition: IViewManager.h:226
A sub-class of Viewport that represents one of the 8 numbered views.
Definition: IViewManager.h:185
bool m_modifierKeyTransition
Definition: IViewManager.h:34
Definition: DgnHost.h:19
void SetStartAbortState(bool startAbortState)
Definition: IViewManager.h:228
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
BentleyStatus
Definition: Bentley.h:208
void SetStartEndMsg(bool startEndMsg)
Definition: IViewManager.h:227
A DgnModelRef provides access to a model in a Bentley::DgnPlatform::DgnFile.
Definition: DgnModelRef.h:172
Definition: IViewManager.h:291
IManager * GetManager()
Return a pointer to the one and only relationship manager.
void SetIncludeList(DgnModelRefListP includeList)
Definition: IViewManager.h:258
Definition: IViewManager.h:171
Definition: IViewManager.h:26
bool m_focus
Definition: IViewManager.h:33
void SetDoBackingStore(bool doBackingStore)
Definition: IViewManager.h:259
bool m_keystrokes
Definition: IViewManager.h:28
*//* Bentley Systems
Definition: DgnModelRef.h:67
Implement this interface to draw "decorations" in Viewports.
Definition: IViewManager.h:73
Implement IViewMonitor to receive notifications about significant events affecting ViewPorts...
Definition: IViewManager.h:111
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
Definition: IViewManager.h:177
int StatusInt
Definition: Bentley.h:222
bool GetStartEndMsg() const
Definition: IViewManager.h:234
void SetIncremental(bool incremental)
Definition: IViewManager.h:225
StopEvents(bool keystrokes, bool controlC, bool wheel, bool button, bool paint, bool focus)
Definition: IViewManager.h:41
bool m_button
Definition: IViewManager.h:31
DgnDrawMode
Draw modes for displaying information in viewports.
Definition: DgnPlatform.h:1536
virtual void _OnViewOpen(ViewportP viewport)
Called after a view is opened.
Definition: IViewManager.h:128
void SetUseCachedElems(bool useCachedElems)
Definition: IViewManager.h:229
Definition: IViewManager.h:168
void SetFenceParams(FenceParamsP fp)
Definition: IViewManager.h:231
void SetStopOnModifierKey(bool stop)
Stop when the ctrl or shift key is pressed or released.
Definition: IViewManager.h:56
Definition: IViewManager.h:172
void SetStopEvents(StopEvents stopEvents)
Definition: IViewManager.h:257
virtual void _OnViewChanged(ViewportP viewport)
Called after a view changes camera position or display settings.
Definition: IViewManager.h:121
An integer 2d point, useful for screen pixel references, but not for real geometry.
Definition: Point.h:20
bool GetIncremental() const
Definition: IViewManager.h:233
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51
Class for finding elements that are inside or overlap a volume defined by an extrusion of a planar re...
Definition: FenceParams.h:32
virtual void _OnGetViewTitle(ViewportP viewport, WStringR title)
Called to obtain the title string to display in the view's titlebar.
Definition: IViewManager.h:145
void ClearLastMotion()
Definition: IViewManager.h:256
Definition: DgnViewport.h:186

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