CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GiVisualStyleData.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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-2024 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 __ODGIVISUALSTYLEDATA_H__
25#define __ODGIVISUALSTYLEDATA_H__
26
27#include "Gi/GiVisualStyle.h"
28#include "StaticRxObject.h"
29
30#include "TD_PackPush.h"
31
32// OdGiVisualStyleDataContainer
33
43class OdGiVisualStyleDataContainer : public OdStaticRxObject<OdGiVisualStyle>
44{
45 public:
52 {
55
60
66 void setBase(OdGiVariant *pVar) { m_pVar = pVar; }
67
71 OdGiVariant *base() { return m_pVar; }
72
76 OdCmEntityColor &entColor() { return const_cast<OdCmEntityColor&>(m_pVar->asColor()); }
77
81 const OdCmEntityColor &entColor() const { return m_pVar->asColor(); }
82
102
124
130 bool isByColor() const { return entColor().isByColor(); }
131
137 bool isByLayer() const { return entColor().isByLayer(); }
138
144 bool isByBlock() const { return entColor().isByBlock(); }
145
153 bool isByACI() const { return entColor().isByACI(); }
154
160 bool isForeground() const { return entColor().isForeground(); }
161
167 bool isByDgnIndex() const { return entColor().isByDgnIndex(); }
168
173 OdUInt32 color() const { return entColor().color(); }
174
181
190
197
204
211
215 OdUInt8 red() const { return entColor().red(); }
216
220 OdUInt8 green() const { return entColor().green(); }
221
225 OdUInt8 blue() const { return entColor().blue(); }
226
248 OdUInt16 colorIndex() const { return entColor().colorIndex(); }
249
277#if 0
278 //DOM-IGNORE-BEGIN
279 OdCmEntityColor m_entColor;
280
281 OdCmColorBaseAdapt() : m_entColor() { }
283 OdCmColorBaseAdapt(const OdCmEntityColor &cColor) : m_entColor(cColor) { }
284 OdCmColorBaseAdapt(const OdCmColorBase &cColor) { m_entColor.setColor(cColor.color()); }
285 OdCmColorBaseAdapt(OdCmEntityColor::ColorMethod cm) : m_entColor(cm) { }
286
305 OdCmEntityColor::ColorMethod colorMethod() const { return m_entColor.colorMethod(); }
306
328
334 bool isByColor() const { return m_entColor.isByColor(); }
335
341 bool isByLayer() const { return m_entColor.isByLayer(); }
342
348 bool isByBlock() const { return m_entColor.isByBlock(); }
349
357 bool isByACI() const { return m_entColor.isByACI(); }
358
364 bool isForeground() const { return m_entColor.isForeground(); }
365
371 bool isByDgnIndex() const { return m_entColor.isByDgnIndex(); }
372
377 OdUInt32 color() const { return m_entColor.color(); }
378
384 void setColor(OdUInt32 color) { m_entColor.setColor(color); }
385
393 void setRGB(OdUInt8 red, OdUInt8 green, OdUInt8 blue) { m_entColor.setRGB(red, green, blue); }
394
400 void setRed(OdUInt8 red) { m_entColor.setRed(red); }
401
407 void setGreen(OdUInt8 green) { m_entColor.setGreen(green); }
408
414 void setBlue(OdUInt8 blue) { m_entColor.setBlue(blue); }
415
419 OdUInt8 red() const { return m_entColor.red(); }
420
424 OdUInt8 green() const { return m_entColor.green(); }
425
429 OdUInt8 blue() const { return m_entColor.blue(); }
430
452 OdUInt16 colorIndex() const { return m_entColor.colorIndex(); }
453
481#endif
482 // Unnecessary methods
483 bool setNames(const OdString& /*colorName*/, const OdString& /*bookName*/ = OdString::kEmpty) { return false; }
487 //DOM-IGNORE-END
488 };
489
490 // Style subclasses
491
497 class OdGiFaceStyleDataContainer : public OdStaticRxObject<OdGiFaceStyle>
498 {
499 protected:
502 public:
507 : m_pBase(NULL)
508 {
509 }
510
516
523 {
524 m_pBase = pBase;
526 }
527
532 {
533 return m_pBase;
534 }
535
545
550 {
552 }
553
563
571
578 {
580 }
581
586 {
588 }
589
595 virtual void setFaceModifiers(unsigned long nModifiers)
596 {
598 }
599
606 virtual void setFaceModifierFlag(FaceModifier flag, bool bEnable)
607 {
608 m_pBase->setTraitFlag(OdGiVisualStyleProperties::kFaceModifiers, flag, bEnable);
609 }
610
614 virtual unsigned long faceModifiers() const
615 {
616 return (unsigned long)m_pBase->trait(OdGiVisualStyleProperties::kFaceModifiers)->asInt();
617 }
618
626 virtual bool isFaceModifierFlagSet(FaceModifier flag) const
627 {
628 return m_pBase->traitFlag(OdGiVisualStyleProperties::kFaceModifiers, flag);
629 }
630
637 virtual void setOpacityLevel(double nLevel, bool bEnableModifier)
638 {
640 if (bEnableModifier)
641 setFaceModifierFlag(kOpacity, bEnableModifier);
642 }
643
647 virtual double opacityLevel() const
648 {
649 return m_pBase->trait(OdGiVisualStyleProperties::kFaceOpacity)->asDouble();
650 }
651
658 virtual void setSpecularAmount(double nAmount, bool bEnableModifier)
659 {
661 if (bEnableModifier)
662 setFaceModifierFlag(kSpecular, bEnableModifier);
663 }
664
668 virtual double specularAmount() const
669 {
670 return m_pBase->trait(OdGiVisualStyleProperties::kFaceSpecular)->asDouble();
671 }
672
679 virtual void setMonoColor(const OdCmColorBase& color, bool bEnableMode)
680 {
682 if (bEnableMode)
684 }
685
689 virtual const OdCmColorBase& monoColor() const
690 {
691 return m_cmMonoColor;
692 }
693
698 {
699 return m_cmMonoColor;
700 }
701 };
702
708 class OdGiEdgeStyleDataContainer : public OdStaticRxObject<OdGiEdgeStyle>
709 {
710 protected:
717 public:
723 : m_pBase(NULL)
725 {
726 }
727
733
747
752 {
753 return m_pBase;
754 }
755
761 virtual void setEdgeModel(EdgeModel model)
762 {
764 }
765
770 virtual EdgeModel edgeModel() const
771 {
773 }
774
780 virtual void setEdgeStyles(unsigned long nStyles)
781 {
783 }
784
791 virtual void setEdgeStyleFlag(EdgeStyle flag, bool bEnable)
792 {
793 m_pBase->setTraitFlag(OdGiVisualStyleProperties::kEdgeStyles, flag, bEnable);
794 }
795
799 virtual unsigned long edgeStyles() const
800 {
801 return (unsigned long)m_pBase->trait(OdGiVisualStyleProperties::kEdgeStyles)->asInt();
802 }
803
811 virtual bool isEdgeStyleFlagSet(EdgeStyle flag) const
812 {
813 return m_pBase->traitFlag(OdGiVisualStyleProperties::kEdgeStyles, flag);
814 }
815
821 virtual void setIntersectionColor(const OdCmColorBase& color)
822 {
824 }
825
829 virtual const OdCmColorBase& intersectionColor() const
830 {
831 return m_cmIntColor;
832 }
833
838 {
839 return m_cmIntColor;
840 }
841
847 virtual void setObscuredColor(const OdCmColorBase& color)
848 {
850 }
851
855 virtual const OdCmColorBase& obscuredColor() const
856 {
857 return m_cmObColor;
858 }
859
864 {
865 return m_cmObColor;
866 }
867
877
882 {
884 }
885
895
903
909 virtual void setCreaseAngle(double nAngle)
910 {
912 }
913
918 virtual double creaseAngle() const
919 {
920 return m_pBase->trait(OdGiVisualStyleProperties::kEdgeCreaseAngle)->asDouble();
921 }
922
928 virtual void setEdgeModifiers(unsigned long nModifiers)
929 {
931 }
932
939 virtual void setEdgeModifierFlag(EdgeModifier flag, bool bEnable)
940 {
941 m_pBase->setTraitFlag(OdGiVisualStyleProperties::kEdgeModifiers, flag, bEnable);
942 }
943
947 virtual unsigned long edgeModifiers() const
948 {
949 return (unsigned long)m_pBase->trait(OdGiVisualStyleProperties::kEdgeModifiers)->asInt();
950 }
951
959 virtual bool isEdgeModifierFlagSet(EdgeModifier flag) const
960 {
961 return m_pBase->traitFlag(OdGiVisualStyleProperties::kEdgeModifiers, flag);
962 }
963
970 virtual void setEdgeColor(const OdCmColorBase& color, bool bEnableModifier)
971 {
973 }
974
978 virtual const OdCmColorBase& edgeColor() const
979 {
980 return m_cmEdgeColor;
981 }
982
987 {
988 return m_cmEdgeColor;
989 }
990
997 virtual void setOpacityLevel(double nLevel, bool bEnableModifier)
998 {
1000 if (bEnableModifier)
1001 setEdgeModifierFlag(kOpacity, bEnableModifier);
1002 }
1003
1007 virtual double opacityLevel() const
1008 {
1009 return m_pBase->trait(OdGiVisualStyleProperties::kEdgeOpacity)->asDouble();
1010 }
1011
1018 virtual void setEdgeWidth(int nWidth, bool bEnableModifier)
1019 {
1021 if (bEnableModifier)
1022 setEdgeModifierFlag(kWidth, bEnableModifier);
1023 }
1024
1028 virtual int edgeWidth() const
1029 {
1030 return (int)m_pBase->trait(OdGiVisualStyleProperties::kEdgeWidth)->asInt();
1031 }
1032
1039 virtual void setOverhangAmount(int nAmount, bool bEnableModifier)
1040 {
1042 if (bEnableModifier)
1043 setEdgeModifierFlag(kOverhang, bEnableModifier);
1044 }
1045
1049 virtual int overhangAmount() const
1050 {
1051 return (int)m_pBase->trait(OdGiVisualStyleProperties::kEdgeOverhang)->asInt();
1052 }
1053
1060 virtual void setJitterAmount(JitterAmount amount, bool bEnableModifier)
1061 {
1063 if (bEnableModifier)
1064 setEdgeModifierFlag(kJitter, bEnableModifier);
1065 }
1066
1071 {
1073 }
1074
1081 virtual void setWiggleAmount(WiggleAmount amount, bool bEnableModifier)
1082 {
1084 if (bEnableModifier)
1085 setEdgeModifierFlag(kWiggle, bEnableModifier);
1086 }
1087
1092 {
1094 }
1095
1101 virtual void setSilhouetteColor(const OdCmColorBase& color)
1102 {
1104 }
1105
1109 virtual const OdCmColorBase& silhouetteColor() const
1110 {
1111 return m_cmSilColor;
1112 }
1113
1118 {
1119 return m_cmSilColor;
1120 }
1121
1127 virtual void setSilhouetteWidth(short nWidth)
1128 {
1130 }
1131
1135 virtual short silhouetteWidth() const
1136 {
1137 return (short)m_pBase->trait(OdGiVisualStyleProperties::kEdgeSilhouetteWidth)->asInt();
1138 }
1139
1146 virtual void setHaloGap(int nHaloGap, bool bEnableModifier)
1147 {
1149 if (bEnableModifier)
1150 setEdgeModifierFlag(kHaloGap, bEnableModifier);
1151 }
1152
1156 virtual int haloGap() const
1157 {
1158 return (int)m_pBase->trait(OdGiVisualStyleProperties::kEdgeHaloGap)->asInt();
1159 }
1160
1166 virtual void setIsolines(unsigned short nIsolines)
1167 {
1169 }
1170
1174 virtual unsigned short isolines() const
1175 {
1176 return (unsigned short)m_pBase->trait(OdGiVisualStyleProperties::kEdgeIsolines)->asInt();
1177 }
1178
1184 virtual void setHidePrecision(bool bHidePrecision)
1185 {
1186 m_pBase->setTrait(OdGiVisualStyleProperties::kEdgeHidePrecision, bHidePrecision);
1187 }
1188
1194 virtual bool hidePrecision() const
1195 {
1196 return (unsigned short)m_pBase->trait(OdGiVisualStyleProperties::kEdgeHidePrecision)->asBoolean();
1197 }
1198
1205 {
1206 m_esApply = apply;
1207 }
1208
1213 {
1214 return m_esApply;
1215 }
1216 };
1217
1223 class OdGiDisplayStyleDataContainer : public OdStaticRxObject<OdGiDisplayStyle>
1224 {
1225 protected:
1227 public:
1232 : m_pBase(NULL)
1233 {
1234 }
1235
1241
1248 {
1249 m_pBase = pBase;
1250 }
1251
1256 {
1257 return m_pBase;
1258 }
1259
1265 virtual void setDisplaySettings(unsigned long nSettings)
1266 {
1268 }
1269
1276 virtual void setDisplaySettingsFlag(DisplaySettings flag, bool bEnable)
1277 {
1278 m_pBase->setTraitFlag(OdGiVisualStyleProperties::kDisplayStyles, flag, bEnable);
1279 }
1280
1284 virtual unsigned long displaySettings() const
1285 {
1286 return (unsigned long)m_pBase->trait(OdGiVisualStyleProperties::kDisplayStyles)->asInt();
1287 }
1288
1297 {
1298 return m_pBase->traitFlag(OdGiVisualStyleProperties::kDisplayStyles, flag);
1299 }
1300
1306 virtual void setBrightness(double value)
1307 {
1309 }
1310
1314 virtual double brightness() const
1315 {
1316 return m_pBase->trait(OdGiVisualStyleProperties::kDisplayBrightness)->asDouble();
1317 }
1318
1328
1332 virtual ShadowType shadowType() const
1333 {
1335 }
1336 };
1337 protected:
1344 public:
1350 : m_faceStyle()
1351 , m_edgeStyle()
1352 , m_displayStyle()
1353 , m_type(kCustom)
1354 {
1355 // Setup redirections
1356 m_faceStyle.setBase(this);
1357 m_edgeStyle.setBase(this);
1358 m_displayStyle.setBase(this);
1359 // Face properties
1367 // Edge properties
1386 // Display properties
1390 // New in AC2011, 2013
1396 // New in 2013
1422 // Operations
1423 for (long nOp1 = 0; nOp1 < OdGiVisualStyleProperties::kColor; ++nOp1)
1429 }
1430
1436
1438
1439
1443 {
1444 return m_faceStyle;
1445 }
1446
1451 {
1452 return m_edgeStyle;
1453 }
1454
1459 {
1460 return m_displayStyle;
1461 }
1462
1466 virtual const OdGiFaceStyle& faceStyle() const
1467 {
1468 return m_faceStyle;
1469 }
1470
1474 virtual const OdGiEdgeStyle& edgeStyle() const
1475 {
1476 return m_edgeStyle;
1477 }
1478
1482 virtual const OdGiDisplayStyle& displayStyle() const
1483 {
1484 return m_displayStyle;
1485 }
1486
1492 virtual void setFaceStyle(const OdGiFaceStyle& style)
1493 {
1494 m_faceStyle.set(style);
1495 }
1496
1502 virtual void setEdgeStyle(const OdGiEdgeStyle& style)
1503 {
1504 m_edgeStyle.set(style);
1505 }
1506
1512 virtual void setDisplayStyle(const OdGiDisplayStyle& style)
1513 {
1514 m_displayStyle.set(style);
1515 }
1516
1517 // New interface
1518
1527 virtual bool setType(Type type)
1528 {
1529 try
1530 {
1532 }
1533 catch (const OdError &)
1534 {
1535 return false;
1536 }
1537 m_type = type;
1538 return true;
1539 }
1540
1544 virtual Type type() const
1545 {
1546 return m_type;
1547 }
1548
1558 virtual bool setTrait(Property prop, Operation op)
1559 {
1561 {
1562 m_ops[prop] = op;
1563 return true;
1564 }
1565 return false;
1566 }
1567
1578 virtual bool setTrait(Property prop, const OdGiVariant *pVal,
1580 {
1582 pVal && (pVal->type() == propertyType(prop)))
1583 {
1584 static_cast<OdGiVariant&>(m_props[prop]) = *pVal;
1585 m_ops[prop] = op;
1586 return true;
1587 }
1588 return false;
1589 }
1590
1600 virtual OdGiVariantPtr trait(Property prop, Operation *pOp = NULL) const
1601 {
1603 {
1604 if (pOp)
1605 *pOp = m_ops[prop];
1606 return OdGiVariantPtr(m_props + prop);
1607 }
1609 }
1610
1619 virtual Operation operation(Property prop) const
1620 {
1622 {
1623 return m_ops[prop];
1624 }
1626 }
1627};
1628
1629#include "TD_PackPop.h"
1630
1631#endif //__ODGIVISUALSTYLEDATA_H__
ltype
@ red
Definition FxUIEnum.h:84
OdSmartPtr< OdGiVariant > OdGiVariantPtr
Definition GiVariant.h:415
#define OD_T(x)
unsigned int OdUInt32
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
OdString OdString
Definition OdString.h:1258
virtual OdUInt32 color() const =0
void setColor(OdUInt32 color)
OdUInt8 blue() const
bool isByColor() const
bool isForeground() const
void setColorIndex(OdInt16 colorIndex)
void setBlue(OdUInt8 blue)
void setColorMethod(ColorMethod colorMethod)
OdUInt8 green() const
bool isByACI() const
OdUInt32 color() const
OdInt16 colorIndex() const
void setRed(OdUInt8 red)
bool isByBlock() const
OdUInt8 red() const
bool isByDgnIndex() const
ColorMethod colorMethod() const
bool isByLayer() const
void setRGB(OdUInt8 red, OdUInt8 green, OdUInt8 blue)
void setGreen(OdUInt8 green)
VariantType type() const
static OdSmartPtr< OdGiVariant > createObject(const OdGiVariant &value)
virtual bool isDisplaySettingsFlagSet(DisplaySettings flag) const
virtual void setDisplaySettingsFlag(DisplaySettings flag, bool bEnable)
virtual void setOverhangAmount(int nAmount, bool bEnableModifier)
virtual void setEdgeModifierFlag(EdgeModifier flag, bool bEnable)
virtual void setOpacityLevel(double nLevel, bool bEnableModifier)
virtual bool isEdgeModifierFlagSet(EdgeModifier flag) const
virtual void setWiggleAmount(WiggleAmount amount, bool bEnableModifier)
virtual void setEdgeWidth(int nWidth, bool bEnableModifier)
virtual void setEdgeModifiers(unsigned long nModifiers)
virtual void setIntersectionColor(const OdCmColorBase &color)
virtual void setEdgeStyleFlag(EdgeStyle flag, bool bEnable)
virtual void setHaloGap(int nHaloGap, bool bEnableModifier)
virtual void setEdgeColor(const OdCmColorBase &color, bool bEnableModifier)
virtual void setJitterAmount(JitterAmount amount, bool bEnableModifier)
virtual const OdCmColorBase & intersectionColor() const
virtual void setSilhouetteColor(const OdCmColorBase &color)
virtual void setObscuredColor(const OdCmColorBase &color)
virtual void setOpacityLevel(double nLevel, bool bEnableModifier)
virtual bool isFaceModifierFlagSet(FaceModifier flag) const
virtual void setLightingModel(LightingModel lightingModel)
virtual void setMonoColor(const OdCmColorBase &color, bool bEnableMode)
virtual void setLightingQuality(LightingQuality lightingQuality)
virtual void setFaceModifierFlag(FaceModifier flag, bool bEnable)
virtual void setSpecularAmount(double nAmount, bool bEnableModifier)
virtual void setFaceModifiers(unsigned long nModifiers)
virtual OdGiFaceStyle & faceStyle()
OdGiDisplayStyleDataContainer m_displayStyle
virtual void setEdgeStyle(const OdGiEdgeStyle &style)
OdStaticRxObject< OdGiVariant > m_props[OdGiVisualStyleProperties::kPropertyCount]
Operation m_ops[OdGiVisualStyleProperties::kPropertyCount]
OdGiEdgeStyleDataContainer m_edgeStyle
virtual void setFaceStyle(const OdGiFaceStyle &style)
virtual bool setTrait(Property prop, const OdGiVariant *pVal, Operation op=OdGiVisualStyleOperations::kSet)
virtual OdGiDisplayStyle & displayStyle()
virtual Operation operation(Property prop) const
virtual void setDisplayStyle(const OdGiDisplayStyle &style)
virtual OdGiEdgeStyle & edgeStyle()
virtual OdGiVariantPtr trait(Property prop, Operation *pOp=NULL) const
OdGiFaceStyleDataContainer m_faceStyle
virtual const OdGiDisplayStyle & displayStyle() const
virtual bool setType(Type type)
virtual const OdGiEdgeStyle & edgeStyle() const
virtual bool setTrait(Property prop, Operation op)
virtual const OdGiFaceStyle & faceStyle() const
void configureForType(Type type)
static OdGiVariant::VariantType propertyType(Property prop)
OdGiVisualStyleProperties::Property Property
OdGiVisualStyleOperations::Operation Operation
ODRX_HEAP_OPERATORS()
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition OdString.h:100
GLfloat GLfloat blue
Definition gles2_ext.h:147
GLfloat green
Definition gles2_ext.h:147
GLsizei const GLfloat * value
Definition gles2_ext.h:302
OdCmEntityColor::ColorMethod colorMethod() const
void setColorMethod(OdCmEntityColor::ColorMethod colorMethod)
void setRGB(OdUInt8 red, OdUInt8 green, OdUInt8 blue)
bool setNames(const OdString &, const OdString &=OdString::kEmpty)