CFx SDK Documentation  2023 SP0
DbUnderlayItem.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef __OD_DB_UNDERLAY_ITEM__
25 #define __OD_DB_UNDERLAY_ITEM__
26 
27 #include "TD_PackPush.h"
28 
29 #include "OdPlatformSettings.h"
30 #include "DbRootExport.h"
31 #include "Gi/GiRasterImage.h"
32 #include "Ge/GePoint3dArray.h"
33 #include "IntArray.h"
34 #include "OdaDefs.h"
35 
36 #include <vector>
37 
38 class OdGePoint2d;
39 class OdGeMatrix3d;
40 class OdGePlane;
41 class OdGiWorldDraw;
42 class OdGiViewportDraw;
43 //const int kItemVersionNumber = 1;
44 
48 {
49 public:
52 
53  enum State
54  {
55  kOff = 0,
56  kOn = 1
57  };
58 
59  OdString name() const;
60  State state() const;
61  void setName(const OdString& name);
62  void setState(State state);
63 
64  OdUnderlayLayer& operator =(const OdUnderlayLayer& source);
66 
67 private:
68  class OdUnderlayLayerImpl* m_pImpl;
69 };
70 
72 {
75  bool monochrome;
78 };
79 
85 {
86 public:
88 
89  virtual OdString getName() const = 0;
90 
91  virtual OdGiRasterImagePtr getThumbnail() const = 0;
92  virtual OdGiRasterImagePtr getThumbnail(int width, int height) const;
93 
94  virtual void getExtents(OdGePoint2d& min, OdGePoint2d& max) const = 0;
95 
96  virtual OdDb::UnitsValue getUnits() const = 0;
97 
98  virtual bool usingPartialContent() const;
99 
100  virtual bool worldDraw(OdGiWorldDraw* pWd, const OdDbUnderlayDrawContext& context) const = 0;
101 
102  virtual void viewportDraw(OdGiViewportDraw* pVd, const OdDbUnderlayDrawContext& context) const = 0;
103 
104  virtual OdGeMatrix3d modelTransform() const;
105 
106  virtual OdResult getMediaBox(OdGePoint2d &min, OdGePoint2d &max) const; //to use with PdfUnderlays because getExtents can return extents in mm or in inches randomly, this method always return media box in 1/72 inch
107 
108  virtual OdResult getOsnapPoints(const OdGeMatrix3d& modelToWorld,
109  OdDb::OsnapMode osnapMode,
110  OdGsMarker gsSelectionMark,
111  const OdGePoint3d& pickPoint,
112  const OdGePoint3d& lastPoint,
113  const OdGeMatrix3d& viewXform,
114  const OdGeMatrix3d& ucs,
115  OdGePoint3dArray& snapPoints,
116  OdIntArray& geomIds) const;
117 
118  virtual OdRxObjectPtr getSubEntityAtGsMarker(const OdGeMatrix3d& modelToWorld, OdGsMarker gsSelectionMark) const;
119 
120  virtual OdResult intersectWith(const OdGeMatrix3d& modelToWorld,
121  const OdRxObject* pEnt,
122  OdDb::Intersect intType,
123  const OdGePlane* projPlane,
124  OdGePoint3dArray& points,
125  OdGsMarker thisGsMarker,
126  OdGsMarker otherGsMarker) const;
127 
128  virtual OdUInt32 underlayLayerCount() const;
129  virtual OdResult getUnderlayLayer(int idx, OdUnderlayLayer& layer) const;
130 
131  int version() const;
132 };
133 
135 
136 //FELIX_CHANGE_BEGIN
137 #if !defined( SWIG ) //TODO: add managed support
138 class OdGeVector3d;
141 {
142 public:
144  virtual OdGiRasterImagePtr getThumbnail( OdDbUnderlayItem* pItem, int width, int height ) const = 0;
146  {
147  void* _pData;
148  typedef void( *FnImageReady )( OnImageReady* pThis, OdGePoint3d& origin, OdGeVector3d& u, OdGeVector3d& v, OdGiRasterImagePtr& image );
149  FnImageReady _pFn;
150  };
151  virtual void getImage( OdDbUnderlayItemPtr item, bool isPreview, const OdGePoint2d& pixelDensity, double ds, const OdGeMatrix3d& x, const OdGePoint2d vps[], ODCOLORREF backgroundColor,
152  const OdDbUnderlayDrawContext& context, OdUInt32 viewportId, OdDbUnderlayReference* obj, bool isPlotGeneration,
153  OnImageReady* pCallback ) const = 0;
154  virtual bool viewportDraw( OdDbUnderlayItemPtr item, OdGiViewportDraw* pVd, const OdDbUnderlayDrawContext& context, const OdDbUnderlayReference* obj ) const = 0;
155 };
157 
158 #include "Ge/GeExtents2d.h"
159 #include "Ge/GeMatrix3d.h"
160 #include "Ge/GePoint2d.h"
162 {
163 public:
165  virtual void getPageSize( OdDbUnderlayItemPtr item, OdGePoint2d& pageSize ) const = 0;
166  virtual void getMeasureDictInfo( OdDbUnderlayItemPtr item, double& measure ) const = 0;
168  {
170  double _ds;
172  OdGePoint2d _vps[2];
173  };
175  {
178  double _dpi_ratio;
179  PdfParams( const OdGeExtents2d& clipRect, double measureScale, double dpi_ratio );
180  static void GetUV( const OdGeExtents2d& clipRect, double measureScale, double dpi_ratio,
181  /*out*/ OdGePoint3d& origin, /*out*/ OdGeVector3d& u, /*out*/ OdGeVector3d& v );
182  };
183  virtual void getParameters( OdDbUnderlayItemPtr item, const DwgParams& dwgParams, std::vector<PdfParams>& pdfParams ) const = 0;
184  struct Abort
185  {
186  void* _pData;
187  typedef bool( *FnAbort )( void* pData );
188  FnAbort _pFn;
189  };
190  virtual void getImage( OdDbUnderlayItemPtr item, const PdfParams& pdfParams, Abort abort, ODCOLORREF backgroundColor,
191  const OdDbUnderlayDrawContext& context, OdGiRasterImagePtr& pImage ) const = 0;
192 };
194 #endif
195 //FELIX_CHANGE_END
196 
197 #include "TD_PackPop.h"
198 
199 #endif // __OD_DB_UNDERLAY_ITEM__
#define DBROOT_EXPORT
Definition: DbRootExport.h:39
OdSmartPtr< OdDbUnderlayItem > OdDbUnderlayItemPtr
OdSmartPtr< OdDbUnderlayItemPE2 > OdDbUnderlayItemPE2Ptr
OdSmartPtr< OdDbUnderlayItemPE > OdDbUnderlayItemPEPtr
#define ODCOLORREF
Definition: OdPlatform.h:883
ptrdiff_t OdGsMarker
unsigned int OdUInt32
unsigned char OdUInt8
OdResult
Definition: OdResult.h:29
virtual OdString getName() const =0
int version() const
virtual OdGiRasterImagePtr getThumbnail(int width, int height) const
ODRX_DECLARE_MEMBERS(OdDbUnderlayItem)
virtual OdResult getMediaBox(OdGePoint2d &min, OdGePoint2d &max) const
virtual void viewportDraw(OdGiViewportDraw *pVd, const OdDbUnderlayDrawContext &context) const =0
virtual OdDb::UnitsValue getUnits() const =0
virtual OdGiRasterImagePtr getThumbnail() const =0
virtual OdRxObjectPtr getSubEntityAtGsMarker(const OdGeMatrix3d &modelToWorld, OdGsMarker gsSelectionMark) const
virtual OdResult intersectWith(const OdGeMatrix3d &modelToWorld, const OdRxObject *pEnt, OdDb::Intersect intType, const OdGePlane *projPlane, OdGePoint3dArray &points, OdGsMarker thisGsMarker, OdGsMarker otherGsMarker) const
virtual OdUInt32 underlayLayerCount() const
virtual bool worldDraw(OdGiWorldDraw *pWd, const OdDbUnderlayDrawContext &context) const =0
virtual bool usingPartialContent() const
virtual OdResult getUnderlayLayer(int idx, OdUnderlayLayer &layer) const
virtual OdResult getOsnapPoints(const OdGeMatrix3d &modelToWorld, OdDb::OsnapMode osnapMode, OdGsMarker gsSelectionMark, const OdGePoint3d &pickPoint, const OdGePoint3d &lastPoint, const OdGeMatrix3d &viewXform, const OdGeMatrix3d &ucs, OdGePoint3dArray &snapPoints, OdIntArray &geomIds) const
virtual void getExtents(OdGePoint2d &min, OdGePoint2d &max) const =0
virtual OdGeMatrix3d modelTransform() const
virtual void getParameters(OdDbUnderlayItemPtr item, const DwgParams &dwgParams, std::vector< PdfParams > &pdfParams) const =0
virtual void getPageSize(OdDbUnderlayItemPtr item, OdGePoint2d &pageSize) const =0
virtual void getMeasureDictInfo(OdDbUnderlayItemPtr item, double &measure) const =0
ODRX_DECLARE_MEMBERS(OdDbUnderlayItemPE2)
virtual void getImage(OdDbUnderlayItemPtr item, const PdfParams &pdfParams, Abort abort, ODCOLORREF backgroundColor, const OdDbUnderlayDrawContext &context, OdGiRasterImagePtr &pImage) const =0
virtual void getImage(OdDbUnderlayItemPtr item, bool isPreview, const OdGePoint2d &pixelDensity, double ds, const OdGeMatrix3d &x, const OdGePoint2d vps[], ODCOLORREF backgroundColor, const OdDbUnderlayDrawContext &context, OdUInt32 viewportId, OdDbUnderlayReference *obj, bool isPlotGeneration, OnImageReady *pCallback) const =0
ODRX_DECLARE_MEMBERS(OdDbUnderlayItemPE)
virtual bool viewportDraw(OdDbUnderlayItemPtr item, OdGiViewportDraw *pVd, const OdDbUnderlayDrawContext &context, const OdDbUnderlayReference *obj) const =0
virtual OdGiRasterImagePtr getThumbnail(OdDbUnderlayItem *pItem, int width, int height) const =0
OdString name() const
State state() const
OdUnderlayLayer(const OdUnderlayLayer &source)
void setName(const OdString &name)
void setState(State state)
GLint GLenum GLsizei width
Definition: gles2_ext.h:110
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
GLuint const GLchar * name
Definition: gles2_ext.h:265
const GLfloat * v
Definition: gles2_ext.h:315
GLsizei GLsizei GLchar * source
Definition: gles2_ext.h:282
GLfloat x
Definition: gles2_ext.h:314
GLint GLenum GLsizei GLsizei height
Definition: gles2_ext.h:110
const T & min(const T &x, const T &y)
const T & max(const T &x, const T &y)
Intersect
Definition: OdaDefs.h:472
OsnapMode
Definition: OdaDefs.h:480
UnitsValue
Definition: OdaDefs.h:446
OdArray< OdUnderlayLayer > layers
PdfParams(const OdGeExtents2d &clipRect, double measureScale, double dpi_ratio)
static void GetUV(const OdGeExtents2d &clipRect, double measureScale, double dpi_ratio, OdGePoint3d &origin, OdGeVector3d &u, OdGeVector3d &v)