CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
TrVisPropertyDef.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// Rendition interface property definition.
24
25#ifndef ODTRVISPROPERTYDEF
26#define ODTRVISPROPERTYDEF
27
28#include "TD_PackPush.h"
29
30#include "TrVisDefs.h"
31#include "Ge/GeMatrix3d.h"
32
33// Main property interface
34
39{
56 {
57 kBooleanProperty = 0, // Boolean
58 kIdProperty, // 64bit numeric
59 kStringProperty, // String
60 kMatrixProperty, // 4x4 doubles
61 // Number of underlying data types
63 };
66 {
67 switch (m_propType)
68 {
69 case kOwningProperty: return kIdProperty;
71 case kLayerProperty: return kIdProperty;
72 case kHlBranchProperty: return kIdProperty;
73 case kVsBranchProperty: return kIdProperty;
74 case kTfBranchProperty: return kIdProperty;
76 case kSelStyleProperty: return kIdProperty;
77 case kNameProperty: return kStringProperty;
79 default: return kNumDataTypes;
80 }
81 }
82 void *operator new(size_t size) { return ::odrxAlloc(size); }
83 void operator delete(void *p);
84 protected:
86 : m_propType(propType) {}
87};
88
89// Property data types
90
95{
97 bool propertyValue() const { return m_boolVal; }
98 protected:
100 : OdTrVisPropertyDef(propType), m_boolVal(bVal) {}
101};
102
107{
109 OdTrVisId propertyValue() const { return m_idVal; }
110 protected:
112 : OdTrVisPropertyDef(propType), m_idVal(idVal) {}
113};
114
119{
121 const OdString &propertyValue() const { return m_charVal; }
122 protected:
124 : OdTrVisPropertyDef(propType), m_charVal(charVal) {}
125};
126
131{
133 const OdGeMatrix3d &propertyValue() const { return m_mtxVal; }
134 protected:
136 : OdTrVisPropertyDef(propType), m_mtxVal(mtxVal) {}
137};
138
139// Final property interfaces
140
150
159
169
189
199
209
218
227
228// OdTrVisPropertyDef destructor
229inline void OdTrVisPropertyDef::operator delete(void *p)
230{
231 switch (reinterpret_cast<OdTrVisPropertyDef*>(p)->underlyingDataType())
232 {
233 case kBooleanProperty: reinterpret_cast<OdTrVisBooleanPropertyDef*>(p)->~OdTrVisBooleanPropertyDef(); break;
234 case kIdProperty: reinterpret_cast<OdTrVisIdPropertyDef*>(p)->~OdTrVisIdPropertyDef(); break;
235 case kStringProperty: reinterpret_cast<OdTrVisStringPropertyDef*>(p)->~OdTrVisStringPropertyDef(); break;
236 case kMatrixProperty: reinterpret_cast<OdTrVisMatrixPropertyDef*>(p)->~OdTrVisMatrixPropertyDef(); break;
237 }
238 ::odrxFree(p);
239}
240
244template <typename BasicType>
246{
247 protected:
248 BasicType m_value;
250 public:
251 OdTrVisPropertyChangedMonitor(const BasicType &initialState)
252 : m_value(initialState), m_bChanged(false) { }
253 void resetValue(const BasicType &newValue, bool bSetChanged = true)
254 {
255 if (bSetChanged)
256 {
257 if (m_value != newValue)
258 {
259 m_value = newValue;
260 m_bChanged = true;
261 }
262 else
263 m_bChanged = false;
264 }
265 else
266 {
267 m_value = newValue;
268 m_bChanged = false;
269 }
270 }
271 bool isChanged() const { return m_bChanged; }
272 void setNoChange() { m_bChanged = false; }
273 const BasicType &value() const { return m_value; }
274};
275
276#include "TD_PackPop.h"
277
278#endif // ODTRVISPROPERTYDEF
false
Definition DimVarDefs.h:165
ALLOCDLL_EXPORT void odrxFree(void *pMemBlock)
unsigned int OdUInt32
OdTrVisId OdTrVisVisualStyleId
Definition TrVisDefs.h:120
OdTrVisStateBranchType
Definition TrVisDefs.h:162
@ kTrVisHighlightingBranch
Definition TrVisDefs.h:163
OdTrVisId OdTrVisLayerId
Definition TrVisDefs.h:122
OdTrVisId OdTrVisStateBranchId
Definition TrVisDefs.h:118
OdUInt64 OdTrVisOwning
Definition TrVisDefs.h:97
OdUInt64 OdTrVisId
Definition TrVisDefs.h:101
void resetValue(const BasicType &newValue, bool bSetChanged=true)
OdTrVisPropertyChangedMonitor(const BasicType &initialState)
const BasicType & value() const
GLsizeiptr size
Definition gles2_ext.h:182
OdTrVisBooleanPropertyDef(PropertyType propType, bool bVal)
OdTrVisId propertyValue() const
OdTrVisIdPropertyDef(PropertyType propType, OdTrVisId idVal)
OdTrVisLayerId propertyValue() const
OdTrVisLayerPropertyDef(OdTrVisLayerId layerId)
const OdGeMatrix3d & propertyValue() const
OdTrVisMatrixPropertyDef(PropertyType propType, const OdGeMatrix3d &mtxVal)
OdTrVisNamePropertyDef(const OdString &nameProp)
OdTrVisOwningPropertyDef(OdTrVisOwning owningPropVal)
OdTrVisOwning propertyValue() const
UnderlyingDataType underlyingDataType() const
PropertyType propertyType() const
enum OdTrVisPropertyDef::PropertyType m_propType
OdTrVisPropertyDef(PropertyType propType)
OdTrVisSelStylePropertyDef(OdUInt32 selStyleIndex)
OdTrVisStateBranchId propertyValue() const
static PropertyType branchTypeToPropertyType(OdTrVisStateBranchType branchType)
static OdTrVisStateBranchType propertyTypeToBranchType(PropertyType propType)
OdTrVisStateBranchPropertyDef(OdTrVisStateBranchId branchId, OdTrVisStateBranchType branchType=kTrVisHighlightingBranch)
const OdString & propertyValue() const
OdTrVisStringPropertyDef(PropertyType propType, const OdString &charVal)
OdTrVisSysDefaultPropertyDef(bool bSystemDefault=true)
OdTrVisVisualStylePropertyDef(OdTrVisVisualStyleId visualStyleId)
OdTrVisVisualStyleId propertyValue() const
OdTrVisXformPropertyDef(const OdGeMatrix3d &xformMatrix)