CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
FxViewDrawInfo.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2025 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
23#include "FxView.h"
24
25#include <Ge/GeExtents3d.h>
26#include <Gi/GiClipBoundary.h>
27#include <Gi/GiCommonDraw.h>
28//doesn't have copy constructor and assignment operator
29//#include <Gi/GiVisualStyleData.h>
30#include <Gi/GiVisualStyle.h>
31#include <Gs/Gs.h>
32
33#include <DbObjectId.h>
34#include <DbRasterVariables.h>
35#include <DbStubPtrArray.h>
36#include <StringArray.h>
37
38
44
45class CFxDatabase;
46
47const double kMAX_VALID_DEPTH_RANGE = 1.0e+250;
48
50{
51public:
53
55
57 const OdGePoint3d& position,
58 const OdGePoint3d& target,
59 const OdGeVector3d& upVector,
60 double fieldWidth,
61 double fieldHeight,
63
64 void InitializeViewByExtents( const OdGeExtents3d& extents );
65 void InitializeViewByExtentsAndDirection( const OdGeExtents3d& extents, const OdGeVector3d& viewDirection );
66
67 void InitializeOutputSize( double width, double height );
68
69 void InitializePalette( const ODCOLORREF* pPalette );
70
71 void InitializeDatabase( const CFxDatabase* pDatabase );
72
73 bool InitializeFromFxView( const CFxView* pFxView );
74
78 bool InitializeFromDbViewport( OdDbObjectId idViewport, int width, int height, bool isPlotGeneration );
79
80 bool GetFILLMODE() const
81 {
82 return m_bFillMode;
83 }
84
85 bool GetQTEXTMODE() const
86 {
87 return m_bQTextMode;
88 }
89
90 bool GetXCLIPFRAME() const
91 {
92 return m_bXClipFrame;
93 }
94
95 bool GetDrawImages() const
96 {
97 return m_bDrawImages;
98 }
99
100 void SetDrawImages(bool bVal)
101 {
102 m_bDrawImages = bVal;
103 }
104
105 bool GetTEXTFILL() const
106 {
107 return m_bTextFill;
108 }
109
111 {
112 return m_FxCadWindowId;
113 }
114
116 {
117 return m_idViewport;
118 }
119
124
126 {
127 m_iImageFrame = frameSettings;
128 }
129
130 bool IsPlotGeneration() const;
131
132 bool UseGsModel() const
133 {
134 if ( !m_pFxDatabase )
135 return( true );
136 return m_bUseGsModel;
137 }
138
139 void SetUseGsModel( bool bVal )
140 {
141 m_bUseGsModel = bVal;
142 }
143
145 {
147 }
148
149 bool UseTransparency() const
150 {
151 return m_bUseTransparency;
152 }
153
154 bool UseLineSmoothing() const
155 {
156 return m_bUseLineSmoothing;
157 }
158
159 bool IsInitialUpdate() const
160 {
161 return m_bInitialUpdate;
162 }
163
164 bool IsDrawSkipped() const
165 {
166 return m_bDrawSkipped;
167 }
168
169 void SetDrawSkipped( bool bVal )
170 {
171 m_bDrawSkipped = bVal;
172 }
173
174 bool IsInsideSelect() const
175 {
176 return m_bIsInsideSelect;
177 }
178
179 void SetInsideSelect( bool bVal )
180 {
181 m_bIsInsideSelect = bVal;
182 }
183
185 {
186 return m_VIEWRES;
187 }
188
189 bool IsPerspective() const
190 {
191 return m_bPerspective;
192 }
193
194 double GetPixelWidth() const
195 {
196 return m_dPixelWidth;
197 }
198
199 double GetPixelHeight() const
200 {
201 return m_dPixelHeight;
202 }
203
204 double GetVisiblePixelWidth() const
205 {
207 }
208
210 {
212 }
213
214 double GetFrontClip() const
215 {
216 return m_dFrontClip;
217 }
218
219 double GetBackClip() const
220 {
221 return m_dBackClip;
222 }
223
224 void SetFrontClip( const double& z )
225 {
226 m_dFrontClip = z;
227 }
228
229 void SetBackClip( const double& z )
230 {
231 m_dBackClip = z;
232 }
233
234 bool IsFrontClipped() const
235 {
236 return m_bFrontClipped;
237 }
238
239 bool IsBackClipped() const
240 {
241 return m_bBackClipped;
242 }
243
244 double GetFocalLength() const
245 {
246 return m_dFocalLength;
247 }
248
250 {
251 return m_ViewDir;
252 }
253
255 {
256 return m_Position;
257 }
258
260 {
261 return m_UpVector;
262 }
263
264 const OdGePoint3d& GetTarget() const
265 {
266 return m_Target;
267 }
268
269 double GetFieldWidth() const
270 {
271 return m_FieldWidth;
272 }
273
274 double GetFieldHeight() const
275 {
276 return m_FieldHeight;
277 }
278
279 bool IsRapidMode() const
280 {
281 return m_bRapidMode;
282 }
283
288
289 //Sets the initial active area to take place in all the possible space.
290 //Basically from -inf to +inf.
293
295
296 void SetInitialActiveAreaByWCSContour( const CFxView* pFxView, const OdGePoint3d* pointsWCS, int nPoints );
297 void SetInitialActiveAreaByEYEContour( const CFxView* pFxView, const OdGePoint2d* pointsEYE, int nPoints );
298
300 {
301 const ODCOLORREF* pPalette = GetPalette();
302 ODCOLORREF odColor = pPalette[0];
303 return odColor;
304 }
305
307 {
308 const ODCOLORREF* pPalette = GetPalette();
309 ODCOLORREF odColor = pPalette[7];
310 return odColor;
311 }
312
313 const ODCOLORREF* GetPalette() const
314 {
315 return (const ODCOLORREF*)(&m_Palette);
316 }
317
318 ODCOLORREF GetColor( OdUInt16 colorIndex ) const
319 {
320 return GetPalette()[colorIndex];
321 }
322
324 {
325 return m_RenderMode;
326 }
327
329
330 bool IsDragging() const
331 {
332 return m_bDragging;
333 }
334
335 void SetIsDragging( bool bVal )
336 {
337 m_bDragging = bVal;
338 }
339
340 bool IsFadeMode() const
341 {
342 return m_bFadeMode;
343 }
344
345 void SetFadeMode( bool bVal )
346 {
347 m_bFadeMode = bVal;
348 }
349
351 {
352 kNone = 0,
354 kHighlight = 2, // use dashed lines
355 kNegativeHighlight = 4, // use dashed lines and background color
356 kTrackHighlight = 8, // use thick hatched lines
357 kDrawAttDefs = 16, // draw attdefs
358 kDisableDepth = 32, // disable depth
359 kRenderMode2D = 64, // forces 2d render mode to be used
360 kFaded = 128, // use faded lines
361 kXeDangling = 256, // dangling dimension highlight
362 kXeDragHighlight = 512 // entities being dragged
363 };
364
366 {
367 return m_eDrawDecoration;
368 }
369
371 {
372 m_eDrawDecoration = eDD;
373 }
374
376 {
378 }
379
381 {
383 }
384
386 {
387 return m_DebugMode;
388 }
389
391 {
392 return m_pFxDatabase;
393 }
394
396
398
400 {
401 return m_FrozenLayerList;
402 }
403
405 {
406 m_FrozenLayerList = ids;
407 }
408
409 bool UseLinetyper() const
410 {
411 return m_bUseLinetyper;
412 }
413
414 void SetUseLinetyper( bool bUse)
415 {
416 m_bUseLinetyper = bUse;
417 }
418
419 bool UseLineWeights() const
420 {
421 return m_bUseLineWeights;
422 }
423
424 void SetUseLineWeights( bool bUse)
425 {
426 m_bUseLineWeights = bUse;
427 }
428
433
434 void SetLineweightToDCScaleOverride(double dLineweightToDCScale = 0)
435 {
436 m_dLineweightToDcScaleOverride = dLineweightToDCScale;
437 }
438
439 bool IsOrbitMode() const
440 {
441 return m_bOrbitMode;
442 }
443
444 void SetOrbitMode( bool bVal )
445 {
446 m_bOrbitMode = bVal;
447 }
448
449 //it is not recommended to use this member
450 const CFxView* GetFxView() const
451 {
452 return m_pFxView;
453 }
454
455 int GetPDFFRAME() const
456 {
457 return m_iPDFFrame;
458 }
459
460 double GetLensLength() const
461 {
462 return m_dLensLength;
463 }
464
465 void SetLensLength(double dLensLength)
466 {
467 m_dLensLength = dLensLength;
468 }
469
471 {
472 return m_EyeToOutput;
473 }
474
475 void SetEyeToOutput( const OdGeMatrix3d& rMatrix )
476 {
477 m_EyeToOutput = rMatrix;
478 }
479
481 {
482 return m_dScreenRect;
483 }
484
486 {
487 return m_visibleScreenRect;
488 }
489
494
496
497 static int GetCadWindowId( OdDbObjectId idViewport );
498
500
501 static OdGeMatrix3d GetAdjustedProjectionMatrix( const CFxViewDrawInfo* pInfo, double dNearEye, double dFarEye );
502
505
506 void SetScalePixelSize( double scale );
507
512
514
515 const OdDbObjectId& GetLayoutId( bool &isModel ) const;
516
518
519 void SetClipBoundary( const OdGiClipBoundary * pClipBoundary );
520
522
524
525protected:
526 void InitializeFxDatabase( CFxDatabase* pFxDatabase );
527
528 double m_dPixelWidth{ 1.0 };
529 double m_dPixelHeight{ 1.0 };
530
531 double m_dVisiblePixelWidth{ 1.0 };
533
534 ODCOLORREF m_Palette[ 256 ] = { 0 };
535
537
539
541
543
544 double m_FieldWidth{ 1.0 };
545
546 double m_FieldHeight{ 1.0 };
547
548 double m_dLensLength{ 50.0 };
549
551
552 bool m_bIsInsideSelect{ false };
553
554 int m_iPDFFrame{ 1 };
555
557
558 bool m_bPerspective{ false };
559
560 bool m_bInitialUpdate{ false };
561
562 bool m_bPlotGeneration{ false };
563
564 bool m_bFillMode{ true };
565
566 bool m_bTextFill{ true };
567
568 bool m_bQTextMode{ false };
569
570 bool m_bXClipFrame{ false };
571
572 bool m_bDrawImages{ true };
573
575
576 ViewportKey m_vpNum{ NullViewportKey };
577
579
580 bool m_bDrawSkipped{ false };
581
583
584 double m_dFrontClip{ 0.0 };
585
586 double m_dBackClip{ 0.0 };
587
588 bool m_bFrontClipped{ false };
589
590 bool m_bBackClipped{ false };
591
592 double m_dFocalLength{ 0.0 };
593
594 bool m_bRapidMode{ false };
595
597
598 bool m_bUseGsModel{ false };
599
600 bool m_bFadeMode{ false };
601
602 bool m_bDragging{ false };
603
605
607
609
611
615
616 bool m_bUseLinetyper{ true };
617
618 bool m_bUseLineWeights{ true };
619
620 bool m_bOrbitMode{ false };
621
622 //it is not recommended to use this member
623 const CFxView* m_pFxView{ nullptr };
624
626
627 OdGsDCRectDouble m_dScreenRect{ 0.0, 0.0, 0.0, 0.0 };
628
630
632
634
635 bool m_bUseTransparency{ false };
636 bool m_bUseLineSmoothing{ false };
637
638 bool m_bIsModel{ true };
639
641
643
645
646 //doesn't have copy constructor and assignment operator
647 //OdGiVisualStyleDataContainer m_visualStyle;
649};
650
651#include "FxPragmaPop.h"
#define DDKERNEL_API
Definition DDKERNEL.h:32
OdArray< OdDbStub *, OdMemoryAllocator< OdDbStub * > > OdDbStubPtrArray
scale
size_t ViewportKey
Definition FxView.h:44
const double kMAX_VALID_DEPTH_RANGE
OdSmartPtr< OdGiVisualStyle > OdGiVisualStylePtr
OdArray< OdDbObjectId, OdClrMemAllocator< OdDbObjectId > > OdDbObjectIdArray
Definition IdArrays.h:53
#define ODCOLORREF
short OdInt16
unsigned short OdUInt16
int OdInt32
OdArray< OdString > OdStringArray
Definition StringArray.h:32
bool m_bHardwareTransformationsAllowed
void SetInitialActiveAreaInViewCoordinates(const OdGeExtents3d &rect)
int GetPDFFRAME() const
double GetVisiblePixelWidth() const
const OdGiClipBoundary * m_pClipBoundary
const OdGePoint3d & GetTarget() const
OdGsView::RenderMode m_RenderMode
void SetBackClip(const double &z)
void InitializePalette(const ODCOLORREF *pPalette)
bool IsScalingLineweights() const
double GetFrontClip() const
const OdGePoint3d & GetPosition() const
OdStringArray m_FrozenLayerListNames
void InitializeViewByExtents(const OdGeExtents3d &extents)
OdGsDCRectDouble m_visibleScreenRect
const OdGsDCRectDouble & GetScreenRect() const
ODCOLORREF GetForeground() const
const CFxView * m_pFxView
OdDbObjectId m_idViewport
const ODCOLORREF * GetPalette() 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 OdGeVector3d & GetUpVector() 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
void SetUseGsModel(bool bVal)
const OdDbObjectId & GetLayoutId(bool &isModel) const
OdUInt16 GetVIEWRES() const
double m_dLineweightToDcScaleOverride
void SetInsideSelect(bool bVal)
OdGeMatrix3d m_EyeToOutput
const OdGeVector3d & GetViewDir() const
ViewportKey m_vpNum
static OdGeMatrix3d GetViewportMatrix(const CFxViewDrawInfo *pInfo)
void SetIMAGEFRAME(OdDbRasterVariables::FrameSettings frameSettings)
const OdGeExtents3d & GetInitialActiveAreaInViewCoordinates() const
double GetVisiblePixelHeight() const
const OdGiVisualStyle & GetVisualStyle() const
void InitializeFxDatabase(CFxDatabase *pFxDatabase)
bool IsDrawSkipped() const
void SetUseTransparency(bool value)
bool IsPlotGeneration() const
static OdGeMatrix3d GetWorldToEyeMatrix(const CFxViewDrawInfo *pInfo)
const CFxDatabase * GetFxDatabase() const
OdGeVector3d m_ViewDir
bool IsPerspective() const
void InitializeDatabase(const CFxDatabase *pDatabase)
void SetInitialActiveAreaByViewport(const CFxView *)
OdDbObjectId m_LayoutId
bool IsInsideSelect() const
const OdGsDCRectDouble & GetVisibleScreenRectInViewCoordinates() const
OdDbObjectId GetViewportId() const
static OdGeMatrix3d GetAdjustedProjectionMatrix(const CFxViewDrawInfo *pInfo, double dNearEye, double dFarEye)
ViewportKey GetVpNum() const
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)
bool IsDragging() const
ODCOLORREF GetBackground() const
double GetFieldHeight() const
OdGiVisualStylePtr m_pVisualStyle
OdGePoint3d m_Position
bool GetQTEXTMODE() const
void InitializeViewByExtentsAndDirection(const OdGeExtents3d &extents, const OdGeVector3d &viewDirection)
void SetDrawDecoration(DrawDecoration eDD)
bool UseLineSmoothing() const
double GetFieldWidth() const
void SetInitialActiveAreaByWCSContour(const CFxView *pFxView, const OdGePoint3d *pointsWCS, int nPoints)
double m_dVisiblePixelWidth
void SetInitialActiveAreaByEYEContour(const CFxView *pFxView, const OdGePoint2d *pointsEYE, int nPoints)
bool GetXCLIPFRAME() const
bool UseLinetyper() const
bool UseLineWeights() const
bool GetFILLMODE() const
const OdGiClipBoundary * GetClipBoundary() const
bool InitializeFromFxView(const CFxView *pFxView)
double m_dVisiblePixelHeight
double GetBackClip() const
void AllowHardwareTransformations(bool bVal)
const OdGeMatrix3d & GetEyeToOutput() const
void SetScalePixelSize(double scale)
double GetPixelWidth() const
void SetFadeMode(bool bVal)
bool UseGsModel() const
void SetRenderMode(OdGsView::RenderMode mode)
void SetFrozenLayerList(const OdDbObjectIdArray &ids)
void SetExtentsCalculationActive(bool bVal)
DrawDecoration m_eDrawDecoration
bool IsFadeMode() const
bool UseTransparency() const
bool IsOrbitMode() const
OdGeVector3d m_UpVector
bool GetTEXTFILL() const
void ResetInitialActiveAreaInViewCoordinates()
const CFxView * GetFxView() const
void SetOrbitMode(bool bVal)
static OdGeMatrix3d GetAdjustedViewportMatrix(const CFxViewDrawInfo *pInfo)
CFxDatabase * m_pFxDatabase
void SetClipBoundary(const OdGiClipBoundary *pClipBoundary)
ODCOLORREF m_Palette[256]
DrawDecoration GetDrawDecoration() const
void SetLensLength(double dLensLength)
double GetPixelHeight() const
OdDbRasterVariables::FrameSettings m_iImageFrame
bool IsInitialUpdate() const
bool HardwareTransformationsAllowed() const
~CFxViewDrawInfo(void)
OdGsDCRectDouble m_visibleScreenRectInViewCoordinates
OdDbStubPtrArray GetFrozenLayerStubs() const
void SetLineweightToDCScaleOverride(double dLineweightToDCScale=0)
static int GetCadWindowId(OdDbObjectId idViewport)
const OdDbObjectIdArray & GetFrozenLayerList() const
bool IsBackClipped() const
const OdStringArray & GetFrozenLayerListNames() const
const OdGsDCRectDouble & GetVisibleScreenRect() const
ODCOLORREF GetColor(OdUInt16 colorIndex) const
void SetUseLinetyper(bool bUse)
void SetFrontClip(const double &z)
OdGsView::RenderMode GetRenderMode() const
bool IsFrontClipped() const
static GE_STATIC_EXPORT const OdGeMatrix3d kIdentity
Definition GeMatrix3d.h:97
RenderMode
Definition Gs.h:149
@ k2DOptimized
Definition Gs.h:151
Projection
Definition Gs.h:165
@ kParallel
Definition Gs.h:166
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