CFx SDK Documentation  2023 SP0
TrVisMetafileDef.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 metafile definition
24 
25 #ifndef ODTRVISMETAFILEDEF
26 #define ODTRVISMETAFILEDEF
27 
28 #include "TD_PackPush.h"
29 
30 #include "UInt8Array.h"
31 #include "Ge/GeExtents3d.h"
32 #include "SharedPtr.h"
33 #include "TPtr.h"
34 
35 #include "TrVisDefs.h"
36 #include "TrVisMetafileStream.h"
37 
38 // Forward declaration
39 class OdTrRndSgExpand;
40 
45 
50 {
52  {
53  kMfVisible = (1 << 0), // Visibility flag (false for invisible metafiles).
54  kMfHighlighted = (1 << 1), // Highlighting flag (always false for nested metafiles).
55  kMfTemporary = (1 << 2), // True for transient drawables, false for persistent drawables.
56  kMfNested = (1 << 3), // Marks nested drawables (true for drawables inside blocks, false for top-level always).
57  kMfBlockRef = (1 << 4), // Marks block reference container metafile.
58  kMfUtilitary = (1 << 5), // Marks utilitary metafiles (TTF characters cache for example).
59  kMfSectionable = (1 << 6), // Marks sectionable metafiles.
60  kMfComposite = (1 << 7), // Marks composite metafiles (containing data for multipass rendering).
61  kMfXRef = (1 << 8), // Marks external reference metafiles.
62  kMfRefEditFade = (1 << 9) // Fade metafile flag (true if metafile faded onto vectorizer side).
63  };
64 
65  OdUInt16 m_mfFlags; // Metafile bit flags
66  OdUInt16 m_nRefs; // Reference counter
67  OdTrRndSgExpand *m_pSgData; // Runtime scene graph rendering data
68  OdDbStub *m_pOwnerId; // Metafile owner database Id
69  OdTrVisHlBranchId m_pHlBranch; // Highlight branch associated with metafile
70  OdTrVisLayerId m_pLayer; // Layer Id associated with metafile
71 
73 
74  // Reset metafile flags
75  void resetMetafileFlags(OdUInt16 mfFlags = 0) { m_mfFlags = mfFlags; }
76 
77  // Visiblity flag
78  bool isMetafileVisible() const { return GETBIT(m_mfFlags, kMfVisible); }
79  void setMetafileVisible(bool bSet) { SETBIT(m_mfFlags, kMfVisible, bSet); }
80 
81  // Highlighting flag
84 
85  // Temporary drawable flag
86  bool isTemporaryMetafile() const { return GETBIT(m_mfFlags, kMfTemporary); }
87  void setTemporaryMetafile(bool bSet) { SETBIT(m_mfFlags, kMfTemporary, bSet); }
88 
89  // Nested metafile flag
90  bool isNestedMetafile() const { return GETBIT(m_mfFlags, kMfNested); }
91  void setNestedMetafile(bool bSet) { SETBIT(m_mfFlags, kMfNested, bSet); }
92 
93  // Block reference flag
94  bool isBlockRefMetafile() const { return GETBIT(m_mfFlags, kMfBlockRef); }
95  void setBlockRefMetafile(bool bSet) { SETBIT(m_mfFlags, kMfBlockRef, bSet); }
96 
97  // Utilitary metafile flag
98  bool isUtilitaryMetafile() const { return GETBIT(m_mfFlags, kMfUtilitary); }
99  void setUtilitaryMetafile(bool bSet) { SETBIT(m_mfFlags, kMfUtilitary, bSet); }
100 
101  // Sectionable metafile flag
104 
105  // Composite metafile flag
107  void setCompositeMetafile(bool bSet) { SETBIT(m_mfFlags, kMfComposite, bSet); }
108 
109  // XRef metafile flag
110  bool isXRefMetafile() const { return GETBIT(m_mfFlags, kMfXRef); }
111  void setXRefMetafile(bool bSet) { SETBIT(m_mfFlags, kMfXRef, bSet); }
112 
113  // RefEditFade metafile flag
114  bool isMetafileFaded() const { return GETBIT(m_mfFlags, kMfRefEditFade); }
115  void setMetafileFaded(bool bSet) { SETBIT(m_mfFlags, kMfRefEditFade, bSet); }
116 
117  // Scene-Graph connection
118  bool hasSceneGraphExpand() const { return !!m_pSgData; }
119  void setSceneGraphExpand(OdTrRndSgExpand *pExpand) { m_pSgData = pExpand; }
121  OdTrRndSgExpand *sceneGraphExpand() const { return m_pSgData; }
122 
123  void setDefault()
124  {
126  m_pOwnerId = NULL;
127  m_pHlBranch = 0;
128  m_pLayer = 0;
129  }
130 };
131 
136 {
137  public:
138  static void addRef(OdTrVisMetafileContainer* pObj) { if (pObj) { pObj->m_nRefs++; } }
139  static void release(OdTrVisMetafileContainer* pObj) { if (pObj) { pObj->m_nRefs--; if (!pObj->m_nRefs) delete pObj; } }
140 };
141 
146 
151 {
152  // Metafile stream and related flags
154  // Metafile extents
156  // Generator viewport Id
158 
159  void setDefault()
160  {
161  m_pMetafile = NULL;
164  }
165 };
166 
167 #include "TD_PackPop.h"
168 
169 #endif // ODTRVISMETAFILEDEF
#define NULL
Definition: GsProperties.h:177
unsigned short OdUInt16
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:499
#define GETBIT(flags, bit)
Definition: OdaDefs.h:500
OdTrVisId OdTrVisViewportId
Definition: TrVisDefs.h:87
TPtr< OdTrVisMetafileContainer, OdTrVisMfContainerRelease > OdTrVisMetafileContainerPtr
OdSharedPtr< OdTrVisFlatMetafileContainer > OdTrVisFlatMetafileContainerPtr
static void addRef(OdTrVisMetafileContainer *pObj)
static void release(OdTrVisMetafileContainer *pObj)
void setUtilitaryMetafile(bool bSet)
void setSceneGraphExpand(OdTrRndSgExpand *pExpand)
void setNestedMetafile(bool bSet)
void setMetafileFaded(bool bSet)
void setMetafileVisible(bool bSet)
bool isMetafileHighlighted() const
OdTrVisHlBranchId m_pHlBranch
OdTrRndSgExpand * m_pSgData
void setCompositeMetafile(bool bSet)
void setMetafileHighlighted(bool bSet)
bool isUtilitaryMetafile() const
void resetMetafileFlags(OdUInt16 mfFlags=0)
void setBlockRefMetafile(bool bSet)
void setTemporaryMetafile(bool bSet)
bool isTemporaryMetafile() const
OdTrRndSgExpand * sceneGraphExpand() const
void setSectionableMetafile(bool bSet)
void setXRefMetafile(bool bSet)
bool isSectionableMetafile() const
OdGeExtents3d m_extents
OdTrVisMetafileContainerPtr m_pMetafile
OdTrVisViewportId m_generatorId