CFx SDK Documentation  2020SP3
GiLayerTraitsData.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 _ODGILAYERTRAITSDATA_INCLUDED_
25 #define _ODGILAYERTRAITSDATA_INCLUDED_
26 
27 #include "Gi/GiNonEntityTraits.h"
28 #include "CmColorBase.h"
29 #include "GiDrawImpl.h"
30 #include "GiDummyGeometry.h"
31 class OdGiBaseVectorizer;
32 
33 class OdDbStub;
34 
35 #include "TD_PackPush.h"
36 
46 {
47  virtual OdCmEntityColor trueColor() const = 0;
48 protected:
49  OdCmEntityColor color() const { return trueColor(); }
50 };
51 
60 class OdGiSubEntityTraits_ : public OdGiDummySubEntityTraits< OdGiSubEntityTraits >
61 {
62  virtual OdCmEntityColor trueColor() const = 0;
63 protected:
64  OdUInt16 color() const { return trueColor().colorIndex(); }
65 };
66 
72 {
74  : m_flags(OdGiLayerTraits::kPlottable)
77  , m_color(OdCmEntityColor::kForeground)
78  , m_linetypeId(0)
80  , m_materialId(0)
81  , m_cmTransparency(OdUInt8(0xFF))
82  {
83  }
84  void operator =(const OdGiLayerTraitsData& other)
85  {
86  m_flags = other.m_flags;
87  m_lineweight = other.m_lineweight;
89  m_color = other.m_color;
90  m_linetypeId = other.m_linetypeId;
92  m_materialId = other.m_materialId;
94  }
95 
96  OdUInt32 flags() const { return m_flags; }
98  OdDbStub* linetype() const { return m_linetypeId; }
100  OdDbStub* plotStyleNameId() const { return m_plotStyleNameId; }
101  const OdCmEntityColor& trueColor() const { return m_color; }
102  OdDbStub* materialId() const { return m_materialId; }
104  void setTrueColor(const OdCmEntityColor& cl) { m_color = cl; }
106  void setLinetype(OdDbStub* id) { m_linetypeId = id; }
107  void setMaterial(OdDbStub* id) { m_materialId = id; }
109 
110  bool isOff() const { return GETBIT(m_flags, OdGiLayerTraits::kOff); }
111  void setOff(bool bVal) { SETBIT(m_flags, OdGiLayerTraits::kOff, bVal); }
112 
115 
116  bool isLocked() const { return GETBIT(m_flags, OdGiLayerTraits::kLocked); }
117  void setLocked(bool bVal) { SETBIT(m_flags, OdGiLayerTraits::kLocked, bVal); }
118 
119  bool isFrozen() const { return GETBIT(m_flags, OdGiLayerTraits::kFrozen); }
121 
125 
127  OdDbStub* m_linetypeId;
128  OdDbStub* m_plotStyleNameId;
129 
130  OdDbStub* m_materialId;
132 };
133 
147  , public OdGiDummyWorldDraw< OdGiDummyWorldGeometry< OdGiWorldDraw_ > >
148  , public OdGiDummyViewportDraw< OdGiWrapperViewportGeometry< OdGiViewportDraw_ > >
149  , public OdGiSubEntityTraits_
150  , public OdGiLayerTraitsData
151  //, public OdGiWrapperViewportGeometry< OdGiViewportGeometry >
152 
153 /*class ODGI_EXPORT OdGiLayerTraitsTaker : public OdGiLayerTraits_
154  , public OdGiWorldDraw_
155  , public OdGiViewportDraw_
156  , public OdGiSubEntityTraits_
157  , public OdGiLayerTraitsData*/
158 {
159 protected:
161 private:
162  const OdGiBaseVectorizer* m_pUnderlayingView;
163  OdGiContext* m_pGiContext;
164 
165 public:
167  OdGiLayerTraitsTaker(const OdGiBaseVectorizer* pRefView, OdGiContext* pContext = NULL);
168 
169  void addRef();
170  void release();
171 
172  void setRefView(const OdGiBaseVectorizer* pRefView);
173  void reset() { static_cast<OdGiLayerTraitsData&>(*this) = OdGiLayerTraitsData(); }
174 
176  OdDbStub* linetype() const;
178  OdDbStub* plotStyleNameId() const;
179  OdDbStub* materialId() const;
180  void setColor(const OdCmEntityColor& color);
181  void setLineweight(OdDb::LineWeight lineweight);
182  void setLinetype(OdDbStub* pLinetypeId);
183  void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub* pPlotStyleNameId= 0);
184 
185  bool isOff() const { return GETBIT(m_flags, kOff); }
186  void setOff(bool bVal) { SETBIT(m_flags, kOff, bVal); }
187 
188  bool isPlottable() const { return GETBIT(m_flags, kPlottable); }
189  void setPlottable(bool bVal) { SETBIT(m_flags, kPlottable, bVal); }
190 
191  bool isLocked() const { return GETBIT(m_flags, kLocked); }
192  void setLocked(bool bVal) { SETBIT(m_flags, kLocked, bVal); }
193 
195  OdDbStub* layer() const;
196  OdDbStub* lineType() const;
199  double lineTypeScale() const;
200  double thickness() const;
201  OdDbStub* material() const;
202  const OdGiMapper* mapper() const;
203  OdDbStub* visualStyle() const;
206  bool selectionGeom() const;
208  bool sectionable() const;
210 
211  void setTrueColor(const OdCmEntityColor& color);
212  void setColor(OdUInt16 color);
213  void setLineType(OdDbStub* lineTypeId);
214  void setLineWeight(OdDb::LineWeight lineWeight);
215  void setMaterial(OdDbStub* pMaterialId);
216  void setTransparency(const OdCmTransparency &transparency);
217 
220  const OdGiFill* fill() const;
221 
223  bool regenAbort() const;
226  bool isDragging() const;
227  double deviation(const OdGiDeviationType deviationType,
228  const OdGePoint3d& pointOnCurve) const;
231 
232  void setContext( OdGiContext* pContext);
233 
236  bool isValidId(const OdUInt32 viewportId) const;
237  OdDbStub* viewportObjectId() const;
238 
241 };
242 
243 inline void
245 {
246  m_pUnderlayingView = pRefView;
247 }
248 
249 inline void
251 {
252  m_pGiContext = pContext;
253 }
254 
255 inline
257  : m_pUnderlayingView(0),
258  m_pGiContext( 0 )
259 {
260 }
261 
262 inline
264  : m_pUnderlayingView(pRefView),
265  m_pGiContext( pContext )
266 {
267 }
268 
269 #include "TD_PackPop.h"
270 
271 #endif // #ifndef _ODGILAYERTRAITSDATA_INCLUDED_
GETBIT
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
OdGiLayerTraitsData::lineweight
OdDb::LineWeight lineweight() const
Definition: GiLayerTraitsData.h:97
OdCmEntityColor
Definition: CmColorBase.h:68
OdGiContext
Definition: GiCommonDraw.h:108
OdGiLayerTraitsTaker::thickness
double thickness() const
OdGiLayerTraitsTaker::isLocked
bool isLocked() const
Definition: GiLayerTraitsData.h:191
NULL
#define NULL
Definition: GsProperties.h:177
OdUInt8
unsigned char OdUInt8
Definition: OdPlatformSettings.h:759
OdGiLayerTraitsTaker::numberOfIsolines
OdUInt32 numberOfIsolines() const
OdGiLayerTraitsTaker::setLinetype
void setLinetype(OdDbStub *pLinetypeId)
OdGiLayerTraitsData::m_plotStyleNameId
OdDbStub * m_plotStyleNameId
Definition: GiLayerTraitsData.h:128
OdGiLayerTraitsTaker::addRef
void addRef()
OdGiLayerTraitsData::m_materialId
OdDbStub * m_materialId
Definition: GiLayerTraitsData.h:130
OdGiLayerTraitsData
Definition: GiLayerTraitsData.h:72
OdGiSubEntityTraits_
Definition: GiLayerTraitsData.h:61
OdGiLayerTraitsTaker::setContext
void setContext(OdGiContext *pContext)
Definition: GiLayerTraitsData.h:250
OdGiLayerTraitsTaker::setTrueColor
void setTrueColor(const OdCmEntityColor &color)
OdGiLayerTraitsTaker::isOff
bool isOff() const
Definition: GiLayerTraitsData.h:185
OdGiLayerTraitsTaker::setOff
void setOff(bool bVal)
Definition: GiLayerTraitsData.h:186
OdCmTransparency
Definition: CmColorBase.h:1617
OdGiLayerTraitsData::transparency
OdCmTransparency transparency() const
Definition: GiLayerTraitsData.h:103
OdGiLayerTraitsTaker::setTransparency
void setTransparency(const OdCmTransparency &transparency)
OdGiLayerTraitsData::plotStyleNameId
OdDbStub * plotStyleNameId() const
Definition: GiLayerTraitsData.h:100
OdGiLayerTraitsData::setLinetype
void setLinetype(OdDbStub *id)
Definition: GiLayerTraitsData.h:106
OdGiLayerTraits::kByBlock
@ kByBlock
Definition: GiNonEntityTraits.h:53
OdGiLayerTraitsData::setLocked
void setLocked(bool bVal)
Definition: GiLayerTraitsData.h:117
OdGiLayerTraitsTaker::lineStyleModifiers
const OdGiDgLinetypeModifiers * lineStyleModifiers() const
OdGiLayerTraitsData::setPlottable
void setPlottable(bool bVal)
Definition: GiLayerTraitsData.h:114
OdGiViewport
Definition: GiViewport.h:51
OdGiDummyViewportDraw
Definition: GiDummyGeometry.h:856
OdGiFillType
OdGiFillType
Definition: Gi.h:40
OdGiLayerTraitsTaker::plotStyleNameType
OdDb::PlotStyleNameType plotStyleNameType() const
OdGiBaseVectorizer
Definition: GiBaseVectorizer.h:171
OdGiLayerTraits
Definition: GiNonEntityTraits.h:45
SETBIT
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
OdGiLayerTraitsTaker::selectionGeom
bool selectionGeom() const
OdGiLayerTraitsTaker
Definition: GiLayerTraitsData.h:158
OdGiLayerTraitsData::plotStyleNameType
OdDb::PlotStyleNameType plotStyleNameType() const
Definition: GiLayerTraitsData.h:99
OdGiLayerTraits_
Definition: GiLayerTraitsData.h:46
OdGiLayerTraitsData::setMaterial
void setMaterial(OdDbStub *id)
Definition: GiLayerTraitsData.h:107
OdGiDummySubEntityTraits
Definition: GiDummyGeometry.h:701
OdGiDummyWorldGeometry< OdGiWorldDraw_ >
OdGiLayerTraitsTaker::getWorldToModelTransform
OdGeMatrix3d getWorldToModelTransform() const
OdGiLayerTraitsTaker::isDragging
bool isDragging() const
TD_PackPop.h
OdGiLayerTraitsTaker::setColor
void setColor(OdUInt16 color)
OdGiLayerTraitsData::m_cmTransparency
OdCmTransparency m_cmTransparency
Definition: GiLayerTraitsData.h:131
OdGiLayerTraitsTaker::isPlottable
bool isPlottable() const
Definition: GiLayerTraitsData.h:188
OdGiFill
Definition: GiFill.h:39
OdUInt16
unsigned short OdUInt16
Definition: OdPlatformSettings.h:760
OdGiLayerTraitsTaker::transparency
OdCmTransparency transparency() const
OdGiLayerTraitsTaker::regenAbort
bool regenAbort() const
OdGiLayerTraitsTaker::subEntityTraits
OdGiSubEntityTraits & subEntityTraits() const
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdGiLayerTraitsTaker::setPlottable
void setPlottable(bool bVal)
Definition: GiLayerTraitsData.h:189
OdGeMatrix3d
Definition: GeMatrix3d.h:73
ODGI_EXPORT
#define ODGI_EXPORT
Definition: GiExport.h:35
OdGiLayerTraitsTaker::layer
OdDbStub * layer() const
OdGiLayerTraitsTaker::sequenceNumber
OdUInt32 sequenceNumber() const
OdGiLayerTraitsTaker::lineweight
OdDb::LineWeight lineweight() const
OdGiLayerTraitsTaker::linetype
OdDbStub * linetype() const
OdGiLayerTraitsTaker::setLineWeight
void setLineWeight(OdDb::LineWeight lineWeight)
OdGiLayerTraitsData::m_color
OdCmEntityColor m_color
Definition: GiLayerTraitsData.h:126
OdGiLayerTraitsData::isFrozen
bool isFrozen() const
Definition: GiLayerTraitsData.h:119
OdGiLayerTraitsTaker::materialId
OdDbStub * materialId() const
OdGiDummyWorldDraw
Definition: GiDummyGeometry.h:873
OdGiLayerTraitsTaker::release
void release()
OdGiLayerTraitsTaker::regenType
OdGiRegenType regenType() const
OdGiLayerTraits::kFrozen
@ kFrozen
Definition: GiNonEntityTraits.h:54
OdGiLayerTraitsData::linetype
OdDbStub * linetype() const
Definition: GiLayerTraitsData.h:98
OdGiLayerTraitsTaker::setRefView
void setRefView(const OdGiBaseVectorizer *pRefView)
Definition: GiLayerTraitsData.h:244
OdGePoint3d
Definition: GePoint3d.h:55
OdGiLayerTraitsData::operator=
void operator=(const OdGiLayerTraitsData &other)
Definition: GiLayerTraitsData.h:84
OdGiLayerTraitsData::m_plotStyleNameType
OdDb::PlotStyleNameType m_plotStyleNameType
Definition: GiLayerTraitsData.h:124
OdGiLayerTraitsTaker::getModelToWorldTransform
OdGeMatrix3d getModelToWorldTransform() const
OdGiLayerTraitsTaker::plotStyleNameId
OdDbStub * plotStyleNameId() const
OdGiLayerTraitsData::setOff
void setOff(bool bVal)
Definition: GiLayerTraitsData.h:111
OdGiLayerTraitsData::m_lineweight
OdDb::LineWeight m_lineweight
Definition: GiLayerTraitsData.h:123
OdGiLayerTraitsData::m_linetypeId
OdDbStub * m_linetypeId
Definition: GiLayerTraitsData.h:127
OdGiSubEntityTraits::SelectionFlags
SelectionFlags
Definition: Gi.h:153
GiDummyGeometry.h
OdGiLayerTraitsTaker::deviation
double deviation(const OdGiDeviationType deviationType, const OdGePoint3d &pointOnCurve) const
OdGiLayerTraitsTaker::lineType
OdDbStub * lineType() const
GiDrawImpl.h
OdGiLayerTraitsTaker::rawGeometry
OdGiGeometry & rawGeometry() const
OdGiLayerTraitsTaker::setPlotStyleName
void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub *pPlotStyleNameId=0)
OdGiLayerTraitsTaker::isValidId
bool isValidId(const OdUInt32 viewportId) const
OdDb::kLnWtByLwDefault
@ kLnWtByLwDefault
Definition: OdaDefs.h:409
OdGiLayerTraitsData::isPlottable
bool isPlottable() const
Definition: GiLayerTraitsData.h:113
OdGiLayerTraitsTaker::setColor
void setColor(const OdCmEntityColor &color)
OdCmEntityColor::colorIndex
OdInt16 colorIndex() const
Definition: CmColorBase.h:356
OdGiDgLinetypeModifiers
Definition: GiDgLinetype.h:353
OdGiLayerTraitsData::flags
OdUInt32 flags() const
Definition: GiLayerTraitsData.h:96
CmColorBase.h
OdGiLayerTraitsData::setTrueColor
void setTrueColor(const OdCmEntityColor &cl)
Definition: GiLayerTraitsData.h:104
TD_PackPush.h
OdGiSubEntityTraits
Definition: Gi.h:94
OdGiLayerTraitsTaker::mapper
const OdGiMapper * mapper() const
OdGiLayerTraitsTaker::ODRX_USING_HEAP_OPERATORS
ODRX_USING_HEAP_OPERATORS(OdGiDummyWorldDraw< OdGiDummyWorldGeometry< OdGiWorldDraw_ > >)
OdGiLayerTraitsTaker::setLocked
void setLocked(bool bVal)
Definition: GiLayerTraitsData.h:192
OdGiLayerTraitsData::trueColor
const OdCmEntityColor & trueColor() const
Definition: GiLayerTraitsData.h:101
OdGiLayerTraitsData::OdGiLayerTraitsData
OdGiLayerTraitsData()
Definition: GiLayerTraitsData.h:73
OdGiLayerTraitsTaker::reset
void reset()
Definition: GiLayerTraitsData.h:173
OdGiLayerTraits::kOff
@ kOff
Definition: GiNonEntityTraits.h:55
OdDb::kPlotStyleNameById
@ kPlotStyleNameById
Definition: OdaDefs.h:417
OdGiDeviationType
OdGiDeviationType
Definition: GiCommonDraw.h:64
OdDb::PlotStyleNameType
PlotStyleNameType
Definition: OdaDefs.h:413
OdGiLayerTraitsTaker::viewportObjectId
OdDbStub * viewportObjectId() const
OdGiLayerTraitsTaker::shadowFlags
ShadowFlags shadowFlags() const
OdGiLayerTraitsTaker::lineWeight
OdDb::LineWeight lineWeight() const
OdGiLayerTraitsData::setTransparency
void setTransparency(const OdCmTransparency &transparency)
Definition: GiLayerTraitsData.h:108
OdGiLayerTraitsTaker::trueColor
OdCmEntityColor trueColor() const
OdGiLayerTraitsData::isByBlock
bool isByBlock() const
Definition: GiLayerTraitsData.h:120
OdGiGeometry
Definition: GiGeometry.h:698
OdDb::LineWeight
LineWeight
Definition: OdaDefs.h:382
OdDb
Definition: Db2dPolyline.h:50
OdGiLayerTraitsTaker::drawFlags
OdUInt32 drawFlags() const
OdGiLayerTraitsTaker::lineTypeScale
double lineTypeScale() const
OdGiLayerTraitsData::setLineweight
void setLineweight(OdDb::LineWeight lw)
Definition: GiLayerTraitsData.h:105
OdGiLayerTraits::kPlottable
@ kPlottable
Definition: GiNonEntityTraits.h:56
OdGiLayerTraitsTaker::setMaterial
void setMaterial(OdDbStub *pMaterialId)
OdGiLayerTraitsData::isOff
bool isOff() const
Definition: GiLayerTraitsData.h:110
OdGiLayerTraitsTaker::setLineweight
void setLineweight(OdDb::LineWeight lineweight)
OdGiRegenType
OdGiRegenType
Definition: GiCommonDraw.h:50
OdGiLayerTraitsTaker::material
OdDbStub * material() const
OdGiLayerTraitsTaker::sectionable
bool sectionable() const
OdGiLayerTraitsTaker::setLineType
void setLineType(OdDbStub *lineTypeId)
OdGiLayerTraitsTaker::selectionFlags
SelectionFlags selectionFlags() const
OdGiLayerTraitsData::materialId
OdDbStub * materialId() const
Definition: GiLayerTraitsData.h:102
OdGiLayerTraitsTaker::secondaryTrueColor
OdCmEntityColor secondaryTrueColor() const
OdGiLayerTraits::kLocked
@ kLocked
Definition: GiNonEntityTraits.h:57
OdGiSubEntityTraits::ShadowFlags
ShadowFlags
Definition: Gi.h:145
OdGiMapper
Definition: GiMaterial.h:1123
OdGiLayerTraitsTaker::context
OdGiContext * context() const
OdGiLayerTraitsData::isLocked
bool isLocked() const
Definition: GiLayerTraitsData.h:116
OdGiSubEntityTraits_::color
OdUInt16 color() const
Definition: GiLayerTraitsData.h:64
OdGiLayerTraitsTaker::visualStyle
OdDbStub * visualStyle() const
OdGiLayerTraits_::color
OdCmEntityColor color() const
Definition: GiLayerTraitsData.h:49
OdGiLayerTraitsTaker::viewport
OdGiViewport & viewport() const
OdGiLayerTraitsData::m_flags
OdUInt32 m_flags
Definition: GiLayerTraitsData.h:122
OdGiLayerTraitsTaker::OdGiLayerTraitsTaker
OdGiLayerTraitsTaker()
Definition: GiLayerTraitsData.h:256
OdGiLayerTraitsTaker::fillType
OdGiFillType fillType() const
OdGiLayerTraitsTaker::fill
const OdGiFill * fill() const
GiNonEntityTraits.h