CFx SDK Documentation  2022 SP0
GiSubEntityTraitsData.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 __ODGISUBENTITYTRAITSDATA_H__
25 #define __ODGISUBENTITYTRAITSDATA_H__
26 
27 #include "TD_PackPush.h"
28 
29 #include "Gi/GiMaterial.h"
30 
32 
38 {
40  {
63  kAllChanged = 0x1FFFFF, // bin: 111111111111111111111
65  };
66 };
67 
73 {
74  // Members
75  //
76  OdUInt16 m_flags;
77  OdUInt16 m_selFlags;
78  OdCmEntityColor m_cmColor;
79  OdDbStub* m_layerId;
80  OdDbStub* m_lineTypeId;
81  OdGiFillType m_fillType;
82  OdDb::LineWeight m_lineWeight;
83  double m_lineTypeScale;
84  double m_thickness;
85  OdDb::PlotStyleNameType m_plotStyleNameType;
86  OdDbStub* m_plotStyleNameId;
87  OdDbStub* m_materialId;
88  const OdGiMapper* m_mapper;
89  OdDbStub* m_visualStyleId;
90  OdCmTransparency m_cmTransparency;
91  OdUInt32 m_drawFlags;
93  OdCmEntityColor m_cmSecondaryColor;
94  const OdGiDgLinetypeModifiers* m_lsModifiers;
95  const OdGiFill* m_fill;
96 
97  enum
98  {
99  kSelectionGeom = 0x100,
100  kSectionable = 0x200
101  };
102 public:
103  enum
104  {
106  kLayerFrozen = 2
107  };
108  // Geometry visibility flags returned by geomVisibilityFlags method.
109  // This is more easy-to-use representation than analysis of selectionGeom and selectionFlags return values.
110  enum
111  {
112  kGeomDisplayNormally = (1 << 0), // Display unhighlighted geometry
113  kGeomSelectNormally = (1 << 1), // Select unhighlighted geometry
114  kGeomDisplayHighlighted = (1 << 2), // Display highlighted geometry
115  kGeomSelectHighlighted = (1 << 3), // Select highlighted geometry
117  };
118 
119  // Constructors/destructors
120  //
122  : m_flags(0)
123  , m_selFlags(0)
124  , m_cmColor(OdCmEntityColor::kForeground)
125  , m_layerId(NULL)
126  , m_lineTypeId(NULL)
127  , m_fillType(kOdGiFillNever)
128  , m_lineWeight(OdDb::kLnWt000)
129  , m_lineTypeScale(1.0)
130  , m_thickness(0.0)
131  , m_plotStyleNameType(OdDb::kPlotStyleNameIsDictDefault)
132  , m_plotStyleNameId(NULL)
133  , m_materialId(NULL)
134  , m_mapper(NULL)
135  , m_visualStyleId(NULL)
136  , m_cmTransparency(OdUInt8(0xFF))
137  , m_drawFlags(0)
138  , m_shadowFlags(OdGiSubEntityTraits::kShadowsCastAndReceive)
139  , m_cmSecondaryColor(OdCmEntityColor::kForeground)
140  , m_lsModifiers(NULL)
141  , m_fill(NULL)
142  {
143  }
144 
145  // Accessors / transformers
146  //
147  OdUInt16 flags() const;
148  OdUInt16 selFlags() const;
150  OdUInt16 geomVisibilityFlags(bool bHighlighted) const;
151  bool isLayerFrozen() const;
152  bool isLayerOff() const;
153  bool isLayerVisible() const;
154  bool visibility() const { return isLayerVisible(); }
155  const OdCmEntityColor& trueColor() const;
156  OdUInt16 color() const;
157  OdDbStub* layer() const;
158  OdDbStub* lineType() const;
159  OdGiFillType fillType() const;
161  double lineTypeScale() const;
162  double thickness() const;
164  OdDbStub* plotStyleNameId() const;
165  OdDbStub* material() const;
166  const OdGiMapper* mapper() const;
167  OdDbStub* visualStyle() const;
168  const OdCmTransparency& transparency() const;
169  OdUInt32 drawFlags() const;
170  bool selectionGeom() const;
172  bool sectionable() const;
174  const OdCmEntityColor& secondaryTrueColor() const;
176  const OdGiFill* fill() const;
177 
178  void setFlags(OdUInt16 flags);
181  void setColor(OdUInt16 colorIndex);
182  void setLayer(OdDbStub* layerId);
183  void setLineType(OdDbStub* lineTypeId);
186  void setLineTypeScale(double lineTypeScale);
187  void setThickness(double thickness);
188  void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub* pPlotStyleNameId);
189  void setMaterial(OdDbStub* materialId);
190  void setMapper(const OdGiMapper* pMapper);
191  void setVisualStyle(OdDbStub* visualStyleId);
194  void setSelectionGeom(bool bSelectionFlag);
196  void setSectionable(bool bSectionableFlag);
200  void setFill(const OdGiFill* pFill);
201 };
202 
203 
205 {
206  return m_flags;
207 }
209 {
210  return m_selFlags;
211 }
213 {
216  {
217  if (GETBIT(m_selFlags, kSelectionGeom)) visFlags &= ~(kGeomDisplayNormally | kGeomDisplayHighlighted);
220  }
221  return visFlags;
222 }
224 { // Returns only first two flags depending onto highlighting state
225  const OdUInt16 visFlags = geomVisibilityFlags();
226  return (!bHighlighted) ? visFlags : (visFlags >> 2);
227 }
229 {
230  return (m_flags & (kLayerOff|kLayerFrozen))==0;
231 }
233 {
234  return GETBIT(m_flags, kLayerFrozen);
235 }
237 {
238  return GETBIT(m_flags, kLayerOff);
239 }
241 {
242  return m_cmColor.colorIndex();
243 }
245 {
246  return m_cmColor;
247 }
248 inline OdDbStub* OdGiSubEntityTraitsData::layer() const
249 {
250  return m_layerId;
251 }
252 inline OdDbStub* OdGiSubEntityTraitsData::lineType() const
253 {
254  return m_lineTypeId;
255 }
257 {
258  return m_fillType;
259 }
261 {
262  return m_lineWeight;
263 }
265 {
266  return m_lineTypeScale;
267 }
269 {
270  return m_thickness;
271 }
273 {
274  return m_plotStyleNameType;
275 }
277 {
278  return m_plotStyleNameId;
279 }
280 inline OdDbStub* OdGiSubEntityTraitsData::material() const
281 {
282  return m_materialId;
283 }
285 {
286  return m_mapper;
287 }
288 inline OdDbStub* OdGiSubEntityTraitsData::visualStyle() const
289 {
290  return m_visualStyleId;
291 }
293 {
294  return m_cmTransparency;
295 }
297 {
298  return m_drawFlags;
299 }
301 {
302  return GETBIT(m_selFlags, kSelectionGeom);
303 }
305 {
306  return m_shadowFlags;
307 }
309 {
310  return GETBIT(m_selFlags, kSectionable);
311 }
313 {
314  return (OdGiSubEntityTraits::SelectionFlags)(m_selFlags & 0xFF);
315 }
317 {
318  return m_cmSecondaryColor;
319 }
321 {
322  return m_lsModifiers;
323 }
325 {
326  return m_fill;
327 }
328 
329 
331 {
332  m_flags = flags;
333 }
335 {
336  m_selFlags = selFlags;
337 }
339 {
340  m_cmColor = trueColor;
341 }
343 {
344  m_cmColor.setColorIndex(colorIndex);
345 }
346 inline void OdGiSubEntityTraitsData::setLayer(OdDbStub* layerId)
347 {
348  m_layerId = layerId;
349 }
350 inline void OdGiSubEntityTraitsData::setLineType(OdDbStub* lineTypeId)
351 {
352  m_lineTypeId = lineTypeId;
353 }
355 {
356  m_fillType = fillType;
357 }
359 {
360  m_lineWeight = lineWeight;
361 }
362 inline void OdGiSubEntityTraitsData::setLineTypeScale(double lineTypeScale)
363 {
364  m_lineTypeScale = lineTypeScale;
365 }
366 inline void OdGiSubEntityTraitsData::setThickness(double thickness)
367 {
368  m_thickness = thickness;
369 }
370 inline void OdGiSubEntityTraitsData::setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub* plotStyleNameId)
371 {
372  m_plotStyleNameType = plotStyleNameType;
373  m_plotStyleNameId = plotStyleNameId;
374 }
375 inline void OdGiSubEntityTraitsData::setMaterial(OdDbStub* materialId)
376 {
377  m_materialId = materialId;
378 }
380 {
381  m_mapper = pMapper;
382 }
383 inline void OdGiSubEntityTraitsData::setVisualStyle(OdDbStub* visualStyleId)
384 {
385  m_visualStyleId = visualStyleId;
386 }
388 {
389  m_cmTransparency = transparency;
390 }
392 {
393  m_drawFlags = drawFlags;
394 }
395 inline void OdGiSubEntityTraitsData::setSelectionGeom(bool bSelectionFlag)
396 {
397  SETBIT(m_selFlags, kSelectionGeom, bSelectionFlag);
398 }
400 {
401  m_shadowFlags = shadowFlags;
402 }
403 inline void OdGiSubEntityTraitsData::setSectionable(bool bSectionableFlag)
404 {
405  SETBIT(m_selFlags, kSectionable, bSectionableFlag);
406 }
408 {
409  m_selFlags = (m_selFlags & (~0xFF)) | (OdUInt16)selectionFlags;
410 }
412 {
413  m_cmSecondaryColor = trueColor;
414 }
416 {
417  m_lsModifiers = pLSMod;
418 }
420 {
421  m_fill = pFill;
422 }
423 
424 #include "TD_PackPop.h"
425 
426 #endif // __ODGISUBENTITYTRAITSDATA_H__
OdGiFillType
Definition: Gi.h:40
@ kOdGiFillNever
Definition: Gi.h:42
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
unsigned short OdUInt16
unsigned char OdUInt8
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
void setColorIndex(OdInt16 colorIndex)
Definition: CmColorBase.h:321
OdInt16 colorIndex() const
Definition: CmColorBase.h:356
OdGiSubEntityTraits::ShadowFlags shadowFlags() const
OdUInt16 geomVisibilityFlags() const
const OdCmEntityColor & secondaryTrueColor() const
OdDbStub * visualStyle() const
void setSelFlags(OdUInt16 selFlags)
OdGiFillType fillType() const
OdDb::PlotStyleNameType plotStyleNameType() const
const OdGiDgLinetypeModifiers * lineStyleModifiers() const
void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub *pPlotStyleNameId)
void setLayer(OdDbStub *layerId)
void setLineType(OdDbStub *lineTypeId)
void setVisualStyle(OdDbStub *visualStyleId)
void setSelectionGeom(bool bSelectionFlag)
void setColor(OdUInt16 colorIndex)
void setTransparency(const OdCmTransparency &transparency)
OdDbStub * plotStyleNameId() const
void setMapper(const OdGiMapper *pMapper)
void setFillType(OdGiFillType fillType)
void setMaterial(OdDbStub *materialId)
void setSelectionFlags(OdGiSubEntityTraits::SelectionFlags selectionFlags)
void setTrueColor(const OdCmEntityColor &trueColor)
void setThickness(double thickness)
void setDrawFlags(OdUInt32 drawFlags)
void setFlags(OdUInt16 flags)
OdDb::LineWeight lineWeight() const
void setSectionable(bool bSectionableFlag)
void setSecondaryTrueColor(const OdCmEntityColor &trueColor)
void setShadowFlags(OdGiSubEntityTraits::ShadowFlags shadowFlags)
void setFill(const OdGiFill *pFill)
const OdGiFill * fill() const
const OdCmEntityColor & trueColor() const
void setLineWeight(OdDb::LineWeight lineWeight)
void setLineTypeScale(double lineTypeScale)
void setLineStyleModifiers(const OdGiDgLinetypeModifiers *pLSMod)
OdGiSubEntityTraits::SelectionFlags selectionFlags() const
const OdCmTransparency & transparency() const
const OdGiMapper * mapper() const
@ kSelectionIgnore
Definition: Gi.h:155
@ kHighlightingGeometry
Definition: Gi.h:156
PlotStyleNameType
Definition: OdaDefs.h:413
@ kPlotStyleNameIsDictDefault
Definition: OdaDefs.h:416
LineWeight
Definition: OdaDefs.h:382
@ kLnWt000
Definition: OdaDefs.h:383