CFx SDK Documentation  2023 SP0
FxView.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 <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 class OdEdCommandContext;
31 class CFxGsNode;
32 class CFxSelectionSet;
33 class CFxViewDrawContext;
34 class CFxVectorizeDevice;
35 class CFxView;
36 class CFxViewReactor;
37 class CFxViewDrawInfo;
38 
39 class QPainterPath;
40 class OdDbViewport;
41 
48 {
49 public:
51 
60  bool InitializeFromView( const CFxView* pView );
61 
70  bool InitializeFromViewInfo( const CFxViewDrawInfo* pViewInfo );
71 
78  void ApplyToView( CFxView* pView );
79 
86  const OdGePoint3d& GetPosition() const
87  {
88  return m_position;
89  }
90 
97  const OdGePoint3d& GetTarget() const
98  {
99  return m_target;
100  }
101 
108  const OdGeVector3d& GetEyeVector() const
109  {
110  return m_eyeVector;
111  }
112 
119  const OdGeVector3d& GetUpVector() const
120  {
121  return m_upVector;
122  }
123 
130  double GetFieldWidth() const
131  {
132  return m_fieldWidth;
133  }
134 
141  double GetFieldHeight() const
142  {
143  return m_fieldHeight;
144  }
145 
152  double GetPixelWidth() const
153  {
154  return m_dPixelWidth;
155  }
156 
163  double GetPixelHeight() const
164  {
165  return m_dPixelHeight;
166  }
167 
174  double GetFocalLength() const
175  {
176  return m_focalLength;
177  }
178 
186  {
187  return m_WorldToEye;
188  }
189 
191  {
192  return m_VisibleRect;
193  }
194 
203  static bool IsViewSettingsValid( const OdGsView* pView );
204 
213  static bool IsViewSettingsValid( const OdDbViewport* pViewport );
214 
223  static bool IsViewExtentsValid( const OdGeExtents3d& extents );
224 
225 /*
226  static bool IsViewSettingsValid(
227  const OdGePoint3d& position,
228  const OdGePoint3d& target,
229  const OdGeVector3d& upVector,
230  double fieldWidth,
231  double fieldHeight );
232 */
234  double iWidthInPixels,
235  double iHeighInPixels,
236  const OdGePoint3d& point,
237  bool bUsePerspective) const;
238 
239 private:
240  OdGePoint3d m_position;
241  OdGePoint3d m_target;
242  OdGeVector3d m_eyeVector;
243  OdGeVector3d m_upVector;
244  double m_fieldWidth;
245  double m_fieldHeight;
246  double m_focalLength;
247 
248  double m_dPixelWidth;
249  double m_dPixelHeight;
250 
251  OdGeMatrix3d m_WorldToEye;
252 
253  OdGsDCRectDouble m_VisibleRect;
254  static bool m_bEvent;
255 };
256 
257 typedef std::vector<CFxViewportSnapShot> VIEWPORTDATA_VECTOR;
258 
265 {
266 public:
267 
270 
272  ~CFxView() override;
273 
275 
280  virtual const CFxVectorizeDevice* GetFxVectorizeDevice() const = 0;
281 
286 
291  virtual const QPainterPath& GetViewportInternalRegion() const = 0;
292 
297  virtual const QPainterPath& GetViewportExternalRegion() const = 0;
298 
302  virtual const OdGePoint3dArray& GetViewportInternalRegionWCS() const = 0;
303 
307  virtual const OdGePoint3dArray& GetViewportExternalRegionWCS() const = 0;
308 
313  virtual bool IsOverall() const = 0;
314 
319  virtual bool IsPaperSpaceOverall() const = 0;
320 
325  virtual bool IsActive() const = 0;
326 
331  virtual bool SetPreviousData() = 0;
332 
337  virtual void StartTransaction() = 0;
338 
343  virtual void EndTransaction() = 0;
344 
349  virtual bool InsideTransaction() const = 0;
350 
354  virtual int PointToWCS( const OdGsDCPoint& pointSCS, const OdGePlane& plane, OdGePoint3d& pointWCS ) const = 0;
355  virtual int PointToWCS( const CFxPointF& pointSCS, const OdGePlane& plane, OdGePoint3d& pointWCS ) const = 0;
356 
360  virtual int PointToWCSOnUCS( const OdGsDCPoint& pointSCS, OdGePoint3d& pointWCS ) const = 0;
361 
365  virtual int PointToWCSOnUCS( const OdGePoint3d& pointSCS, OdGePoint3d& pointWCS ) const = 0;
366 
370  virtual int PointToWCSOnUCS( const OdGePoint2d& pointSCS, OdGePoint3d& pointWCS ) const = 0;
371 
375  virtual void PointToSCS( const OdGePoint3d& pointWCS, OdGsDCPoint& pointSCS ) const = 0;
376 
380  virtual void PointToSCS( const OdGePoint3d& pointWCS, CFxPoint& pointSCS ) const = 0;
381 
385  virtual void PointToSCS( const OdGePoint3d& pointWCS, CFxPointF& pointSCS ) const = 0;
386 
390  virtual int PointToView( const OdGsDCPoint& pointSCS, OdGePoint2d& viewPt ) const = 0;
391 
395  virtual int PointToView( const OdGePoint2d& pointSCS, OdGePoint2d& viewPt ) const = 0;
396 
400  virtual OdGeMatrix3d EyeToPaperSpace() const = 0;
401 
403 
407  virtual OdGeMatrix3d PaperSpaceToEye() const = 0;
408 
410 
418 
423  virtual OdInt16 GetCadWindowId() const = 0;
424 
429  virtual const CFxViewportSnapShot* GetPreviousViewSettings() const = 0;
430 
435  virtual void AddViewReactor( CFxViewReactor* pReactor ) = 0;
436 
441  virtual void RemoveViewReactor( CFxViewReactor* pReactor ) = 0;
442 
447  virtual void SetElevation( double dElev ) = 0;
448 
453  virtual double Elevation() const = 0;
454 
459  virtual bool IsRectangular() const = 0;
460 
465  virtual bool ViewExtentsWCS( OdGeBoundBlock3d& extents ) const = 0;
466 
471  virtual bool ZoomExtentsWCS( const OdGeBoundBlock3d* pExtents ) = 0;
472 
477  virtual void EnterDragMode() = 0;
478 
483  virtual bool IsDragging() const = 0;
484 
489  virtual void LeaveDragMode() = 0;
490 
495  virtual OdGeExtents3d GetRealExtents(volatile bool *abortFlag = 0) const = 0;
496 
501  virtual bool GetGeomExtents( OdGeBoundBlock3d& bounds, volatile bool *abortFlag = 0 ) const = 0;
502 
505  virtual void SetPanMode( bool bVal ) = 0;
506 
507  virtual bool IsPanMode() const = 0;
508 
511  virtual void SetZoomMode( bool bVal ) = 0;
512 
513  virtual bool IsZoomMode() const = 0;
514 
517  virtual void SetOrbitMode( bool bVal ) = 0;
518 
519  virtual bool IsOrbitMode() const = 0;
520 
521  virtual bool IsPreviousVectorizationAborted() const = 0;
524  virtual OdGeVector3d viewDir() const = 0;
525 
528  virtual double focalLength() const = 0;
529 
533 
537 
540  virtual OdGeMatrix3d getEyeToScreenMatrix() const = 0;
541 
544  virtual double GetDeviation(const OdGiDeviationType deviationType, const OdGePoint3d& pointOnCurve) const = 0;
545 
548  virtual void screenRect(OdGsDCPoint &lowerLeft, OdGsDCPoint &upperRight) const = 0;
549 
552  virtual void screenRect(OdGePoint2d &lowerLeft, OdGePoint2d &upperRight) const = 0;
553 
556  virtual OdGsDCRectDouble visibleScreenRect() const = 0;
557 
561 
564  virtual double screenWidth() const = 0;
565 
568  virtual double screenHeight() const = 0;
569 
572  virtual double visibleWidth() const = 0;
573 
576  virtual double visibleHeight() const = 0;
577 
580  virtual OdDbStub* viewportObjectId() const = 0;
581 
585 
588  virtual size_t numDrawables() const = 0;
589 
592  virtual OdGiDrawablePtr drawableAt( size_t iIndex ) const = 0;
593 
597  virtual bool IsFieldAspectMaintained() const = 0;
598 
601  virtual void SetFieldAspectMaintained(bool) = 0;
602 };
603 
604 class OdDbPlotSettings;
605 
610 
612 
613 #include "FxPragmaPop.h"
#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:257
DDKERNEL_API CFxView * GetActiveFxView(OdEdCommandContext *pCmdCtx)
OdGiDeviationType
Definition: GiCommonDraw.h:64
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 CFxVectorizeDevice * GetFxVectorizeDevice()=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 void EndTransaction()=0
virtual const OdGePoint3dArray & GetViewportInternalRegionWCS() const =0
virtual int PointToWCS(const OdGsDCPoint &pointSCS, const OdGePlane &plane, OdGePoint3d &pointWCS) const =0
virtual bool SetPreviousData()=0
virtual bool IsRectangular() const =0
virtual const CFxViewportSnapShot * GetPreviousViewSettings() const =0
virtual const QPainterPath & GetViewportInternalRegion() const =0
virtual double screenHeight() const =0
virtual int PointToWCSOnUCS(const OdGsDCPoint &pointSCS, OdGePoint3d &pointWCS) const =0
virtual const CFxVectorizeDevice * GetFxVectorizeDevice() const =0
virtual OdGeMatrix3d GetCorrectionScreenMatrix() const =0
virtual OdGeMatrix3d getEyeToScreenMatrix() const =0
virtual OdGeMatrix3d getEyeToWorldTransform() 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 double focalLength() 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 OdDbStub * viewportObjectId() const =0
virtual void SetOrbitMode(bool bVal)=0
virtual const OdGePoint3dArray & GetViewportExternalRegionWCS() const =0
virtual double GetDeviation(const OdGiDeviationType deviationType, const OdGePoint3d &pointOnCurve) const =0
virtual void SetZoomMode(bool bVal)=0
virtual void LeaveDragMode()=0
virtual void PointToSCS(const OdGePoint3d &pointWCS, OdGsDCPoint &pointSCS) const =0
virtual const QPainterPath & GetViewportExternalRegion() 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 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
static bool IsViewSettingsValid(const OdDbViewport *pViewport)
const OdGePoint3d & GetTarget() const
Definition: FxView.h:97
double GetPixelHeight() const
Definition: FxView.h:163
const OdGeVector3d & GetUpVector() const
Definition: FxView.h:119
const OdGsDCRectDouble & GetVisibleRect() const
Definition: FxView.h:190
const OdGePoint3d & GetPosition() const
Definition: FxView.h:86
bool InitializeFromViewInfo(const CFxViewDrawInfo *pViewInfo)
double GetFieldWidth() const
Definition: FxView.h:130
double GetFieldHeight() const
Definition: FxView.h:141
const OdGeVector3d & GetEyeVector() const
Definition: FxView.h:108
static bool IsViewExtentsValid(const OdGeExtents3d &extents)
double GetFocalLength() const
Definition: FxView.h:174
static bool IsViewSettingsValid(const OdGsView *pView)
OdGePoint2d GetNumPixelsInUnitSquare(double iWidthInPixels, double iHeighInPixels, const OdGePoint3d &point, bool bUsePerspective) const
double GetPixelWidth() const
Definition: FxView.h:152
void ApplyToView(CFxView *pView)
const OdGeMatrix3d & GetWorldToEyeMatrix() const
Definition: FxView.h:185
bool InitializeFromView(const CFxView *pView)
Definition: Gs.h:133