CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
FxViewDrawInfo.h
Go to the documentation of this file.
1//
2// (C) Copyright 2005-2023 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
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
66 void InitializeOutputSize( double width, double height );
67
68 void InitializePalette( const ODCOLORREF* pPalette );
69
70 void InitializeDatabase( const CFxDatabase* pDatabase );
71
72 bool InitializeFromFxView( const CFxView* pFxView );
73
77 bool InitializeFromDbViewport( OdDbObjectId idViewport, int width, int height, bool isPlotGeneration );
78
79 bool GetFILLMODE() const
80 {
81 return m_bFillMode;
82 }
83
84 bool GetQTEXTMODE() const
85 {
86 return m_bQTextMode;
87 }
88
89 bool GetXCLIPFRAME() const
90 {
91 return m_bXClipFrame;
92 }
93
94 bool GetDrawImages() const
95 {
96 return m_bDrawImages;
97 }
98
99 void SetDrawImages(bool bVal)
100 {
101 m_bDrawImages = bVal;
102 }
103
104 bool GetTEXTFILL() const
105 {
106 return m_bTextFill;
107 }
108
110 {
111 return m_FxCadWindowId;
112 }
113
115 {
116 return m_idViewport;
117 }
118
120 {
121 return m_iImageFrame;
122 }
123
125 {
126 m_iImageFrame = frameSettings;
127 }
128
129 bool IsPlotGeneration() const;
130
131 bool UseGsModel() const
132 {
133 if ( !m_pFxDatabase )
134 return( true );
135 return m_bUseGsModel;
136 }
137
138 void SetUseGsModel( bool bVal )
139 {
140 m_bUseGsModel = bVal;
141 }
142
144 {
145 m_bUseTransparency = value;
146 }
147
148 bool UseTransparency() const
149 {
150 return m_bUseTransparency;
151 }
152
153 bool IsInitialUpdate() const
154 {
155 return m_bInitialUpdate;
156 }
157
158 bool IsDrawSkipped() const
159 {
160 return m_bDrawSkipped;
161 }
162
163 void SetDrawSkipped( bool bVal )
164 {
165 m_bDrawSkipped = bVal;
166 }
167
168 bool IsInsideSelect() const
169 {
170 return m_bIsInsideSelect;
171 }
172
173 void SetInsideSelect( bool bVal )
174 {
175 m_bIsInsideSelect = bVal;
176 }
177
179 {
180 return m_VIEWRES;
181 }
182
183 bool IsPerspective() const
184 {
185 return m_bPerspective;
186 }
187
188 double GetPixelWidth() const
189 {
190 return m_dPixelWidth;
191 }
192
193 double GetPixelHeight() const
194 {
195 return m_dPixelHeight;
196 }
197
198 double GetVisiblePixelWidth() const
199 {
200 return m_dVisiblePixelWidth;
201 }
202
204 {
205 return m_dVisiblePixelHeight;
206 }
207
208 double GetFrontClip() const
209 {
210 return m_dFrontClip;
211 }
212
213 double GetBackClip() const
214 {
215 return m_dBackClip;
216 }
217
218 void SetFrontClip( const double& z )
219 {
220 m_dFrontClip = z;
221 }
222
223 void SetBackClip( const double& z )
224 {
225 m_dBackClip = z;
226 }
227
228 bool IsFrontClipped() const
229 {
230 return m_bFrontClipped;
231 }
232
233 bool IsBackClipped() const
234 {
235 return m_bBackClipped;
236 }
237
238 double GetFocalLength() const
239 {
240 return m_dFocalLength;
241 }
242
244 {
245 return m_ViewDir;
246 }
247
249 {
250 return m_Position;
251 }
252
254 {
255 return m_UpVector;
256 }
257
258 const OdGePoint3d& GetTarget() const
259 {
260 return m_Target;
261 }
262
263 double GetFieldWidth() const
264 {
265 return m_FieldWidth;
266 }
267
268 double GetFieldHeight() const
269 {
270 return m_FieldHeight;
271 }
272
273 bool IsRapidMode() const
274 {
275 return m_bRapidMode;
276 }
277
279 {
280 return m_InitialActiveAreaInViewCoordinates;
281 }
282
284
286
287 void SetInitialActiveAreaByWCSContour( const CFxView* pFxView, const OdGePoint3d* pointsWCS, int nPoints );
288 void SetInitialActiveAreaByEYEContour( const CFxView* pFxView, const OdGePoint2d* pointsEYE, int nPoints );
289
291 {
292 const ODCOLORREF* pPalette = GetPalette();
293 ODCOLORREF odColor = pPalette[0];
294 return odColor;
295 }
296
298 {
299 const ODCOLORREF* pPalette = GetPalette();
300 ODCOLORREF odColor = pPalette[7];
301 return odColor;
302 }
303
304 const ODCOLORREF* GetPalette() const
305 {
306 return (const ODCOLORREF*)(&m_Palette);
307 }
308
309 ODCOLORREF GetColor( OdUInt16 colorIndex ) const
310 {
311 return GetPalette()[colorIndex];
312 }
313
315 {
316 return m_RenderMode;
317 }
318
320
321 bool IsDragging() const
322 {
323 return m_bDragging;
324 }
325
326 void SetIsDragging( bool bVal )
327 {
328 m_bDragging = bVal;
329 }
330
331 bool IsFadeMode() const
332 {
333 return m_bFadeMode;
334 }
335
336 void SetFadeMode( bool bVal )
337 {
338 m_bFadeMode = bVal;
339 }
340
342 {
343 kNone = 0,
344 kHidden = 1,
345 kHighlight = 2, // use dashed lines
346 kNegativeHighlight = 4, // use dashed lines and background color
347 kTrackHighlight = 8, // use thick hatched lines
348 kDrawAttDefs = 16, // draw attdefs
349 kDisableDepth = 32, // disable depth
350 kRenderMode2D = 64, // forces 2d render mode to be used
351 kFaded = 128, // use faded lines
352 kXeDangling = 256, // dangling dimension highlight
353 kXeDragHighlight = 512 // entities being dragged
354 };
355
357 {
358 return m_eDrawDecoration;
359 }
360
362 {
363 m_eDrawDecoration = eDD;
364 }
365
367 {
368 return m_bExtentsCalculation;
369 }
370
372 {
373 m_bExtentsCalculation = bVal;
374 }
375
377 {
378 return m_DebugMode;
379 }
380
382 {
383 return m_pFxDatabase;
384 }
385
387
389
391 {
392 return m_FrozenLayerList;
393 }
394
396 {
397 m_FrozenLayerList = ids;
398 }
399
400 bool UseLinetyper() const
401 {
402 return m_bUseLinetyper;
403 }
404
405 void SetUseLinetyper( bool bUse)
406 {
407 m_bUseLinetyper = bUse;
408 }
409
410 bool UseLineWeights() const
411 {
412 return m_bUseLineWeights;
413 }
414
415 void SetUseLineWeights( bool bUse)
416 {
417 m_bUseLineWeights = bUse;
418 }
419
421 {
422 return m_dLineweightToDcScaleOverride;
423 }
424
425 void SetLineweightToDCScaleOverride(double dLineweightToDCScale = 0)
426 {
427 m_dLineweightToDcScaleOverride = dLineweightToDCScale;
428 }
429
430 bool IsOrbitMode() const
431 {
432 return m_bOrbitMode;
433 }
434
435 void SetOrbitMode( bool bVal )
436 {
437 m_bOrbitMode = bVal;
438 }
439
440 //it is not recommended to use this member
441 const CFxView* GetFxView() const
442 {
443 return m_pFxView;
444 }
445
446 int GetPDFFRAME() const
447 {
448 return m_iPDFFrame;
449 }
450
451 double GetLensLength() const
452 {
453 return m_dLensLength;
454 }
455
456 void SetLensLength(double dLensLength)
457 {
458 m_dLensLength = dLensLength;
459 }
460
462 {
463 return m_EyeToOutput;
464 }
465
466 void SetEyeToOutput( const OdGeMatrix3d& rMatrix )
467 {
468 m_EyeToOutput = rMatrix;
469 }
470
472 {
473 return m_dScreenRect;
474 }
475
477 {
478 return m_visibleScreenRect;
479 }
480
482 {
483 return m_visibleScreenRectInViewCoordinates;
484 }
485
487
488 static int GetCadWindowId( OdDbObjectId idViewport );
489
491
492 static OdGeMatrix3d GetAdjustedProjectionMatrix( const CFxViewDrawInfo* pInfo, double dNearEye, double dFarEye );
493
496
497 void SetScalePixelSize( double scale );
498
500 {
501 return m_bHardwareTransformationsAllowed;
502 }
503
505
506 const OdDbObjectId& GetLayoutId( bool &isModel ) const;
507
509
510 void SetClipBoundary( const OdGiClipBoundary * pClipBoundary );
511
513
515
516protected:
517 void InitializeFxDatabase( CFxDatabase* pFxDatabase );
518
519 double m_dPixelWidth{ 1.0 };
520 double m_dPixelHeight{ 1.0 };
521
522 double m_dVisiblePixelWidth{ 1.0 };
523 double m_dVisiblePixelHeight{ 1.0 };
524
525 ODCOLORREF m_Palette[ 256 ] = { 0 };
526
527 OdGeVector3d m_ViewDir{ 0, 0, 1 };
528
529 OdGePoint3d m_Position{ 0, 0, 1 };
530
531 OdGeVector3d m_UpVector{ 0, 1, 0 };
532
533 OdGePoint3d m_Target{ 0, 0, 0 };
534
535 double m_FieldWidth{ 1.0 };
536
537 double m_FieldHeight{ 1.0 };
538
539 double m_dLensLength{ 50.0 };
540
542
543 bool m_bIsInsideSelect{ false };
544
545 int m_iPDFFrame{ 1 };
546
547 OdUInt16 m_VIEWRES{ 10000 };
548
549 bool m_bPerspective{ false };
550
551 bool m_bInitialUpdate{ false };
552
553 bool m_bPlotGeneration{ false };
554
555 bool m_bFillMode{ true };
556
557 bool m_bTextFill{ true };
558
559 bool m_bQTextMode{ false };
560
561 bool m_bXClipFrame{ false };
562
563 bool m_bDrawImages{ true };
564
565 OdInt16 m_FxCadWindowId{ 0 };
566
567 ViewportKey m_vpNum{ NullViewportKey };
568
570
571 bool m_bDrawSkipped{ false };
572
574
575 double m_dFrontClip{ 0.0 };
576
577 double m_dBackClip{ 0.0 };
578
579 bool m_bFrontClipped{ false };
580
581 bool m_bBackClipped{ false };
582
583 double m_dFocalLength{ 0.0 };
584
585 bool m_bRapidMode{ false };
586
588
589 bool m_bUseGsModel{ false };
590
591 bool m_bFadeMode{ false };
592
593 bool m_bDragging{ false };
594
595 bool m_bExtentsCalculation{ false };
596
597 DrawDecoration m_eDrawDecoration{ kNone };
598
599 OdInt32 m_DebugMode{ 0 };
600
601 CFxDatabase* m_pFxDatabase{ nullptr };
602
605 bool m_bInitalizeLayerList{ false };
606
607 bool m_bUseLinetyper{ true };
608
609 bool m_bUseLineWeights{ true };
610
611 bool m_bOrbitMode{ false };
612
613 //it is not recommended to use this member
614 const CFxView* m_pFxView{ nullptr };
615
617
618 OdGsDCRectDouble m_dScreenRect{ 0.0, 0.0, 0.0, 0.0 };
619
620 OdGsDCRectDouble m_visibleScreenRect{ 0.0, 0.0, 0.0, 0.0 };
621
622 OdGsDCRectDouble m_visibleScreenRectInViewCoordinates{ 0.0, 0.0, 0.0, 0.0 };
623
624 bool m_bHardwareTransformationsAllowed{ false };
625
626 bool m_bUseTransparency{ false };
627
628 bool m_bIsModel{ true };
629
631
632 double m_dLineweightToDcScaleOverride{ 0 };
633
634 const OdGiClipBoundary* m_pClipBoundary{ nullptr };
635
636 //doesn't have copy constructor and assignment operator
637 //OdGiVisualStyleDataContainer m_visualStyle;
639};
640
641#include "FxPragmaPop.h"
@ kHighlight
Definition: BrEnums.h:154
#define DDKERNEL_API
Definition: DDKERNEL.h:32
scale
Definition: DimVarDefs.h:1684
int ViewportKey
Definition: FxView.h:44
const double kMAX_VALID_DEPTH_RANGE
#define ODCOLORREF
Definition: OdPlatform.h:933
short OdInt16
unsigned short OdUInt16
int OdInt32
void SetInitialActiveAreaInViewCoordinates(const OdGeExtents3d &rect)
int GetPDFFRAME() const
double GetVisiblePixelWidth() const
const OdGePoint3d & GetTarget() const
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)
const OdGsDCRectDouble & GetScreenRect() const
ODCOLORREF GetForeground() const
OdDbObjectId m_idViewport
const ODCOLORREF * GetPalette() const
OdInt32 GetDebugMode() const
bool InitializeFromDbViewport(OdDbObjectId idViewport, int width, int height, bool isPlotGeneration)
void SetUseLineWeights(bool bUse)
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
void SetInsideSelect(bool bVal)
const OdGeVector3d & GetViewDir() const
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
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
bool GetQTEXTMODE() const
void SetDrawDecoration(DrawDecoration eDD)
double GetFieldWidth() const
void SetInitialActiveAreaByWCSContour(const CFxView *pFxView, const OdGePoint3d *pointsWCS, int nPoints)
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 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)
bool IsFadeMode() const
bool UseTransparency() const
bool IsOrbitMode() const
bool GetTEXTFILL() const
const CFxView * GetFxView() const
void SetOrbitMode(bool bVal)
static OdGeMatrix3d GetAdjustedViewportMatrix(const CFxViewDrawInfo *pInfo)
void SetClipBoundary(const OdGiClipBoundary *pClipBoundary)
DrawDecoration GetDrawDecoration() const
void SetLensLength(double dLensLength)
double GetPixelHeight() const
bool IsInitialUpdate() const
bool HardwareTransformationsAllowed() const
~CFxViewDrawInfo(void)
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:148
@ k2DOptimized
Definition: Gs.h:150
Projection
Definition: Gs.h:164
@ kParallel
Definition: Gs.h:165
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