DgnViewport.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 <Bentley/WString.h>
12 #include "IViewOutput.h"
13 #include "DisplayStyleManager.h"
14 #include "ColorUtil.h"
15 #include "ViewInfo.h"
16 
17 
19 
20 /*=================================================================================**/
28 /*=================================================================================**/
33 {
46  bool m_unused2;
47 
48  enum FitModes
49  {
50  FITMODE_All = 0,
51  FITMODE_Active = 1,
52  FITMODE_Reference = 2,
53  FITMODE_Raster = 3,
54  };
55 
57  {
58  m_viewport = vp;
59  m_rMatrix = NULL;
60  m_modelIfNoViewport = NULL;
61  m_fitList = NULL;
62  m_fitRasterRefs = m_rasterElementsOnly = m_includeTransients = m_useScanRange = m_fitMinDepth = m_fitMaxDepth = m_onlyInFitList = false;
63  m_unused2 = m_ignoreCallouts = false;
64  }
65 
66  DGNPLATFORM_EXPORT void SetupFitList(FitModes fitModes);
67 };
68 
69 /*=================================================================================**/
73  {
75  KeepCurrent = 0,
76 
78  RelativeRect = 1,
79 
81  AspectRatio = 2,
82 
84  Size = 3,
85 
87  SizeAndPosition = 4,
88  };
89 
90 /*=================================================================================**/
98 {
99 private:
100  ViewportResizeMode m_resizeMode;
101  bool m_applyVolume;
102  bool m_applyAttributes;
103  bool m_applyLevels;
104  bool m_applyRefLevels;
105  bool m_applyClipVolume;
106  bool m_applyModel;
107  bool m_createNamedViewDisplayableForClipping;
108  bool m_applyClipWithoutBoundary;
109  bool m_applyRightIsoCameraPosition;
110  bool m_applyAnnotationAttachment;
111  int m_annotationAttachmentDrawingIndex;
112  UInt32 m_reservedInts[8];
113  bool m_reservedBools[8];
114 
115 public:
118  DGNPLATFORM_EXPORT ApplyViewOptions (bool initFromActive);
119  ViewportResizeMode GetViewportResizeMode () const { return m_resizeMode; }
120  bool GetApplyVolume () const { return m_applyVolume; }
121  bool GetApplyAttributes () const { return m_applyAttributes; }
122  bool GetApplyLevels () const { return m_applyLevels; }
123  bool GetApplyRefLevels () const { return m_applyRefLevels; }
124  bool GetApplyClipVolume () const { return m_applyClipVolume; }
125  bool GetApplyModel () const { return m_applyModel; }
126  bool GetCreateNamedViewDisplayableForClipping () const { return m_createNamedViewDisplayableForClipping; }
127  bool GetApplyClipWithoutBoundary () const { return m_applyClipWithoutBoundary; }
128  bool GetApplyRightIsoCameraPosition () const { return m_applyRightIsoCameraPosition; }
129  bool GetApplyAnnotationAttachment() const { return m_applyAnnotationAttachment; }
130  int GetAnnotationAttachmentDrawingIndex() const { return m_annotationAttachmentDrawingIndex; }
131 
134  void SetViewportResizeMode (ViewportResizeMode mode) { m_resizeMode = mode; }
135 
138  void SetApplyVolume (bool state) { m_applyVolume = state; }
139 
142  void SetApplyAttributes (bool state) { m_applyAttributes = state; }
143 
146  void SetApplyLevels (bool state) { m_applyLevels = state; }
147 
150  void SetApplyRefLevels (bool state) { m_applyRefLevels = state; }
151 
154  void SetApplyClipVolume (bool state) { m_applyClipVolume = state; if (m_applyClipVolume) m_applyClipWithoutBoundary = false; }
155 
158  void SetApplyModel (bool state) { m_applyModel = state; }
159 
162  void SetCreateNamedViewDisplayableForClipping (bool state) { m_createNamedViewDisplayableForClipping = state; }
163 
166  void SetApplyClipWithoutBoundary (bool state) { m_applyClipWithoutBoundary = state; if (m_applyClipWithoutBoundary) m_applyClipVolume = false; }
167 
170  void SetApplyRightIsoCameraPosition (bool state) { m_applyRightIsoCameraPosition = state; }
171 
174  void SetApplyAnnotationAttachment (bool state) { m_applyAnnotationAttachment = state; }
175 
178  void SetAnnotationAttachmentDrawingIndex (int index) { m_annotationAttachmentDrawingIndex = index; }
179  DGNPLATFORM_EXPORT void SetApplyAll (bool state);
180 };
181 
182 //=======================================================================================
183 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
184 // @bsiclass Bentley Systems
185 //=======================================================================================
187 {
188 private:
189  virtual void MakeClassAbstract() = 0;
190 public:
191 public:
192 
194 DGNPLATFORM_EXPORT IViewDrawP GetIViewDraw ();
195 
197 DGNPLATFORM_EXPORT IViewOutputP GetIViewOutput ();
198 
200 DGNPLATFORM_EXPORT ICachedDrawP GetICachedDraw ();
201 
204 DGNPLATFORM_EXPORT void SetNeedsRefresh ();
205 
210 DGNPLATFORM_EXPORT RotMatrixCP GetRotMatrix () const;
211 
215 DGNPLATFORM_EXPORT DPoint3dCP GetScale () const;
216 
220 DGNPLATFORM_EXPORT double GetActiveZRoot () const;
221 
225 DGNPLATFORM_EXPORT void GetCameraView (CameraParams*) const;
226 
231 DGNPLATFORM_EXPORT CameraParams const* GetCameraRoot () const;
232 
237 DGNPLATFORM_EXPORT StatusInt GetCameraTarget (DPoint3dP) const;
238 
243 DGNPLATFORM_EXPORT StatusInt GetClipBoundElemHandle (EditElementHandleR) const;
244 
249 DGNPLATFORM_EXPORT StatusInt GetClipMaskElemHandle (EditElementHandleR) const;
250 
255 DGNPLATFORM_EXPORT ElementRefP GetClipBoundElementRef () const;
256 
261 DGNPLATFORM_EXPORT ElementRefP GetClipMaskElementRef () const;
262 
263 DGNPLATFORM_EXPORT void SetTemporaryClipElementRef (ElementRefP element);
264 DGNPLATFORM_EXPORT void SetTemporaryClipMaskElementRef (ElementRefP element);
265 
269 DGNPLATFORM_EXPORT DMap4dCP GetRootToViewMap ();
270 
274 DGNPLATFORM_EXPORT DMap4dCP GetRootToNpcMap ();
275 
280 DGNPLATFORM_EXPORT DMap4dCP GetActiveToRootMap () const;
281 
289 DGNPLATFORM_EXPORT int GetIndexedLineWidth (int index) const;
290 
297 DGNPLATFORM_EXPORT UInt32 GetIndexedLinePattern (int index) const;
298 
300 
301 
305 DGNPLATFORM_EXPORT UInt32 GetBackgroundColor () const;
306 
309 DGNPLATFORM_EXPORT UInt32 GetContrastToBackgroundColor () const;
310 
320 DGNPLATFORM_EXPORT UInt32 AdjustColorForContrast (UInt32 thisColor, UInt32 againstColor) const;
321 
329 DGNPLATFORM_EXPORT static UInt32 MakeTrgbColor (int red, int green, int blue, int transparency);
330 
336 DGNPLATFORM_EXPORT static UInt32 MakeColorTransparency (UInt32 color, int transparency);
337 
345 DGNPLATFORM_EXPORT static UInt32 MakeTransparentIfOpaque (UInt32 color, int transparency);
346 
348 DGNPLATFORM_EXPORT void ResynchColorMap ();
349 
353 DGNPLATFORM_EXPORT UInt32 GetHiliteColor () const;
354 
360 DGNPLATFORM_EXPORT UInt32 GetHiliteColor (DisplayPathCP path) const;
361 
368 DGNPLATFORM_EXPORT void SetSymbologyRgb (UInt32 lineColorTBGR, UInt32 fillColorTBGR, int lineWidth, int lineCodeIndex);
370 
372 
373 DGNPLATFORM_EXPORT void GetViewBox (DPoint3dP pts, DgnCoordSystem sys, bool adjustedBox) const;
387 
391 DGNPLATFORM_EXPORT void GetViewRect (BSIRect& rect) const;
392 
398 DGNPLATFORM_EXPORT void GetViewCorners (DPoint3dR low, DPoint3dR high) const;
399 
407 DGNPLATFORM_EXPORT void NpcToView (DPoint3dP viewPts, DPoint3dCP npcPts, int nPts) const;
408 
416 DGNPLATFORM_EXPORT void ViewToNpc (DPoint3dP npcPts, DPoint3dCP viewPts, int nPts) const;
417 
425 DGNPLATFORM_EXPORT void NpcToRoot (DPoint3dP rootPts, DPoint3dCP npcPts, int nPts) const;
426 
434 DGNPLATFORM_EXPORT void RootToNpc (DPoint3dP npcPts, DPoint3dCP rootPts, int nPts) const;
435 
443 DGNPLATFORM_EXPORT void RootToView (DPoint4dP viewPts, DPoint3dCP rootPts, int nPts) const;
444 
452 DGNPLATFORM_EXPORT void ViewToRoot (DPoint3dP rootPts, DPoint4dCP viewPts, int nPts) const;
453 
461 DGNPLATFORM_EXPORT void RootToView (DPoint3dP viewPts, DPoint3dCP rootPts, int nPts) const;
462 
470 DGNPLATFORM_EXPORT void RootToView2d (DPoint2dP viewPts, DPoint3dCP rootPts, int nPts) const;
471 
479 DGNPLATFORM_EXPORT void ViewToRoot (DPoint3dP rootPts, DPoint3dCP viewPts, int nPts) const;
480 
488 DGNPLATFORM_EXPORT void ActiveToView (DPoint3dP viewPts, DPoint3dCP activePts, int nPts) const;
489 
497 DGNPLATFORM_EXPORT void ViewToActive (DPoint3dP activePts, DPoint3dCP viewPts, int nPts) const;
498 
506 DGNPLATFORM_EXPORT void ActiveToRoot (DPoint3dP rootPts, DPoint3dCP activePts, int nPts) const;
507 
515 DGNPLATFORM_EXPORT void RootToActive (DPoint3dP activePts, DPoint3dCP rootPts, int nPts) const;
516 
521 DGNPLATFORM_EXPORT void ActiveToRoot (RotMatrixR rootRMatrix, RotMatrixCR activeRMatrix) const;
522 
527 DGNPLATFORM_EXPORT void RootToActive (RotMatrixR activeRMatrix, RotMatrixCR rootRMatrix) const;
528 
536 DGNPLATFORM_EXPORT void ViewToScreen (DPoint3dP screenPts, DPoint3dCP viewPts, int nPts) const;
537 
545 DGNPLATFORM_EXPORT void ScreenToView (DPoint3dP viewPts, DPoint3dCP screenPts, int nPts) const;
547 
548 DGNPLATFORM_EXPORT void SetMinimumLOD (double minLOD);
549 
551 
552 DGNPLATFORM_EXPORT bool IsActive () const;
557 
562 DGNPLATFORM_EXPORT bool IsCameraOn () const;
563 
567 DGNPLATFORM_EXPORT bool IsGridOn () const;
568 
572 DGNPLATFORM_EXPORT bool Is3dModel () const;
573 
576 DGNPLATFORM_EXPORT bool IsSheetView () const;
577 
581 DGNPLATFORM_EXPORT DgnModelP GetRootModel () const;
582 
586 DGNPLATFORM_EXPORT DgnModelRefP GetTargetModel () const;
587 
590 DGNPLATFORM_EXPORT ViewInfoCP GetViewInfoCP () const;
591 
594 DGNPLATFORM_EXPORT ViewInfoP GetViewInfoP ();
595 
599 DGNPLATFORM_EXPORT void GetViewName (WStringR name);
600 
605 DGNPLATFORM_EXPORT int GetViewNumber () const;
606 
608 DGNPLATFORM_EXPORT int GetScreenNumber () const;
609 
612 DGNPLATFORM_EXPORT DPoint3dCP GetViewOrigin () const;
613 
616 DGNPLATFORM_EXPORT DPoint3dCP GetViewDelta () const;
617 
620 DGNPLATFORM_EXPORT ViewFlagsCP GetViewFlags () const;
621 
628 DGNPLATFORM_EXPORT double GetPixelSizeAtPoint (DPoint3dCP rootPt, DgnCoordSystem coordSys = DgnCoordSystem::Root) const;
630 
632 
633 DGNPLATFORM_EXPORT StatusInt Scroll (Point2dCP viewDist);
640 
652 DGNPLATFORM_EXPORT StatusInt Zoom (DPoint3dCP newCenterRoot, double factor, bool normalizeCamera);
653 
661 DGNPLATFORM_EXPORT StatusInt SetupFromFrustum (DPoint3dCP frustPts);
663 
665 DGNPLATFORM_EXPORT BentleyStatus SynchWithViewInfo (bool saveInUndo, bool updateViewTitle);
666 
668 DGNPLATFORM_EXPORT StatusInt ComputeFittedElementRange (DRange3dR range, IElementSetR elements, RotMatrixCP rMatrix);
669 
671 DGNPLATFORM_EXPORT StatusInt ComputeDisplayedModelRefRange (DRange3dR range, DgnModelRefP modelRef, bool includeChildren, FitViewParams& fitParams);
672 
673 
674 };
675 
676 
678 
680 
struct RotMatrix const * RotMatrixCP
Definition: msgeomstructs_typedefs.h:135
3x3 matrix commonly used for pure rotations, but in general may also have scales and non-perpendicula...
Definition: rotmatrix.h:21
void SetViewportResizeMode(ViewportResizeMode mode)
Sets the current ViewportResizeMode.
Definition: DgnViewport.h:134
bool GetApplyVolume() const
Gets whether the view volume is applied.
Definition: DgnViewport.h:120
bool m_fitMinDepth
Definition: DgnViewport.h:42
bool m_fitMaxDepth
Definition: DgnViewport.h:43
bool GetCreateNamedViewDisplayableForClipping() const
Gets whether the displayable element for the named view is to be created and used for clipping...
Definition: DgnViewport.h:126
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
struct DPoint3d const * DPoint3dCP
Definition: msgeomstructs_typedefs.h:79
Definition: DgnViewport.h:32
bool m_includeTransients
Definition: DgnViewport.h:40
The viewport is resized to match the exact size specifed in viewPortInfo.
Integer x,y rectangle coordinates.
Definition: BSIRect.h:24
int GetAnnotationAttachmentDrawingIndex() const
Gets the Drawing Index for an Annotation Attachment.
Definition: DgnViewport.h:130
ViewportP m_viewport
Definition: DgnViewport.h:34
struct DMap4d const * DMap4dCP
Definition: msgeomstructs_typedefs.h:98
DgnCore implements this interface to provide the display system for Viewports.
Definition: IViewDraw.h:790
A writeable "handle" to an MSElement.
Definition: ElementHandle.h:470
Definition: IViewOutput.h:89
void SetApplyRefLevels(bool state)
Sets whether the view level masks are applied to DgnAttachment reference models.
Definition: DgnViewport.h:150
The parameters the define the position and focal length of a MicroStation camera. ...
Definition: IViewOutput.h:20
struct RotMatrix const & RotMatrixCR
Definition: msgeomstructs_typedefs.h:135
Begin/End announcements around cached drawing sequences.
Definition: IViewDraw.h:876
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
void SetCreateNamedViewDisplayableForClipping(bool state)
Sets whether the displayable element for the named view is to be created and used for clipping...
Definition: DgnViewport.h:162
bool GetApplyClipVolume() const
Gets whether the view clip volume is applied.
Definition: DgnViewport.h:124
uint32_t UInt32
Definition: Bentley.r.h:128
#define NULL
Definition: Bentley.h:157
bool m_unused2
Definition: DgnViewport.h:46
4d point coordinates.
Definition: dpoint4d.h:17
ViewportResizeMode
Definition: DgnViewport.h:72
bool GetApplyRightIsoCameraPosition() const
Gets whether the viewing angle is to be set to Right Isometric.
Definition: DgnViewport.h:128
This interface provides a transparent way to provide access to a collection of ElemHandles.
Definition: ElementHandle.h:726
The viewport is resized to the same size, relative to the available area, that is specifed in viewPor...
bool m_rasterElementsOnly
Definition: DgnViewport.h:39
void SetApplyRightIsoCameraPosition(bool state)
Sets whether the viewing angle is to be set to Right Isometric.
Definition: DgnViewport.h:170
struct DgnPlatform::DisplayPath const * DisplayPathCP
Definition: DgnPlatform.h:236
A DgnModel represents a DgnModel in memory.
Definition: DgnModel.h:236
FitViewParams(ViewportP vp)
Definition: DgnViewport.h:56
bool m_fitRasterRefs
Definition: DgnViewport.h:38
FitModes
Definition: DgnViewport.h:48
3d point coordinates.
Definition: dpoint3d.h:19
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
BentleyStatus
Definition: Bentley.h:208
A DgnModelRef provides access to a model in a Bentley::DgnPlatform::DgnFile.
Definition: DgnModelRef.h:172
The viewport is resized to match the aspect ratio of the viewInfo.
void SetApplyClipVolume(bool state)
Sets whether the view clip volume is applied.
Definition: DgnViewport.h:154
bool m_ignoreCallouts
Definition: DgnViewport.h:45
bool m_onlyInFitList
Definition: DgnViewport.h:44
void SetApplyAnnotationAttachment(bool state)
Sets whether to apply an Annotation Attachment.
Definition: DgnViewport.h:174
bool m_useScanRange
Definition: DgnViewport.h:41
bool GetApplyRefLevels() const
Gets whether the view level masks are applied to DgnAttachment reference models.
Definition: DgnViewport.h:123
void SetApplyVolume(bool state)
Sets whether the view volume is applied.
Definition: DgnViewport.h:138
Definition: DgnViewport.h:97
void SetApplyClipWithoutBoundary(bool state)
Sets whether clipping is to be applied without using the boundary.
Definition: DgnViewport.h:166
Interface that provides direct and efficient access to element data.
Definition: ElementRefBase.h:120
*//* Bentley Systems
Definition: DgnModelRef.h:67
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
DgnCoordSystem
Definition: DgnPlatform.h:1045
bool GetApplyLevels() const
Gets whether the view level masks are applied to the root model.
Definition: DgnViewport.h:122
RotMatrixCP m_rMatrix
Definition: DgnViewport.h:35
int StatusInt
Definition: Bentley.h:222
bool GetApplyClipWithoutBoundary() const
Gets whether clipping is to be applied without using the boundary.
Definition: DgnViewport.h:127
struct DgnPlatform::ViewFlags const * ViewFlagsCP
Definition: DgnPlatform.h:471
ViewportResizeMode GetViewportResizeMode() const
Gets the current ViewportResizeMode.
Definition: DgnViewport.h:119
bool GetApplyModel() const
Gets whether the root model from the source view is to be used in the destination view...
Definition: DgnViewport.h:125
The viewport is resized to match the exact size specified in viewPortInfo, and moved to the position ...
The viewport size is unchanged (this is the default). The viewport is unchanged, and the view content...
void SetApplyLevels(bool state)
Sets whether the view level masks are applied to the root model.
Definition: DgnViewport.h:146
struct DPoint4d const * DPoint4dCP
Definition: msgeomstructs_typedefs.h:96
DgnModelRefListP m_fitList
Definition: DgnViewport.h:37
bool GetApplyAnnotationAttachment() const
Gets whether to apply an Annotation Attachment.
Definition: DgnViewport.h:129
This is what the parameters to the camera methods, and the values stored by ViewInfo mean...
Definition: ViewInfo.h:213
void SetAnnotationAttachmentDrawingIndex(int index)
Sets the Drawing Index for an Annotation Attachment.
Definition: DgnViewport.h:178
struct DgnPlatform::ViewInfo const * ViewInfoCP
Definition: DgnPlatform.h:478
DgnModelP m_modelIfNoViewport
Definition: DgnViewport.h:36
void SetApplyAttributes(bool state)
Sets whether the view attributes are applied.
Definition: DgnViewport.h:142
A 3d low and high corner pair for range boxes.
Definition: drange3d.h:20
Integer x,y rectangle coordinates for GUI: BSIRect.
2d point coordinates.
Definition: dpoint2d.h:23
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51
Definition: DgnViewport.h:186
bool GetApplyAttributes() const
Gets whether the view attributes are applied.
Definition: DgnViewport.h:121
void SetApplyModel(bool state)
Sets whether the root model from the source view is to be used in the destination view...
Definition: DgnViewport.h:158

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