CFx SDK Documentation  2020SP3
TrVisLayerDef.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 // GLES2 device layer definition
24 
25 #ifndef ODTRVISLAYERDEF
26 #define ODTRVISLAYERDEF
27 
28 #include "TD_PackPush.h"
29 
30 #include "TrVisDefs.h"
31 #include "OdArray.h"
32 
37 {
38  // Flags
40  {
41  kPersistent = (1 << 0), // This layer cannot be deleted
42  kTemporary = (1 << 1), // Non-DBRO layer
43  kFrozen = (1 << 2), // Layer is frozen
44  kOff = (1 << 3), // Layer is disabled
45  kVisible = (1 << 4), // True if !kFrozen and !kOff
46  kPlottable = (1 << 5), // Layer can be printed
47  kLocked = (1 << 6) // Layer is locked
48  };
49  // Layer flags
51 
52  void resetFlags(OdUInt16 flags = 0) { m_flags = flags; }
54 
55  void setPersistent(bool bSet) { SETBIT(m_flags, kPersistent, bSet); }
56  bool isPersistent() const { return GETBIT(m_flags, kPersistent); }
57 
58  void setTemporary(bool bSet) { SETBIT(m_flags, kTemporary, bSet); }
59  bool isTemporary() const { return GETBIT(m_flags, kTemporary); }
60 
61  void setFrozen(bool bSet) { SETBIT(m_flags, kFrozen, bSet); updateVisibility(); }
62  bool isFrozen() const { return GETBIT(m_flags, kFrozen); }
63 
64  void setOff(bool bSet) { SETBIT(m_flags, kOff, bSet); updateVisibility(); }
65  bool isOff() const { return GETBIT(m_flags, kOff); }
66 
67  void setVisible(bool bSet) { SETBIT(m_flags, kVisible, bSet); }
68  bool isVisible() const { return GETBIT(m_flags, kVisible); }
69 
70  void setPlottable(bool bSet) { SETBIT(m_flags, kPlottable, bSet); }
71  bool isPlottable() const { return GETBIT(m_flags, kPlottable); }
72 
73  void setLocked(bool bSet) { SETBIT(m_flags, kLocked, bSet); }
74  bool isLocked() const { return GETBIT(m_flags, kLocked); }
75 
76  bool operator ==(const OdTrVisLayerProps &l2) const { return m_flags == l2.m_flags; }
77  bool operator !=(const OdTrVisLayerProps &l2) const { return m_flags != l2.m_flags; }
78 };
79 
84 {
85  // Layer name
87  // Linked DbId
88  OdDbStub *m_pOwner;
89  // Layer properties
91 
92  void setDefault()
93  {
94  m_name.empty();
95  m_pOwner = NULL;
97  }
98 
99  OdUInt32 diff(const OdTrVisLayerDef &l2) const
100  {
101  if (m_name != l2.m_name)
102  return 1;
103  if (m_props != l2.m_props)
104  return 1;
105  return 0;
106  }
107 
109  {
110  const bool bUpdateVisibility = (nFlag == OdTrVisLayerProps::kFrozen) || (nFlag == OdTrVisLayerProps::kOff);
111  SETBIT(m_props.m_flags, nFlag, bSet);
112  if (bUpdateVisibility)
114  }
120 };
121 
122 #include "TD_PackPop.h"
123 
124 #endif // ODTRVISLAYERDEF
GETBIT
#define GETBIT(flags, bit)
Definition: OdaDefs.h:498
OdTrVisLayerProps::setPlottable
void setPlottable(bool bSet)
Definition: TrVisLayerDef.h:70
OdString
Definition: OdString.h:95
NULL
#define NULL
Definition: GsProperties.h:177
OdTrVisLayerDef::m_pOwner
OdDbStub * m_pOwner
Definition: TrVisLayerDef.h:88
OdTrVisLayerDef
Definition: TrVisLayerDef.h:84
OdTrVisLayerProps::kLocked
@ kLocked
Definition: TrVisLayerDef.h:47
OdTrVisLayerDef::m_props
OdTrVisLayerProps m_props
Definition: TrVisLayerDef.h:90
OdTrVisLayerProps::isTemporary
bool isTemporary() const
Definition: TrVisLayerDef.h:59
OdTrVisLayerDef::propSetVisible
void propSetVisible(bool bSet)
Definition: TrVisLayerDef.h:117
OdTrVisLayerProps::isLocked
bool isLocked() const
Definition: TrVisLayerDef.h:74
OdTrVisLayerProps::isVisible
bool isVisible() const
Definition: TrVisLayerDef.h:68
OdTrVisLayerDef::propSetLocked
void propSetLocked(bool bSet)
Definition: TrVisLayerDef.h:119
SETBIT
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:497
OdTrVisLayerProps::kTemporary
@ kTemporary
Definition: TrVisLayerDef.h:42
OdTrVisLayerProps::setFrozen
void setFrozen(bool bSet)
Definition: TrVisLayerDef.h:61
OdTrVisLayerProps::m_flags
OdUInt16 m_flags
Definition: TrVisLayerDef.h:50
TD_PackPop.h
OdTrVisLayerProps::setLocked
void setLocked(bool bSet)
Definition: TrVisLayerDef.h:73
OdTrVisLayerProps::setTemporary
void setTemporary(bool bSet)
Definition: TrVisLayerDef.h:58
OdUInt16
unsigned short OdUInt16
Definition: OdPlatformSettings.h:760
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdTrVisLayerProps::kVisible
@ kVisible
Definition: TrVisLayerDef.h:45
OdTrVisLayerProps::isPersistent
bool isPersistent() const
Definition: TrVisLayerDef.h:56
OdArray.h
OdTrVisLayerProps::kPlottable
@ kPlottable
Definition: TrVisLayerDef.h:46
OdTrVisLayerProps::isFrozen
bool isFrozen() const
Definition: TrVisLayerDef.h:62
TrVisDefs.h
OdTrVisLayerDef::diff
OdUInt32 diff(const OdTrVisLayerDef &l2) const
Definition: TrVisLayerDef.h:99
OdTrVisLayerProps::setOff
void setOff(bool bSet)
Definition: TrVisLayerDef.h:64
OdTrVisLayerProps::operator!=
bool operator!=(const OdTrVisLayerProps &l2) const
Definition: TrVisLayerDef.h:77
OdTrVisLayerProps::resetFlags
void resetFlags(OdUInt16 flags=0)
Definition: TrVisLayerDef.h:52
OdTrVisLayerDef::propagateFlag
void propagateFlag(OdTrVisLayerProps::LayerPropsFlags nFlag, bool bSet)
Definition: TrVisLayerDef.h:108
OdTrVisLayerProps::kPersistent
@ kPersistent
Definition: TrVisLayerDef.h:41
OdTrVisLayerProps::isPlottable
bool isPlottable() const
Definition: TrVisLayerDef.h:71
TD_PackPush.h
OdTrVisLayerProps
Definition: TrVisLayerDef.h:37
OdTrVisLayerDef::m_name
OdString m_name
Definition: TrVisLayerDef.h:86
OdTrVisLayerProps::LayerPropsFlags
LayerPropsFlags
Definition: TrVisLayerDef.h:40
OdTrVisLayerProps::isOff
bool isOff() const
Definition: TrVisLayerDef.h:65
OdTrVisLayerProps::setPersistent
void setPersistent(bool bSet)
Definition: TrVisLayerDef.h:55
OdString::empty
void empty()
OdTrVisLayerDef::propSetOff
void propSetOff(bool bSet)
Definition: TrVisLayerDef.h:116
OdTrVisLayerDef::setDefault
void setDefault()
Definition: TrVisLayerDef.h:92
OdTrVisLayerDef::propSetPlottable
void propSetPlottable(bool bSet)
Definition: TrVisLayerDef.h:118
OdTrVisLayerProps::operator==
bool operator==(const OdTrVisLayerProps &l2) const
Definition: TrVisLayerDef.h:76
OdTrVisLayerDef::propSetFrozen
void propSetFrozen(bool bSet)
Definition: TrVisLayerDef.h:115
OdTrVisLayerProps::updateVisibility
void updateVisibility()
Definition: TrVisLayerDef.h:53
OdTrVisLayerProps::kFrozen
@ kFrozen
Definition: TrVisLayerDef.h:43
OdTrVisLayerProps::kOff
@ kOff
Definition: TrVisLayerDef.h:44
OdTrVisLayerProps::setVisible
void setVisible(bool bSet)
Definition: TrVisLayerDef.h:67