CFx SDK Documentation  2023 SP0
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
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
unsigned short OdUInt16
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:499
#define GETBIT(flags, bit)
Definition: OdaDefs.h:500
void empty()
void propSetFrozen(bool bSet)
void propSetOff(bool bSet)
void propSetLocked(bool bSet)
OdTrVisLayerProps m_props
Definition: TrVisLayerDef.h:90
OdUInt32 diff(const OdTrVisLayerDef &l2) const
Definition: TrVisLayerDef.h:99
void propagateFlag(OdTrVisLayerProps::LayerPropsFlags nFlag, bool bSet)
void propSetPlottable(bool bSet)
OdDbStub * m_pOwner
Definition: TrVisLayerDef.h:88
void propSetVisible(bool bSet)
void setLocked(bool bSet)
Definition: TrVisLayerDef.h:73
void resetFlags(OdUInt16 flags=0)
Definition: TrVisLayerDef.h:52
bool isOff() const
Definition: TrVisLayerDef.h:65
void setFrozen(bool bSet)
Definition: TrVisLayerDef.h:61
void setPlottable(bool bSet)
Definition: TrVisLayerDef.h:70
void setPersistent(bool bSet)
Definition: TrVisLayerDef.h:55
bool isPersistent() const
Definition: TrVisLayerDef.h:56
void setTemporary(bool bSet)
Definition: TrVisLayerDef.h:58
bool operator==(const OdTrVisLayerProps &l2) const
Definition: TrVisLayerDef.h:76
bool isTemporary() const
Definition: TrVisLayerDef.h:59
bool isPlottable() const
Definition: TrVisLayerDef.h:71
bool isFrozen() const
Definition: TrVisLayerDef.h:62
bool isVisible() const
Definition: TrVisLayerDef.h:68
bool isLocked() const
Definition: TrVisLayerDef.h:74
void setOff(bool bSet)
Definition: TrVisLayerDef.h:64
bool operator!=(const OdTrVisLayerProps &l2) const
Definition: TrVisLayerDef.h:77
void setVisible(bool bSet)
Definition: TrVisLayerDef.h:67