CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiSubEntityTraitsData.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2022 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 {
89 kAllChanged = 0x7FFFFF, // bin: 11111111111111111111111
92 };
93};
94
100{
101 // Members
102 //
103 OdUInt16 m_flags;
104 OdUInt16 m_selFlags;
105 OdCmEntityColor m_cmColor;
106 OdDbStub* m_layerId;
107 OdDbStub* m_lineTypeId;
108 OdGiFillType m_fillType;
109 OdDb::LineWeight m_lineWeight;
110 double m_lineTypeScale;
111 double m_thickness;
112 OdDb::PlotStyleNameType m_plotStyleNameType;
113 OdDbStub* m_plotStyleNameId;
114 OdDbStub* m_materialId;
115 const OdGiMapper* m_mapper;
116 OdDbStub* m_visualStyleId;
117 OdCmTransparency m_cmTransparency;
118 OdUInt32 m_drawFlags;
119 OdUInt32 m_lockFlags;
121 OdCmEntityColor m_cmSecondaryColor;
122 const OdGiDgLinetypeModifiers* m_lsModifiers;
123 const OdGiFill* m_fill;
124 OdGiAuxiliaryDataPtr m_pAuxData;
125
126public:
127 enum
128 {
131 // Flags which can be inherited by nested drawables.
134 };
135 enum
136 {
138 kLayerFrozen = 2
139 };
140 // Geometry visibility flags returned by geomVisibilityFlags method.
141 // This is more easy-to-use representation than analysis of selectionGeom and selectionFlags return values.
142 enum
143 {
144 kGeomDisplayNormally = (1 << 0), // Display unhighlighted geometry
145 kGeomSelectNormally = (1 << 1), // Select unhighlighted geometry
146 kGeomDisplayHighlighted = (1 << 2), // Display highlighted geometry
147 kGeomSelectHighlighted = (1 << 3), // Select highlighted geometry
149 };
150
179 : m_flags(0)
180 , m_selFlags(0)
181 , m_cmColor(OdCmEntityColor::kForeground)
182 , m_layerId(NULL)
183 , m_lineTypeId(NULL)
184 , m_fillType(kOdGiFillNever)
185 , m_lineWeight(OdDb::kLnWt000)
186 , m_lineTypeScale(1.0)
187 , m_thickness(0.0)
188 , m_plotStyleNameType(OdDb::kPlotStyleNameIsDictDefault)
189 , m_plotStyleNameId(NULL)
190 , m_materialId(NULL)
191 , m_mapper(NULL)
192 , m_visualStyleId(NULL)
193 , m_cmTransparency(OdUInt8(0xFF))
194 , m_drawFlags(0)
195 , m_lockFlags(0)
196 , m_shadowFlags(OdGiSubEntityTraits::kShadowsCastAndReceive)
197 , m_cmSecondaryColor(OdCmEntityColor::kForeground)
198 , m_lsModifiers(NULL)
199 , m_fill(NULL)
200 {
201 }
202
203 // Accessors / transformers
204 //
208 OdUInt16 flags() const;
209
213 OdUInt16 selFlags() const;
214
219
224 OdUInt16 geomVisibilityFlags(bool bHighlighted) const;
225
233 bool isLayerFrozen() const;
234
242 bool isLayerOff() const;
243
251 bool isLayerVisible() const;
252
260 bool visibility() const { return isLayerVisible(); }
261
267 const OdCmEntityColor& trueColor() const;
268
274 OdUInt16 color() const;
275
281 OdDbStub* layer() const;
282
288 OdDbStub* lineType() const;
289
293 OdGiFillType fillType() const;
294
301
307 double lineTypeScale() const;
308
312 double thickness() const;
313
318
322 OdDbStub* plotStyleNameId() const;
323
329 OdDbStub* material() const;
330
336 const OdGiMapper* mapper() const;
337
343 OdDbStub* visualStyle() const;
344
352 const OdCmTransparency& transparency() const;
353
357 OdUInt32 drawFlags() const;
358
362 OdUInt32 lockFlags() const;
363
369 bool selectionGeom() const;
370
377
385 bool sectionable() const;
386
391
395 const OdCmEntityColor& secondaryTrueColor() const;
396
401
405 const OdGiFill* fill() const;
406
411
412
413
418 void setFlags(OdUInt16 flags);
419
425
433
440 void setColor(OdUInt16 colorIndex);
441
448 void setLayer(OdDbStub* layerId);
449
456 void setLineType(OdDbStub* lineTypeId);
457
463
471
478 void setLineTypeScale(double lineTypeScale);
479
484 void setThickness(double thickness);
485
491 void setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub* pPlotStyleNameId);
492
499 void setMaterial(OdDbStub* materialId);
500
507 void setMapper(const OdGiMapper* pMapper);
508
515 void setVisualStyle(OdDbStub* visualStyleId);
516
526
532
538
545 void setSelectionGeom(bool bSelectionFlag);
546
554
561 void setSectionable(bool bSectionableFlag);
562
568
574
580
585 void setFill(const OdGiFill* pFill);
586
591 void setAuxData(const OdGiAuxiliaryDataPtr& pAuxData);
592};
593
594
596{
597 return m_flags;
598}
600{
601 return m_selFlags;
602}
604{
606 if (GETBIT(m_selFlags, kSelectionGeom |
610 {
611 if (GETBIT(m_selFlags, kSelectionGeom)) visFlags &= ~(kGeomDisplayNormally | kGeomDisplayHighlighted);
615 }
616 return visFlags;
617}
619{ // Returns only first two flags depending onto highlighting state
620 const OdUInt16 visFlags = geomVisibilityFlags();
621 return (!bHighlighted) ? visFlags : (visFlags >> 2);
622}
624{
625 return (m_flags & (kLayerOff|kLayerFrozen))==0;
626}
628{
629 return GETBIT(m_flags, kLayerFrozen);
630}
632{
633 return GETBIT(m_flags, kLayerOff);
634}
636{
637 return m_cmColor.colorIndex();
638}
640{
641 return m_cmColor;
642}
643inline OdDbStub* OdGiSubEntityTraitsData::layer() const
644{
645 return m_layerId;
646}
647inline OdDbStub* OdGiSubEntityTraitsData::lineType() const
648{
649 return m_lineTypeId;
650}
652{
653 return m_fillType;
654}
656{
657 return m_lineWeight;
658}
660{
661 return m_lineTypeScale;
662}
664{
665 return m_thickness;
666}
668{
669 return m_plotStyleNameType;
670}
672{
673 return m_plotStyleNameId;
674}
675inline OdDbStub* OdGiSubEntityTraitsData::material() const
676{
677 return m_materialId;
678}
680{
681 return m_mapper;
682}
684{
685 return m_visualStyleId;
686}
688{
689 return m_cmTransparency;
690}
692{
693 return m_drawFlags;
694}
696{
697 return m_lockFlags;
698}
700{
701 return GETBIT(m_selFlags, kSelectionGeom);
702}
704{
705 return m_shadowFlags;
706}
708{
709 return GETBIT(m_selFlags, kSectionable);
710}
712{
713 return (OdGiSubEntityTraits::SelectionFlags)(m_selFlags & 0xFF);
714}
716{
717 return m_cmSecondaryColor;
718}
720{
721 return m_lsModifiers;
722}
724{
725 return m_fill;
726}
728{
729 return m_pAuxData;
730}
731
733{
734 m_flags = flags;
735}
737{
738 m_selFlags = selFlags;
739}
741{
742 m_cmColor = trueColor;
743}
745{
746 m_cmColor.setColorIndex(colorIndex);
747}
748inline void OdGiSubEntityTraitsData::setLayer(OdDbStub* layerId)
749{
750 // Apply layer overrides
751
752 if( !m_pAuxData.isNull() )
753 {
754 OdGiLayerOverridesPtr pLayerOverrides = m_pAuxData->getLevelOverrides();
755
756 if( !pLayerOverrides.isNull() )
757 {
758 OdDbStub* pOverride = pLayerOverrides->getLayerOverride(layerId);
759
760 if( pOverride )
761 layerId = pOverride;
762 }
763 }
764
765 //
766
767 m_layerId = layerId;
768}
769inline void OdGiSubEntityTraitsData::setLineType(OdDbStub* lineTypeId)
770{
771 m_lineTypeId = lineTypeId;
772}
774{
775 m_fillType = fillType;
776}
778{
779 m_lineWeight = lineWeight;
780}
781inline void OdGiSubEntityTraitsData::setLineTypeScale(double lineTypeScale)
782{
783 m_lineTypeScale = lineTypeScale;
784}
785inline void OdGiSubEntityTraitsData::setThickness(double thickness)
786{
787 m_thickness = thickness;
788}
789inline void OdGiSubEntityTraitsData::setPlotStyleName(OdDb::PlotStyleNameType plotStyleNameType, OdDbStub* plotStyleNameId)
790{
791 m_plotStyleNameType = plotStyleNameType;
792 m_plotStyleNameId = plotStyleNameId;
793}
794inline void OdGiSubEntityTraitsData::setMaterial(OdDbStub* materialId)
795{
796 m_materialId = materialId;
797}
799{
800 m_mapper = pMapper;
801}
802inline void OdGiSubEntityTraitsData::setVisualStyle(OdDbStub* visualStyleId)
803{
804 m_visualStyleId = visualStyleId;
805}
807{
808 m_cmTransparency = transparency;
809}
811{
812 m_drawFlags = drawFlags;
813}
815{
816 m_lockFlags = lockFlags;
817}
818inline void OdGiSubEntityTraitsData::setSelectionGeom(bool bSelectionFlag)
819{
820 SETBIT(m_selFlags, kSelectionGeom, bSelectionFlag);
821}
823{
824 m_shadowFlags = shadowFlags;
825}
826inline void OdGiSubEntityTraitsData::setSectionable(bool bSectionableFlag)
827{
828 SETBIT(m_selFlags, kSectionable, bSectionableFlag);
829}
831{
832 m_selFlags = (m_selFlags & (~0xFF)) | (OdUInt16)selectionFlags;
833}
835{
836 m_cmSecondaryColor = trueColor;
837}
839{
840 m_lsModifiers = pLSMod;
841}
843{
844 m_fill = pFill;
845}
846
848{
849 m_pAuxData = pAuxData;
850}
851
852#include "TD_PackPop.h"
853
854#endif // __ODGISUBENTITYTRAITSDATA_H__
OdGiFillType
Definition: Gi.h:42
@ kOdGiFillNever
Definition: Gi.h:44
unsigned int OdUInt32
unsigned short OdUInt16
unsigned char OdUInt8
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:516
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
bool isNull() const
Definition: BaseObjectPtr.h:86
void setColorIndex(OdInt16 colorIndex)
Definition: CmColorBase.h:372
OdInt16 colorIndex() const
Definition: CmColorBase.h:406
virtual OdGiLayerOverridesPtr getLevelOverrides() const =0
OdGiSubEntityTraits::ShadowFlags shadowFlags() const
OdUInt16 geomVisibilityFlags() const
const OdCmEntityColor & secondaryTrueColor() const
OdDbStub * visualStyle() const
void setSelFlags(OdUInt16 selFlags)
OdGiFillType fillType() const
OdGiAuxiliaryDataPtr auxData() 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 setAuxData(const OdGiAuxiliaryDataPtr &pAuxData)
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)
void setLockFlags(OdUInt32 lockFlags)
OdGiSubEntityTraits::SelectionFlags selectionFlags() const
const OdCmTransparency & transparency() const
const OdGiMapper * mapper() const
@ kSelectionIgnore
Definition: Gi.h:189
@ kHiddenInHighlight
Definition: Gi.h:191
@ kHighlightingGeometry
Definition: Gi.h:190
PlotStyleNameType
Definition: OdaDefs.h:417
LineWeight
Definition: OdaDefs.h:386