CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GiVisualStyleData.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 __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 }
514 {
515 }
516
523 {
524 m_pBase = pBase;
526 }
527
532 {
533 return m_pBase;
534 }
535
542 {
544 }
545
550 {
552 }
553
560 {
562 }
563
568 {
570 }
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 {
609 }
610
614 virtual unsigned long faceModifiers() const
615 {
617 }
618
626 virtual bool isFaceModifierFlagSet(FaceModifier flag) const
627 {
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 {
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 {
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 }
731 {
732 }
733
740 {
741 m_pBase = pBase;
746 }
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 {
794 }
795
799 virtual unsigned long edgeStyles() const
800 {
802 }
803
811 virtual bool isEdgeStyleFlagSet(EdgeStyle flag) const
812 {
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
874 {
876 }
877
882 {
884 }
885
892 {
894 }
895
900 {
902 }
903
909 virtual void setCreaseAngle(double nAngle)
910 {
912 }
913
918 virtual double creaseAngle() const
919 {
921 }
922
928 virtual void setEdgeModifiers(unsigned long nModifiers)
929 {
931 }
932
939 virtual void setEdgeModifierFlag(EdgeModifier flag, bool bEnable)
940 {
942 }
943
947 virtual unsigned long edgeModifiers() const
948 {
950 }
951
959 virtual bool isEdgeModifierFlagSet(EdgeModifier flag) const
960 {
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 {
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 {
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 {
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 {
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 {
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 {
1187 }
1188
1194 virtual bool hidePrecision() const
1195 {
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 }
1239 {
1240 }
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 {
1279 }
1280
1284 virtual unsigned long displaySettings() const
1285 {
1287 }
1288
1297 {
1299 }
1300
1306 virtual void setBrightness(double value)
1307 {
1309 }
1310
1314 virtual double brightness() const
1315 {
1317 }
1318
1325 {
1327 }
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 }
1434 {
1435 }
1436
1441 {
1442 return m_faceStyle;
1443 }
1444
1449 {
1450 return m_edgeStyle;
1451 }
1452
1457 {
1458 return m_displayStyle;
1459 }
1460
1464 virtual const OdGiFaceStyle& faceStyle() const
1465 {
1466 return m_faceStyle;
1467 }
1468
1472 virtual const OdGiEdgeStyle& edgeStyle() const
1473 {
1474 return m_edgeStyle;
1475 }
1476
1480 virtual const OdGiDisplayStyle& displayStyle() const
1481 {
1482 return m_displayStyle;
1483 }
1484
1490 virtual void setFaceStyle(const OdGiFaceStyle& style)
1491 {
1492 m_faceStyle.set(style);
1493 }
1494
1500 virtual void setEdgeStyle(const OdGiEdgeStyle& style)
1501 {
1502 m_edgeStyle.set(style);
1503 }
1504
1510 virtual void setDisplayStyle(const OdGiDisplayStyle& style)
1511 {
1512 m_displayStyle.set(style);
1513 }
1514
1515 // New interface
1516
1525 virtual bool setType(Type type)
1526 {
1527 try
1528 {
1530 }
1531 catch (const OdError &)
1532 {
1533 return false;
1534 }
1535 m_type = type;
1536 return true;
1537 }
1538
1542 virtual Type type() const
1543 {
1544 return m_type;
1545 }
1546
1556 virtual bool setTrait(Property prop, Operation op)
1557 {
1559 {
1560 m_ops[prop] = op;
1561 return true;
1562 }
1563 return false;
1564 }
1565
1576 virtual bool setTrait(Property prop, const OdGiVariant *pVal,
1578 {
1580 pVal && (pVal->type() == propertyType(prop)))
1581 {
1582 static_cast<OdGiVariant&>(m_props[prop]) = *pVal;
1583 m_ops[prop] = op;
1584 return true;
1585 }
1586 return false;
1587 }
1588
1598 virtual OdGiVariantPtr trait(Property prop, Operation *pOp = NULL) const
1599 {
1601 {
1602 if (pOp)
1603 *pOp = m_ops[prop];
1604 return OdGiVariantPtr(m_props + prop);
1605 }
1607 }
1608
1617 virtual Operation operation(Property prop) const
1618 {
1620 {
1621 return m_ops[prop];
1622 }
1624 }
1625};
1626
1627#include "TD_PackPop.h"
1628
1629#endif //__ODGIVISUALSTYLEDATA_H__
ltype
Definition: DimVarDefs.h:2949
OdSmartPtr< OdGiVariant > OdGiVariantPtr
Definition: GiVariant.h:413
#define OD_T(x)
unsigned int OdUInt32
unsigned short OdUInt16
int OdInt32
unsigned char OdUInt8
virtual OdUInt32 color() const =0
void setColor(OdUInt32 color)
OdUInt8 blue() const
Definition: CmColorBase.h:507
bool isByColor() const
Definition: CmColorBase.h:521
bool isForeground() const
Definition: CmColorBase.h:573
void setColorIndex(OdInt16 colorIndex)
Definition: CmColorBase.h:372
void setBlue(OdUInt8 blue)
Definition: CmColorBase.h:473
void setColorMethod(ColorMethod colorMethod)
Definition: CmColorBase.h:274
OdUInt8 green() const
Definition: CmColorBase.h:496
bool isByACI() const
Definition: CmColorBase.h:561
OdUInt32 color() const
Definition: CmColorBase.h:336
OdInt16 colorIndex() const
Definition: CmColorBase.h:406
void setRed(OdUInt8 red)
Definition: CmColorBase.h:443
bool isByBlock() const
Definition: CmColorBase.h:545
OdUInt8 red() const
Definition: CmColorBase.h:485
bool isByDgnIndex() const
Definition: CmColorBase.h:585
ColorMethod colorMethod() const
Definition: CmColorBase.h:303
bool isByLayer() const
Definition: CmColorBase.h:533
void setRGB(OdUInt8 red, OdUInt8 green, OdUInt8 blue)
Definition: CmColorBase.h:423
void setGreen(OdUInt8 green)
Definition: CmColorBase.h:458
void set(const OdGiDisplayStyle &style)
void set(const OdGiEdgeStyle &style)
void set(const OdGiFaceStyle &style)
VariantType type() const
static OdSmartPtr< OdGiVariant > createObject(const OdGiVariant &value)
void set(bool value)
bool asBoolean() const
double asDouble() const
const OdCmEntityColor & asColor() const
OdInt32 asInt() const
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 const OdCmColorBase & silhouetteColor() const
virtual void setJitterAmount(JitterAmount amount, bool bEnableModifier)
virtual const OdCmColorBase & intersectionColor() const
virtual void setIsolines(unsigned short nIsolines)
virtual const OdCmColorBase & obscuredColor() 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)
virtual bool setTrait(Property prop, Operation op)=0
virtual bool traitFlag(Property flagProp, OdUInt32 flagVal) const
virtual bool setTraitFlag(Property flagProp, OdUInt32 flagVal, bool bEnable=true)
virtual OdGiVariantPtr trait(Property prop, Operation *pOp=NULL) const =0
const T * get() const
Definition: SmartPtr.h:339
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
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)