CFx SDK Documentation  2020SP3
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__
OdDbUnderlayItemPE::getThumbnail
virtual OdGiRasterImagePtr getThumbnail(OdDbUnderlayItem *pItem, int width, int height) const =0
OdUnderlayLayer::OdUnderlayLayer
OdUnderlayLayer()
OdDbUnderlayItemPE2::Abort
Definition: DbUnderlayItem.h:185
OdResult
OdResult
Definition: OdResult.h:29
OdGePlane
Definition: GePlane.h:45
OdDb::UnitsValue
UnitsValue
Definition: OdaDefs.h:444
OdGeVector3d
Definition: GeVector3d.h:54
OdString
Definition: OdString.h:95
OdDbUnderlayItem::underlayLayerCount
virtual OdUInt32 underlayLayerCount() const
OdRxObjectPtr
Definition: RxObject.h:345
GiRasterImage.h
OdDbUnderlayItemPE2::DwgParams::_ds
double _ds
Definition: DbUnderlayItem.h:170
OdUInt8
unsigned char OdUInt8
Definition: OdPlatformSettings.h:759
OdDbUnderlayItem::getOsnapPoints
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
name
GLuint const GLchar * name
Definition: gles2_ext.h:265
OdDbUnderlayItemPE::OnImageReady::_pFn
FnImageReady _pFn
Definition: DbUnderlayItem.h:149
OdUnderlayLayer::state
State state() const
OdDbUnderlayItemPE2::getMeasureDictInfo
virtual void getMeasureDictInfo(OdDbUnderlayItemPtr item, double &measure) const =0
OdDbUnderlayDrawContext::fade
OdUInt8 fade
Definition: DbUnderlayItem.h:74
OdRxObject
Definition: RxObject.h:564
OdDbUnderlayItem::getName
virtual OdString getName() const =0
OdUnderlayLayer
Definition: DbUnderlayItem.h:48
source
GLsizei GLsizei GLchar * source
Definition: gles2_ext.h:282
OdDbUnderlayItemPE2::DwgParams::_pixelDensity
OdGePoint2d _pixelDensity
Definition: DbUnderlayItem.h:169
FacetModelerProfile2DBool::min
const T & min(const T &x, const T &y)
Definition: FMImpProfile2DBool.h:98
GePoint3dArray.h
OdDbUnderlayItem::getThumbnail
virtual OdGiRasterImagePtr getThumbnail() const =0
OdArray< OdUnderlayLayer >
OdUnderlayLayer::State
State
Definition: DbUnderlayItem.h:54
OdDbUnderlayItemPE2::getParameters
virtual void getParameters(OdDbUnderlayItemPtr item, const DwgParams &dwgParams, std::vector< PdfParams > &pdfParams) const =0
TD_PackPop.h
IntArray.h
OdGsMarker
ptrdiff_t OdGsMarker
Definition: OdPlatformSettings.h:889
x
GLfloat x
Definition: gles2_ext.h:314
OdDbUnderlayItemPE::getImage
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
OdGeExtents2d
Definition: GeExtents2d.h:43
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdGeMatrix3d
Definition: GeMatrix3d.h:73
OdDbUnderlayItemPE2Ptr
OdSmartPtr< OdDbUnderlayItemPE2 > OdDbUnderlayItemPE2Ptr
Definition: DbUnderlayItem.h:193
DbRootExport.h
OdDbUnderlayItemPE::OnImageReady::_pData
void * _pData
Definition: DbUnderlayItem.h:147
OdDbUnderlayItemPE::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdDbUnderlayItemPE)
OdDbUnderlayDrawContext
Definition: DbUnderlayItem.h:72
OdDbUnderlayItemPE2::DwgParams
Definition: DbUnderlayItem.h:168
OdDbUnderlayItem::getUnits
virtual OdDb::UnitsValue getUnits() const =0
OdDb::Intersect
Intersect
Definition: OdaDefs.h:470
OdaDefs.h
OdDbUnderlayItem::getThumbnail
virtual OdGiRasterImagePtr getThumbnail(int width, int height) const
OdSmartPtr< OdGiRasterImage >
OdGePoint3d
Definition: GePoint3d.h:55
OdUnderlayLayer::~OdUnderlayLayer
~OdUnderlayLayer()
OdUnderlayLayer::name
OdString name() const
OdDbUnderlayItem::viewportDraw
virtual void viewportDraw(OdGiViewportDraw *pVd, const OdDbUnderlayDrawContext &context) const =0
OdDb::OsnapMode
OsnapMode
Definition: OdaDefs.h:478
OdDbUnderlayItemPE2::PdfParams::_measureScale
double _measureScale
Definition: DbUnderlayItem.h:177
FacetModelerProfile2DBool::max
const T & max(const T &x, const T &y)
Definition: FMImpProfile2DBool.h:105
OdDbUnderlayItemPtr
OdSmartPtr< OdDbUnderlayItem > OdDbUnderlayItemPtr
Definition: DbUnderlayItem.h:134
OdDbUnderlayItemPE2::DwgParams::_x
OdGeMatrix3d _x
Definition: DbUnderlayItem.h:171
height
GLint GLenum GLsizei GLsizei height
Definition: gles2_ext.h:110
v
const GLfloat * v
Definition: gles2_ext.h:315
width
GLint GLenum GLsizei width
Definition: gles2_ext.h:110
OdPlatformSettings.h
GeExtents2d.h
OdDbUnderlayDrawContext::adjustColorForBackground
bool adjustColorForBackground
Definition: DbUnderlayItem.h:76
TD_PackPush.h
OdDbUnderlayItem::usingPartialContent
virtual bool usingPartialContent() const
OdDbUnderlayItemPE::viewportDraw
virtual bool viewportDraw(OdDbUnderlayItemPtr item, OdGiViewportDraw *pVd, const OdDbUnderlayDrawContext &context, const OdDbUnderlayReference *obj) const =0
OdDbUnderlayItemPEPtr
OdSmartPtr< OdDbUnderlayItemPE > OdDbUnderlayItemPEPtr
Definition: DbUnderlayItem.h:156
OdGiWorldDraw
Definition: GiWorldDraw.h:44
OdDbUnderlayItem::getUnderlayLayer
virtual OdResult getUnderlayLayer(int idx, OdUnderlayLayer &layer) const
OdDbUnderlayDrawContext::contrast
OdUInt8 contrast
Definition: DbUnderlayItem.h:73
OdDbUnderlayItemPE2::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdDbUnderlayItemPE2)
OdDbUnderlayItemPE2
Definition: DbUnderlayItem.h:162
OdDbUnderlayItem::modelTransform
virtual OdGeMatrix3d modelTransform() const
OdDbUnderlayItem::getSubEntityAtGsMarker
virtual OdRxObjectPtr getSubEntityAtGsMarker(const OdGeMatrix3d &modelToWorld, OdGsMarker gsSelectionMark) const
OdDbUnderlayItemPE2::PdfParams::_dpi_ratio
double _dpi_ratio
Definition: DbUnderlayItem.h:178
OdDbUnderlayItemPE2::Abort::_pFn
FnAbort _pFn
Definition: DbUnderlayItem.h:188
OdDbUnderlayItemPE2::PdfParams
Definition: DbUnderlayItem.h:175
OdDbUnderlayItemPE2::getPageSize
virtual void getPageSize(OdDbUnderlayItemPtr item, OdGePoint2d &pageSize) const =0
DBROOT_EXPORT
#define DBROOT_EXPORT
Definition: DbRootExport.h:39
OdDbUnderlayItemPE2::PdfParams::PdfParams
PdfParams(const OdGeExtents2d &clipRect, double measureScale, double dpi_ratio)
OdDbUnderlayItemPE
Definition: DbUnderlayItem.h:141
OdDbUnderlayDrawContext::layers
OdArray< OdUnderlayLayer > layers
Definition: DbUnderlayItem.h:77
OdDbUnderlayItem::ODRX_DECLARE_MEMBERS
ODRX_DECLARE_MEMBERS(OdDbUnderlayItem)
ODCOLORREF
#define ODCOLORREF
Definition: OdPlatform.h:883
OdDbUnderlayReference
Definition: DbUnderlayReference.h:44
OdDbUnderlayItemPE::OnImageReady
Definition: DbUnderlayItem.h:146
OdDbUnderlayItemPE2::PdfParams::GetUV
static void GetUV(const OdGeExtents2d &clipRect, double measureScale, double dpi_ratio, OdGePoint3d &origin, OdGeVector3d &u, OdGeVector3d &v)
OdUnderlayLayer::OdUnderlayLayer
OdUnderlayLayer(const OdUnderlayLayer &source)
GeMatrix3d.h
OdDbUnderlayItem
Definition: DbUnderlayItem.h:85
OdDbUnderlayItemPE2::getImage
virtual void getImage(OdDbUnderlayItemPtr item, const PdfParams &pdfParams, Abort abort, ODCOLORREF backgroundColor, const OdDbUnderlayDrawContext &context, OdGiRasterImagePtr &pImage) const =0
OdDbUnderlayItemPE2::PdfParams::_clipRect
OdGeExtents2d _clipRect
Definition: DbUnderlayItem.h:176
GePoint2d.h
void
typedef void(APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture)
OdDbUnderlayItem::version
int version() const
OdDbUnderlayItem::worldDraw
virtual bool worldDraw(OdGiWorldDraw *pWd, const OdDbUnderlayDrawContext &context) const =0
OdDbUnderlayItem::getExtents
virtual void getExtents(OdGePoint2d &min, OdGePoint2d &max) const =0
OdUnderlayLayer::setState
void setState(State state)
OdDbUnderlayDrawContext::monochrome
bool monochrome
Definition: DbUnderlayItem.h:75
OdDbUnderlayItem::getMediaBox
virtual OdResult getMediaBox(OdGePoint2d &min, OdGePoint2d &max) const
OdDbUnderlayItemPE2::Abort::_pData
void * _pData
Definition: DbUnderlayItem.h:186
OdGiViewportDraw
Definition: GiViewportDraw.h:50
OdDbUnderlayItem::intersectWith
virtual OdResult intersectWith(const OdGeMatrix3d &modelToWorld, const OdRxObject *pEnt, OdDb::Intersect intType, const OdGePlane *projPlane, OdGePoint3dArray &points, OdGsMarker thisGsMarker, OdGsMarker otherGsMarker) const
OdUnderlayLayer::setName
void setName(const OdString &name)
OdGePoint2d
Definition: GePoint2d.h:60