CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
FxView.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 <DbObjectId.h>
22#include "DDKERNEL.h"
23#include "FxPicture.h"
24
25#include <Gi/GiCommonDraw.h>
26#include <Ge/GeExtents3d.h>
27#include <Ge/GeBoundBlock3d.h>
28#include <DbViewport.h>
29
30#include <vector>
31
33class CFxGsNode;
34class CFxSelectionSet;
37class CFxView;
38class CFxViewReactor;
39class CFxViewDrawInfo;
40
41class QPainterPath;
42class OdDbViewport;
43
44using ViewportKey = size_t;
45static constexpr ViewportKey NullViewportKey = 0;
46
53{
54public:
56
64 bool InitializeFromView( const CFxView* pView );
65
73 bool InitializeFromViewInfo( const CFxViewDrawInfo* pViewInfo );
74
80 void ApplyToView( CFxView* pView );
81
87 const OdGePoint3d& GetPosition() const
88 {
89 return m_position;
90 }
91
97 const OdGePoint3d& GetTarget() const
98 {
99 return m_target;
100 }
101
108 {
109 return m_eyeVector;
110 }
111
118 {
119 return m_upVector;
120 }
121
127 double GetFieldWidth() const
128 {
129 return m_fieldWidth;
130 }
131
137 double GetFieldHeight() const
138 {
139 return m_fieldHeight;
140 }
141
147 double GetPixelWidth() const
148 {
149 return m_dPixelWidth;
150 }
151
157 double GetPixelHeight() const
158 {
159 return m_dPixelHeight;
160 }
161
167 double GetFocalLength() const
168 {
169 return m_focalLength;
170 }
171
178 {
179 return m_WorldToEye;
180 }
181
183 {
184 return m_VisibleRect;
185 }
186
194 static bool IsViewSettingsValid( const OdGsView* pView );
195
203 static bool IsViewSettingsValid( const OdDbViewport* pViewport );
204
212 static bool IsViewExtentsValid( const OdGeExtents3d& extents );
213
214/*
215 static bool IsViewSettingsValid(
216 const OdGePoint3d& position,
217 const OdGePoint3d& target,
218 const OdGeVector3d& upVector,
219 double fieldWidth,
220 double fieldHeight );
221*/
223 double iWidthInPixels,
224 double iHeighInPixels,
225 const OdGePoint3d& point,
226 bool bUsePerspective) const;
227
228 bool operator == ( const CFxViewportSnapShot& other ) const;
229
230 bool operator != ( const CFxViewportSnapShot& other ) const;
231
232private:
233 OdGePoint3d m_position;
234 OdGePoint3d m_target;
235 OdGeVector3d m_eyeVector;
236 OdGeVector3d m_upVector;
237 double m_fieldWidth;
238 double m_fieldHeight;
239 double m_focalLength;
240
241 double m_dPixelWidth;
242 double m_dPixelHeight;
243
244 OdGeMatrix3d m_WorldToEye;
245
246 OdGsDCRectDouble m_VisibleRect;
247 static bool m_bEvent;
248};
249
250typedef std::vector<CFxViewportSnapShot> VIEWPORTDATA_VECTOR;
251
258{
259public:
260
263
265 ~CFxView() override;
266
268
272 virtual const CFxVectorizeDevice* GetFxVectorizeDevice() const = 0;
273
278
282 virtual const QPainterPath& GetViewportInternalRegion() const = 0;
283
287 virtual const QPainterPath& GetViewportExternalRegion() const = 0;
288
293
298
302 virtual bool IsOverall() const = 0;
303
307 virtual bool IsPaperSpaceOverall() const = 0;
308
312 virtual bool IsActive() const = 0;
313
317 virtual bool SetPreviousData() = 0;
318
322 virtual void StartTransaction() = 0;
323
329 virtual void EndTransaction( bool bAnimate = false ) = 0;
330
334 virtual bool InsideTransaction() const = 0;
335
339 virtual int PointToWCS( const OdGsDCPoint& pointSCS, const OdGePlane& plane, OdGePoint3d& pointWCS ) const = 0;
340 virtual int PointToWCS( const CFxPointF& pointSCS, const OdGePlane& plane, OdGePoint3d& pointWCS ) const = 0;
341
345 virtual int PointToWCSOnUCS( const OdGsDCPoint& pointSCS, OdGePoint3d& pointWCS ) const = 0;
346
350 virtual int PointToWCSOnUCS( const OdGePoint3d& pointSCS, OdGePoint3d& pointWCS ) const = 0;
351
355 virtual int PointToWCSOnUCS( const OdGePoint2d& pointSCS, OdGePoint3d& pointWCS ) const = 0;
356
360 virtual void PointToSCS( const OdGePoint3d& pointWCS, OdGsDCPoint& pointSCS ) const = 0;
361
365 virtual void PointToSCS( const OdGePoint3d& pointWCS, CFxPoint& pointSCS ) const = 0;
366
370 virtual void PointToSCS( const OdGePoint3d& pointWCS, CFxPointF& pointSCS ) const = 0;
371
375 virtual int PointToView( const OdGsDCPoint& pointSCS, OdGePoint2d& viewPt ) const = 0;
376
380 virtual int PointToView( const OdGePoint2d& pointSCS, OdGePoint2d& viewPt ) const = 0;
381
385 virtual OdGeMatrix3d EyeToPaperSpace() const = 0;
386
388
392 virtual OdGeMatrix3d PaperSpaceToEye() const = 0;
393
395
403
407 virtual ViewportKey GetVpNum() const = 0;
408
412 virtual OdInt16 GetCadWindowId() const = 0;
413
418
422 virtual void AddViewReactor( CFxViewReactor* pReactor ) = 0;
423
427 virtual void RemoveViewReactor( CFxViewReactor* pReactor ) = 0;
428
432 virtual void SetElevation( double dElev ) = 0;
433
437 virtual double Elevation() const = 0;
438
442 virtual bool IsRectangular() const = 0;
443
447 virtual bool ViewExtentsWCS( OdGeBoundBlock3d& extents ) const = 0;
448
452 virtual bool ZoomExtentsWCS( const OdGeBoundBlock3d* pExtents ) = 0;
453
457 virtual void EnterDragMode() = 0;
458
462 virtual bool IsDragging() const = 0;
463
467 virtual void LeaveDragMode() = 0;
468
472 virtual OdGeExtents3d GetRealExtents(volatile bool *abortFlag = 0) const = 0;
473
477 virtual bool GetGeomExtents( OdGeBoundBlock3d& bounds, volatile bool *abortFlag = 0 ) const = 0;
478
481 virtual void SetPanMode( bool bVal ) = 0;
482
483 virtual bool IsPanMode() const = 0;
484
487 virtual void SetZoomMode( bool bVal ) = 0;
488
489 virtual bool IsZoomMode() const = 0;
490
493 virtual void SetOrbitMode( bool bVal ) = 0;
494
495 virtual bool IsOrbitMode() const = 0;
496
497 virtual bool IsPreviousVectorizationAborted() const = 0;
500 virtual OdGeVector3d viewDir() const = 0;
501
504 virtual double focalLength() const = 0;
505
509
513
517
520 virtual double GetDeviation(const OdGiDeviationType deviationType, const OdGePoint3d& pointOnCurve) const = 0;
521
524 virtual void screenRect(OdGsDCPoint &lowerLeft, OdGsDCPoint &upperRight) const = 0;
525
528 virtual void screenRect(OdGePoint2d &lowerLeft, OdGePoint2d &upperRight) const = 0;
529
533
537
540 virtual double screenWidth() const = 0;
541
544 virtual double screenHeight() const = 0;
545
548 virtual double visibleWidth() const = 0;
549
552 virtual double visibleHeight() const = 0;
553
556 virtual OdDbStub* viewportObjectId() const = 0;
557
561
564 virtual size_t numDrawables() const = 0;
565
568 virtual OdGiDrawablePtr drawableAt( size_t iIndex ) const = 0;
569
573 virtual bool IsFieldAspectMaintained() const = 0;
574
577 virtual void SetFieldAspectMaintained(bool) = 0;
578};
579
580class OdDbPlotSettings;
581
586
588
589#include "FxPragmaPop.h"
OdArray< OdGePoint3d, OdMemoryAllocator< OdGePoint3d > > OdGePoint3dArray
#define DDKERNEL_API
Definition DDKERNEL.h:32
#define CFxPointF
#define CFxPoint
DDKERNEL_API void GetPaperProperties(OdDbPlotSettings *pLayout, OdGePoint3dArray &points, OdGePoint3dArray &margins)
std::vector< CFxViewportSnapShot > VIEWPORTDATA_VECTOR
Definition FxView.h:250
size_t ViewportKey
Definition FxView.h:44
DDKERNEL_API CFxView * GetActiveFxView(OdEdCommandContext *pCmdCtx)
OdSmartPtr< OdGiDrawable > OdGiDrawablePtr
OdGiDeviationType
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:405
bool operator==(T left, const OdGiVariant::EnumType right)
Definition GiVariant.h:399
short OdInt16
virtual OdGsDCRectDouble visibleScreenRectInViewCoordinates() const =0
virtual OdGeMatrix3d getWorldToEyeTransform() const =0
virtual double screenWidth() const =0
virtual bool IsPaperSpaceOverall() const =0
virtual int PointToView(const OdGePoint2d &pointSCS, OdGePoint2d &viewPt) const =0
virtual bool IsDragging() const =0
virtual OdInt16 GetCadWindowId() const =0
virtual void screenRect(OdGsDCPoint &lowerLeft, OdGsDCPoint &upperRight) const =0
virtual size_t numDrawables() const =0
virtual double visibleWidth() const =0
virtual void SetElevation(double dElev)=0
virtual void SetFieldAspectMaintained(bool)=0
virtual OdGeExtents3d GetRealExtents(volatile bool *abortFlag=0) const =0
virtual int PointToWCS(const OdGsDCPoint &pointSCS, const OdGePlane &plane, OdGePoint3d &pointWCS) const =0
virtual const CFxViewportSnapShot * GetPreviousViewSettings() const =0
virtual bool SetPreviousData()=0
virtual bool IsRectangular() const =0
virtual double screenHeight() const =0
virtual int PointToWCSOnUCS(const OdGsDCPoint &pointSCS, OdGePoint3d &pointWCS) const =0
virtual OdGeMatrix3d GetCorrectionScreenMatrix() const =0
virtual OdGeMatrix3d getEyeToScreenMatrix() const =0
virtual OdGeMatrix3d getEyeToWorldTransform() const =0
virtual const CFxVectorizeDevice * GetFxVectorizeDevice() const =0
virtual int PointToWCS(const CFxPointF &pointSCS, const OdGePlane &plane, OdGePoint3d &pointWCS) const =0
virtual bool IsZoomMode() const =0
virtual double visibleHeight() const =0
virtual void PointToSCS(const OdGePoint3d &pointWCS, CFxPoint &pointSCS) const =0
virtual double Elevation() const =0
virtual int PointToView(const OdGsDCPoint &pointSCS, OdGePoint2d &viewPt) const =0
virtual void SetPanMode(bool bVal)=0
virtual bool IsPanMode() const =0
virtual void EnterDragMode()=0
virtual void EndTransaction(bool bAnimate=false)=0
virtual double focalLength() const =0
virtual const QPainterPath & GetViewportInternalRegion() const =0
virtual void PointToSCS(const OdGePoint3d &pointWCS, CFxPointF &pointSCS) const =0
virtual void screenRect(OdGePoint2d &lowerLeft, OdGePoint2d &upperRight) const =0
virtual OdGeMatrix3d EyeToPaperSpace() const =0
virtual int PointToWCSOnUCS(const OdGePoint3d &pointSCS, OdGePoint3d &pointWCS) const =0
virtual bool IsPreviousVectorizationAborted() const =0
virtual bool ZoomExtentsWCS(const OdGeBoundBlock3d *pExtents)=0
virtual void AddViewReactor(CFxViewReactor *pReactor)=0
virtual void StartTransaction()=0
virtual const OdGePoint3dArray & GetViewportExternalRegionWCS() const =0
virtual void SetOrbitMode(bool bVal)=0
virtual CFxVectorizeDevice * GetFxVectorizeDevice()=0
virtual double GetDeviation(const OdGiDeviationType deviationType, const OdGePoint3d &pointOnCurve) const =0
virtual ViewportKey GetVpNum() const =0
virtual void SetZoomMode(bool bVal)=0
virtual void LeaveDragMode()=0
virtual void PointToSCS(const OdGePoint3d &pointWCS, OdGsDCPoint &pointSCS) const =0
virtual bool IsActive() const =0
virtual bool IsOrbitMode() const =0
virtual OdGeVector3d viewDir() const =0
virtual OdGeMatrix3d PaperSpaceToEye() const =0
static OdGeMatrix3d PaperSpaceToEye(OdDbObjectId idViewport)
virtual bool IsOverall() const =0
static OdGeMatrix3d WorldToView(OdDbObjectId id)
virtual int PointToWCSOnUCS(const OdGePoint2d &pointSCS, OdGePoint3d &pointWCS) const =0
virtual void RemoveViewReactor(CFxViewReactor *pReactor)=0
virtual OdGiDrawablePtr drawableAt(size_t iIndex) const =0
~CFxView() override
virtual bool InsideTransaction() const =0
virtual OdGsDCRectDouble visibleScreenRect() const =0
static OdGeMatrix3d EyeToPaperSpace(OdDbObjectId idViewport)
virtual OdDbStub * viewportObjectId() const =0
virtual const QPainterPath & GetViewportExternalRegion() const =0
virtual const OdGePoint3dArray & GetViewportInternalRegionWCS() const =0
virtual bool IsFieldAspectMaintained() const =0
ODRX_DECLARE_MEMBERS(CFxView)
virtual bool GetGeomExtents(OdGeBoundBlock3d &bounds, volatile bool *abortFlag=0) const =0
virtual bool ViewExtentsWCS(OdGeBoundBlock3d &extents) const =0
const OdGePoint3d & GetPosition() const
Definition FxView.h:87
static bool IsViewSettingsValid(const OdDbViewport *pViewport)
const OdGePoint3d & GetTarget() const
Definition FxView.h:97
double GetPixelHeight() const
Definition FxView.h:157
const OdGeVector3d & GetEyeVector() const
Definition FxView.h:107
bool InitializeFromViewInfo(const CFxViewDrawInfo *pViewInfo)
double GetFieldWidth() const
Definition FxView.h:127
const OdGsDCRectDouble & GetVisibleRect() const
Definition FxView.h:182
double GetFieldHeight() const
Definition FxView.h:137
const OdGeVector3d & GetUpVector() const
Definition FxView.h:117
static bool IsViewExtentsValid(const OdGeExtents3d &extents)
double GetFocalLength() const
Definition FxView.h:167
static bool IsViewSettingsValid(const OdGsView *pView)
OdGePoint2d GetNumPixelsInUnitSquare(double iWidthInPixels, double iHeighInPixels, const OdGePoint3d &point, bool bUsePerspective) const
double GetPixelWidth() const
Definition FxView.h:147
void ApplyToView(CFxView *pView)
const OdGeMatrix3d & GetWorldToEyeMatrix() const
Definition FxView.h:177
bool InitializeFromView(const CFxView *pView)
Definition Gs.h:141