CFx SDK Documentation  2023 SP0
FxViewDrawInfo.h
Go to the documentation of this file.
1 //
2 // (C) Copyright 2005-2022 by Graebert GmbH.
3 //
4 // Permission to use, copy, modify, and distribute this software in
5 // object code form for any purpose and without fee is hereby granted,
6 // provided that the above copyright notice appears in all copies and
7 // that both that copyright notice and the limited warranty and
8 // restricted rights notice below appear in all supporting
9 // documentation.
10 //
11 // GRAEBERT PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
12 // GRAEBERT SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
13 // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. GRAEBERT GMBH
14 // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
15 // UNINTERRUPTED OR ERROR FREE.
16 
17 #pragma once
18 
19 #include "FxPragmaPush.h"
20 
21 #include "DDKERNEL.h"
22 #include "FxDebug.h"
23 #include "FxDatabase.h"
24 #include <Ge/GeExtents3d.h>
25 #include <Gi/GiClipBoundary.h>
26 #include <Gi/GiCommonDraw.h>
27 #include <Gs/Gs.h>
28 
29 #include <DbObjectId.h>
30 #include <DbRasterVariables.h>
31 #include <StringArray.h>
32 #include <DbStubPtrArray.h>
33 
40 class CFxView;
41 class CFxDatabase;
42 class CFxPicture;
43 
44 const double kMAX_VALID_DEPTH_RANGE = 1.0e+250;
45 
47 {
48 public:
50 
51  virtual ~CFxViewDrawInfo(void);
52 
54  const OdGePoint3d& position,
55  const OdGePoint3d& target,
56  const OdGeVector3d& upVector,
57  double fieldWidth,
58  double fieldHeight,
59  OdGsView::Projection projectionType = OdGsView::kParallel);
60 
61  void InitializeViewByExtents( const OdGeExtents3d& extents );
62 
63  void InitializeOutputSize( double width, double height );
64 
65  void InitializePalette( const ODCOLORREF* pPalette );
66 
67  void InitializeDatabase( const CFxDatabase* pDatabase );
68 
69  bool InitializeFromFxView( const CFxView* pFxView );
70 
75  bool InitializeFromDbViewport( OdDbObjectId idViewport, int width, int height, bool isPlotGeneration );
76  inline bool GetFILLMODE() const
77  {
78  return m_bFillMode;
79  }
80 
81  inline bool GetQTEXTMODE() const
82  {
83  return m_bQTextMode;
84  }
85 
86  inline bool GetXCLIPFRAME() const
87  {
88  return m_bXClipFrame;
89  }
90 
91  inline bool GetDrawImages() const
92  {
93  return m_bDrawImages;
94  }
95 
96  void SetDrawImages(bool bVal)
97  {
98  m_bDrawImages = bVal;
99  }
100 
101  inline bool GetTEXTFILL() const
102  {
103  return m_bTextFill;
104  }
105 
106  inline OdInt16 GetFxCadWindowId() const
107  {
108  return m_FxCadWindowId;
109  }
110 
112  {
113  return m_idViewport;
114  }
115 
117  {
118  return m_iImageFrame;
119  }
120 
122  {
123  m_iImageFrame = frameSettings;
124  }
125 
126  inline bool IsPlotGeneration() const
127  {
128  ASSERT( m_bPlotGeneration ? !IsExtentsCalculationActive() : true );
129  return m_bPlotGeneration;
130  }
131 
132  inline bool UseGsModel() const
133  {
134  if ( !m_pFxDatabase )
135  return( true );
136  return m_bUseGsModel;
137  }
138 
139  virtual void SetUseGsModel( bool bVal )
140  {
141  m_bUseGsModel = bVal;
142  }
143 
145  {
146  m_bUseTransparency = value;
147  }
148 
149  inline bool UseTransparency() const
150  {
151  return m_bUseTransparency;
152  }
153 
154  inline bool IsInitialUpdate() const
155  {
156  return m_bInitialUpdate;
157  }
158 
159  inline bool IsDrawSkipped() const
160  {
161  return m_bDrawSkipped;
162  }
163 
164  inline void SetDrawSkipped( bool bVal )
165  {
166  m_bDrawSkipped = bVal;
167  }
168 
169  inline bool IsInsideSelect() const
170  {
171  return m_bIsInsideSelect;
172  }
173 
174  void SetInsideSelect( bool bVal )
175  {
176  m_bIsInsideSelect = bVal;
177  }
178 
179  inline OdUInt16 GetVIEWRES() const
180  {
181  return m_VIEWRES;
182  }
183 
184  inline bool IsPerspective() const
185  {
186  return m_bPerspective;
187  }
188 
189  inline double GetPixelWidth() const
190  {
191  return m_dPixelWidth;
192  }
193 
194  inline double GetPixelHeight() const
195  {
196  return m_dPixelHeight;
197  }
198 
199  inline double GetVisiblePixelWidth() const
200  {
201  return m_dVisiblePixelWidth;
202  }
203 
204  inline double GetVisiblePixelHeight() const
205  {
206  return m_dVisiblePixelHeight;
207  }
208 
209  inline double GetFrontClip() const
210  {
211  return m_dFrontClip;
212  }
213 
214  inline double GetBackClip() const
215  {
216  return m_dBackClip;
217  }
218 
219  inline void SetFrontClip( const double& z )
220  {
221  m_dFrontClip = z;
222  }
223 
224  inline void SetBackClip( const double& z )
225  {
226  m_dBackClip = z;
227  }
228 
229  inline bool IsFrontClipped() const
230  {
231  return m_bFrontClipped;
232  }
233 
234  inline bool IsBackClipped() const
235  {
236  return m_bBackClipped;
237  }
238 
239  inline double GetFocalLength() const
240  {
241  return m_dFocalLength;
242  }
243 
244  inline const OdGeVector3d& GetViewDir() const
245  {
246  return m_ViewDir;
247  }
248 
249  inline const OdGePoint3d& GetPosition() const
250  {
251  return m_Position;
252  }
253 
254  inline const OdGeVector3d& GetUpVector() const
255  {
256  return m_UpVector;
257  }
258 
259  inline const OdGePoint3d& GetTarget() const
260  {
261  return m_Target;
262  }
263 
264  inline double GetFieldWidth() const
265  {
266  return m_FieldWidth;
267  }
268 
269  inline double GetFieldHeight() const
270  {
271  return m_FieldHeight;
272  }
273 
274  inline bool IsRapidMode() const
275  {
276  return m_bRapidMode;
277  }
278 
280  {
281  return m_InitialActiveAreaInViewCoordinates;
282  }
283 
285  {
286  ASSERT( rect.maxPoint().x > rect.minPoint().x );
287  ASSERT( rect.maxPoint().y > rect.minPoint().y );
288  m_InitialActiveAreaInViewCoordinates = rect;
289  }
290 
291  virtual void SetInitialActiveAreaByViewport( const CFxView* );
292 
293  void SetInitialActiveAreaByWCSContour( const CFxView* pFxView, const OdGePoint3d* pointsWCS, int nPoints );
294  void SetInitialActiveAreaByEYEContour( const CFxView* pFxView, const OdGePoint2d* pointsEYE, int nPoints );
295 
297  {
298  const ODCOLORREF* pPalette = GetPalette();
299  ODCOLORREF odColor = pPalette[0];
300  return odColor;
301  }
302 
304  {
305  const ODCOLORREF* pPalette = GetPalette();
306  ODCOLORREF odColor = pPalette[7];
307  return odColor;
308  }
309 
310  const ODCOLORREF* GetPalette() const
311  {
312  return (const ODCOLORREF*)(&m_Palette);
313  }
314 
315  ODCOLORREF GetColor( OdUInt16 colorIndex ) const
316  {
317  return GetPalette()[colorIndex];
318  }
319 
321  {
322  return m_RenderMode;
323  }
325  {
326  m_RenderMode = mode;
327  }
328 
329  inline bool IsDragging() const
330  {
331  return m_bDragging;
332  }
333 
334  void SetIsDragging( bool bVal )
335  {
336  m_bDragging = bVal;
337  }
338 
339  inline bool IsFadeMode() const
340  {
341  return m_bFadeMode;
342  }
343 
344  void SetFadeMode( bool bVal )
345  {
346  m_bFadeMode = bVal;
347  }
348 
350  {
351  kNone = 0,
352  kHidden = 1,
353  kHighlight = 2, // use dashed lines
354  kNegativeHighlight = 4, // use dashed lines and background color
355  kTrackHighlight = 8, // use thick hatched lines
356  kDrawAttDefs = 16, // draw attdefs
357  kDisableDepth = 32, // disable depth
358  kRenderMode2D = 64, // forces 2d render mode to be used
359  kFaded = 128, // use faded lines
360  kXeDangling = 256, // dangling dimension highlight
361  kXeDragHighlight = 512 // entities being dragged
362  };
363 
365  {
366  return m_eDrawDecoration;
367  }
368 
370  {
371  m_eDrawDecoration = eDD;
372  }
373 
378  inline bool IsExtentsCalculationActive() const
379  {
380  return m_bExtentsCalculation;
381  }
382 
387  void SetExtentsCalculationActive( bool bVal )
388  {
389  m_bExtentsCalculation = bVal;
390  }
391 
396  inline OdInt32 GetDebugMode() const
397  {
398  return m_DebugMode;
399  }
400 
401  inline const CFxDatabase* GetFxDatabase() const
402  {
403  return m_pFxDatabase;
404  }
405 
407 
409 
411  {
412  return m_FrozenLayerList;
413  }
414 
416  {
417  m_FrozenLayerList = ids;
418  }
419 
420  inline bool UseLinetyper() const
421  {
422  return m_bUseLinetyper;
423  }
424  void SetUseLinetyper( bool bUse)
425  {
426  m_bUseLinetyper = bUse;
427  }
428 
429  inline bool UseLineWeights() const
430  {
431  return m_bUseLineWeights;
432  }
433  void SetUseLineWeights( bool bUse)
434  {
435  m_bUseLineWeights = bUse;
436  }
437 
439  {
440  return m_dLineweightToDcScaleOverride;
441  }
442 
443  void SetLineweightToDCScaleOverride(double dLineweightToDCScale = 0)
444  {
445  m_dLineweightToDcScaleOverride = dLineweightToDCScale;
446  }
447 
448  //it is not recommended to use this member
449  inline const CFxView* GetFxView() const
450  {
451  return m_pFxView;
452  }
453 
454  inline int GetPDFFRAME() const
455  {
456  return m_iPDFFrame;
457  }
458 
459  inline double GetLensLength() const
460  {
461  return m_dLensLength;
462  }
463  void SetLensLength(double dLensLength)
464  {
465  m_dLensLength = dLensLength;
466  }
467 
469  {
470  return m_EyeToOutput;
471  }
472 
473  void SetEyeToOutput( const OdGeMatrix3d& rMatrix )
474  {
475  m_EyeToOutput = rMatrix;
476  }
477 
478  inline const OdGsDCRectDouble& GetScreenRect() const
479  {
480  return m_dScreenRect;
481  }
482 
484  {
485  return m_visibleScreenRect;
486  }
487 
489  {
490  return m_visibleScreenRectInViewCoordinates;
491  }
492 
493  static int GetCadWindowId( OdDbObjectId idViewport );
494 
496 
497  static OdGeMatrix3d GetAdjustedProjectionMatrix( const CFxViewDrawInfo* pInfo, double dNearEye, double dFarEye );
498 
501 
502  void SetScalePixelSize( double scale );
503 
504  inline bool HardwareTransformationsAllowed() const
505  {
506  return m_bHardwareTransformationsAllowed;
507  }
508 
509  void AllowHardwareTransformations( bool bVal );
510 
511  const OdDbObjectId& GetLayoutId( bool &isModel ) const;
512 
513  bool IsScalingLineweights() const;
514 
515  void SetClipBoundary( const OdGiClipBoundary * pClipBoundary );
516 
518 
519 protected:
522 
525 
526  ODCOLORREF m_Palette[256];
527 
529 
531 
533 
535 
536  double m_FieldWidth;
537 
539 
541 
543 
545 
547 
549 
551 
553 
555 
557 
559 
561 
563 
565 
567 
569 
571 
573 
574  double m_dFrontClip;
575 
576  double m_dBackClip;
577 
579 
581 
583 
585 
587 
589 
591 
593 
595 
597 
599 
601 
605 
607 
609 
610  //it is not recommended to use this member
612 
614 
616 
618 
620 
622 
624 
626 
628 
630 
632 };
633 
634 #include "FxPragmaPop.h"
@ kHighlight
Definition: BrEnums.h:116
#define DDKERNEL_API
Definition: DDKERNEL.h:32
scale
Definition: DimVarDefs.h:1684
#define ASSERT(x)
Definition: FxDebug.h:257
const double kMAX_VALID_DEPTH_RANGE
#define ODCOLORREF
Definition: OdPlatform.h:883
short OdInt16
unsigned short OdUInt16
int OdInt32
bool m_bHardwareTransformationsAllowed
int GetPDFFRAME() const
double GetVisiblePixelWidth() const
const OdGiClipBoundary * m_pClipBoundary
OdGsView::RenderMode m_RenderMode
void SetBackClip(const double &z)
void InitializePalette(const ODCOLORREF *pPalette)
bool IsScalingLineweights() const
double GetFrontClip() const
OdStringArray m_FrozenLayerListNames
void InitializeViewByExtents(const OdGeExtents3d &extents)
OdGsDCRectDouble m_visibleScreenRect
ODCOLORREF GetForeground() const
const CFxView * m_pFxView
OdDbObjectId m_idViewport
const OdStringArray & GetFrozenLayerListNames() const
OdInt32 GetDebugMode() const
bool InitializeFromDbViewport(OdDbObjectId idViewport, int width, int height, bool isPlotGeneration)
void SetUseLineWeights(bool bUse)
OdGePoint3d m_Target
OdGsDCRectDouble m_dScreenRect
OdDbRasterVariables::FrameSettings GetIMAGEFRAME() const
const ODCOLORREF * GetPalette() const
void SetDrawSkipped(bool bVal)
void SetDrawImages(bool bVal)
OdDbObjectIdArray m_FrozenLayerList
void SetIsDragging(bool bVal)
bool IsExtentsCalculationActive() const
void SetEyeToOutput(const OdGeMatrix3d &rMatrix)
void InitializeOutputSize(double width, double height)
OdInt16 GetFxCadWindowId() const
double GetFocalLength() const
double GetLineweightToDcScaleOverride() const
OdGeExtents3d m_InitialActiveAreaInViewCoordinates
double GetLensLength() const
OdUInt16 GetVIEWRES() const
double m_dLineweightToDcScaleOverride
void SetInsideSelect(bool bVal)
OdGeMatrix3d m_EyeToOutput
const CFxDatabase * GetFxDatabase() const
static OdGeMatrix3d GetViewportMatrix(const CFxViewDrawInfo *pInfo)
void SetIMAGEFRAME(OdDbRasterVariables::FrameSettings frameSettings)
const CFxView * GetFxView() const
double GetVisiblePixelHeight() const
const OdGeVector3d & GetViewDir() const
virtual void SetInitialActiveAreaInViewCoordinates(const OdGeExtents3d &rect)
bool IsDrawSkipped() const
const OdGePoint3d & GetPosition() const
void SetUseTransparency(bool value)
bool IsPlotGeneration() const
static OdGeMatrix3d GetWorldToEyeMatrix(const CFxViewDrawInfo *pInfo)
OdGeVector3d m_ViewDir
bool IsPerspective() const
void InitializeDatabase(const CFxDatabase *pDatabase)
OdDbObjectId m_LayoutId
bool IsInsideSelect() const
virtual ~CFxViewDrawInfo(void)
OdDbObjectId GetViewportId() const
static OdGeMatrix3d GetAdjustedProjectionMatrix(const CFxViewDrawInfo *pInfo, double dNearEye, double dFarEye)
bool IsRapidMode() const
bool GetDrawImages() const
void InitializeView(const OdGePoint3d &position, const OdGePoint3d &target, const OdGeVector3d &upVector, double fieldWidth, double fieldHeight, OdGsView::Projection projectionType=OdGsView::kParallel)
const OdGiClipBoundary * GetClipBoundary() const
bool IsDragging() const
ODCOLORREF GetBackground() const
double GetFieldHeight() const
OdGePoint3d m_Position
bool GetQTEXTMODE() const
void SetDrawDecoration(DrawDecoration eDD)
double GetFieldWidth() const
void SetInitialActiveAreaByWCSContour(const CFxView *pFxView, const OdGePoint3d *pointsWCS, int nPoints)
double m_dVisiblePixelWidth
virtual void SetUseGsModel(bool bVal)
void SetInitialActiveAreaByEYEContour(const CFxView *pFxView, const OdGePoint2d *pointsEYE, int nPoints)
bool GetXCLIPFRAME() const
bool UseLinetyper() const
bool UseLineWeights() const
bool GetFILLMODE() const
bool InitializeFromFxView(const CFxView *pFxView)
double m_dVisiblePixelHeight
double GetBackClip() const
void AllowHardwareTransformations(bool bVal)
OdInt16 m_FxCadWindowId
void SetScalePixelSize(double scale)
double GetPixelWidth() const
void SetFadeMode(bool bVal)
bool UseGsModel() const
virtual void SetInitialActiveAreaByViewport(const CFxView *)
void SetRenderMode(OdGsView::RenderMode mode)
void SetFrozenLayerList(const OdDbObjectIdArray &ids)
void SetExtentsCalculationActive(bool bVal)
DrawDecoration m_eDrawDecoration
bool IsFadeMode() const
const OdGsDCRectDouble & GetVisibleScreenRectInViewCoordinates() const
const OdDbObjectId & GetLayoutId(bool &isModel) const
bool UseTransparency() const
OdGeVector3d m_UpVector
bool GetTEXTFILL() const
const OdGsDCRectDouble & GetScreenRect() const
const OdGeMatrix3d & GetEyeToOutput() const
static OdGeMatrix3d GetAdjustedViewportMatrix(const CFxViewDrawInfo *pInfo)
CFxDatabase * m_pFxDatabase
void SetClipBoundary(const OdGiClipBoundary *pClipBoundary)
DrawDecoration GetDrawDecoration() const
void SetLensLength(double dLensLength)
double GetPixelHeight() const
OdDbRasterVariables::FrameSettings m_iImageFrame
bool IsInitialUpdate() const
bool HardwareTransformationsAllowed() const
OdGsDCRectDouble m_visibleScreenRectInViewCoordinates
OdDbStubPtrArray GetFrozenLayerStubs() const
void SetLineweightToDCScaleOverride(double dLineweightToDCScale=0)
static int GetCadWindowId(OdDbObjectId idViewport)
bool IsBackClipped() const
const OdGsDCRectDouble & GetVisibleScreenRect() const
const OdGePoint3d & GetTarget() const
ODCOLORREF GetColor(OdUInt16 colorIndex) const
void SetUseLinetyper(bool bUse)
const OdGeVector3d & GetUpVector() const
void SetFrontClip(const double &z)
OdGsView::RenderMode GetRenderMode() const
const OdDbObjectIdArray & GetFrozenLayerList() const
bool IsFrontClipped() const
virtual const OdGeExtents3d & GetInitialActiveAreaInViewCoordinates() const
const OdGePoint3d & maxPoint() const
Definition: GeExtents3d.h:259
const OdGePoint3d & minPoint() const
Definition: GeExtents3d.h:254
double y
Definition: GePoint3d.h:368
double x
Definition: GePoint3d.h:367
RenderMode
Definition: Gs.h:138
Projection
Definition: Gs.h:151
@ kParallel
Definition: Gs.h:152
GLfloat GLfloat GLfloat z
Definition: gles2_ext.h:318
GLint GLenum GLsizei width
Definition: gles2_ext.h:110
GLint GLenum GLsizei GLsizei height
Definition: gles2_ext.h:110
GLsizei const GLfloat * value
Definition: gles2_ext.h:302
@ kNone
Light mode is inherited from the annotation.