CFx SDK Documentation  2023 SP0
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_
OdGiFillType
Definition: Gi.h:40
OdGiRegenType
Definition: GiCommonDraw.h:50
OdGiDeviationType
Definition: GiCommonDraw.h:64
#define ODGI_EXPORT
Definition: GiExport.h:35
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
unsigned short OdUInt16
unsigned char OdUInt8
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:499
#define GETBIT(flags, bit)
Definition: OdaDefs.h:500
OdInt16 colorIndex() const
Definition: CmColorBase.h:356
OdCmEntityColor color() const
OdGiFillType fillType() const
void setOff(bool bVal)
void setPlottable(bool bVal)
void setLineWeight(OdDb::LineWeight lineWeight)
OdCmTransparency transparency() const
bool isValidId(const OdUInt32 viewportId) const
OdGiRegenType regenType() const
OdDb::PlotStyleNameType plotStyleNameType() const
OdGeMatrix3d getWorldToModelTransform() const
OdDbStub * materialId() const
void setColor(const OdCmEntityColor &color)
bool selectionGeom() const
OdDbStub * viewportObjectId() const
void setLinetype(OdDbStub *pLinetypeId)
void setColor(OdUInt16 color)
void setLineweight(OdDb::LineWeight lineweight)
OdDb::LineWeight lineWeight() const
void setTransparency(const OdCmTransparency &transparency)
OdGeMatrix3d getModelToWorldTransform() const
OdDbStub * lineType() const
void setMaterial(OdDbStub *pMaterialId)
OdDbStub * plotStyleNameId() const
bool regenAbort() const
OdUInt32 numberOfIsolines() const
void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub *pPlotStyleNameId=0)
OdGiContext * context() const
bool isDragging() const
ShadowFlags shadowFlags() const
OdGiSubEntityTraits & subEntityTraits() const
SelectionFlags selectionFlags() const
OdCmEntityColor secondaryTrueColor() const
const OdGiDgLinetypeModifiers * lineStyleModifiers() const
OdUInt32 sequenceNumber() const
const OdGiMapper * mapper() const
void setRefView(const OdGiBaseVectorizer *pRefView)
OdDbStub * layer() const
OdDbStub * material() const
void setContext(OdGiContext *pContext)
OdGiGeometry & rawGeometry() const
double thickness() const
bool sectionable() const
OdUInt32 drawFlags() const
void setTrueColor(const OdCmEntityColor &color)
const OdGiFill * fill() const
double lineTypeScale() const
void setLocked(bool bVal)
OdDb::LineWeight lineweight() const
double deviation(const OdGiDeviationType deviationType, const OdGePoint3d &pointOnCurve) const
OdDbStub * linetype() const
ODRX_USING_HEAP_OPERATORS(OdGiDummyWorldDraw< OdGiDummyWorldGeometry< OdGiWorldDraw_ > >)
OdCmEntityColor trueColor() const
void setLineType(OdDbStub *lineTypeId)
OdGiViewport & viewport() const
OdDbStub * visualStyle() const
OdUInt16 color() const
PlotStyleNameType
Definition: OdaDefs.h:415
@ kPlotStyleNameById
Definition: OdaDefs.h:419
LineWeight
Definition: OdaDefs.h:384
@ kLnWtByLwDefault
Definition: OdaDefs.h:411
void setPlottable(bool bVal)
void setTransparency(const OdCmTransparency &transparency)
void setLocked(bool bVal)
OdDbStub * linetype() const
void setTrueColor(const OdCmEntityColor &cl)
OdDb::LineWeight m_lineweight
OdDb::PlotStyleNameType plotStyleNameType() const
OdDb::LineWeight lineweight() const
void setLineweight(OdDb::LineWeight lw)
void setMaterial(OdDbStub *id)
void operator=(const OdGiLayerTraitsData &other)
void setLinetype(OdDbStub *id)
OdCmEntityColor m_color
OdCmTransparency m_cmTransparency
void setOff(bool bVal)
OdDb::PlotStyleNameType m_plotStyleNameType
OdUInt32 flags() const
OdDbStub * materialId() const
const OdCmEntityColor & trueColor() const
OdCmTransparency transparency() const
OdDbStub * plotStyleNameId() const