CFx SDK Documentation  2023 SP0
TrVisDisplayCodeProc.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 special display codes processing helpers
24 
25 #ifndef ODTRVISDISPLAYCODEPROC
26 #define ODTRVISDISPLAYCODEPROC
27 
28 #include "TD_PackPush.h"
29 
30 #include "TrVisRendition.h"
31 
36 {
37  public:
38  template <typename TArray>
39  static void pushZero(TArray &arry)
40  {
41  arry.push_back(OdTrVisRendition::kDisplayCodeZero);
42  }
43  template <typename TArray>
44  static void pushHighlight(TArray &arry)
45  {
47  }
48  template <typename TArray>
49  static void pushUnhighlight(TArray &arry)
50  {
52  }
53  template <typename TArray>
54  static void pushHighlight(TArray &arry, bool bHighlight)
55  {
57  }
58  template <typename TArray>
59  static void pushPushMatrix(TArray &arry, const OdGeMatrix3d &mtx)
60  {
61  typedef OD_TYPENAME TArray::value_type ValType;
63  const ValType *pMtxRepresentation = reinterpret_cast<const ValType*>(mtx.entry);
64  arry.insert(arry.end(), pMtxRepresentation, pMtxRepresentation + (sizeof(OdGeMatrix3d) / sizeof(ValType)));
65  }
66  template <typename TArray>
67  static void pushPopMatrix(TArray &arry)
68  {
70  }
71  template <typename TArray>
72  static void pushSelMarkers(TArray &arry, const void *pHlBranch)
73  {
74  typedef OD_TYPENAME TArray::value_type ValType;
76  arry.push_back((ValType)(OdIntPtr)pHlBranch);
77  }
78 };
79 
84 {
85  public:
86  template <typename TObj>
87  static bool isEqual(const TObj &obj1, const TObj &obj2)
88  {
89  return !::memcmp(&obj1, &obj2, sizeof(TObj));
90  }
91  static bool isIdentity(const OdGeMatrix3d &mtx)
92  {
93  return isEqual(mtx, OdGeMatrix3d::kIdentity);
94  }
95 };
96 
101 {
102  OdTrVisDisplayId *m_pList;
103  OdUInt32 m_nListData, m_nCaret;
104  public:
106  : m_pList(const_cast<OdTrVisDisplayId*>(pList)), m_nListData(nData), m_nCaret(0)
107  {
108  }
109  bool isEOF() const { return m_nCaret >= m_nListData; }
110  bool isCode() const { return m_pList[m_nCaret] < OdTrVisRendition::kDisplayCodeRange; }
112  void skipCode() {
113  OdUInt32 nSteps = 1;
114  switch (code()) { case OdTrVisRendition::kDisplayCodePushMatrix: nSteps += sizeof(OdGeMatrix3d) / sizeof(double); break;
115  case OdTrVisRendition::kDisplayCodeSelMarkers: nSteps += 1; break; default: break; }
116  m_nCaret += nSteps;
117  }
118  OdTrVisDisplayId &cur() { return m_pList[m_nCaret]; }
119  const OdTrVisDisplayId &cur() const { return m_pList[m_nCaret]; }
120  OdTrVisDisplayId &next(OdUInt32 n = 1) { return m_pList[m_nCaret + n]; }
121  const OdTrVisDisplayId &next(OdUInt32 n = 1) const { return m_pList[m_nCaret + n]; }
122  bool step() { if (isCode()) skipCode(); else m_nCaret++; return isEOF(); }
123 };
124 
125 #include "TD_PackPop.h"
126 
127 #endif // ODTRVISDISPLAYCODEPROC
#define OD_TYPENAME
Definition: OdPlatform.h:581
unsigned int OdUInt32
ptrdiff_t OdIntPtr
static GE_STATIC_EXPORT const OdGeMatrix3d kIdentity
Definition: GeMatrix3d.h:79
double entry[4][4]
Definition: GeMatrix3d.h:675
static void pushHighlight(TArray &arry, bool bHighlight)
static void pushSelMarkers(TArray &arry, const void *pHlBranch)
static void pushPopMatrix(TArray &arry)
static void pushPushMatrix(TArray &arry, const OdGeMatrix3d &mtx)
static void pushUnhighlight(TArray &arry)
static void pushHighlight(TArray &arry)
static void pushZero(TArray &arry)
OdTrVisDisplayId & next(OdUInt32 n=1)
const OdTrVisDisplayId & next(OdUInt32 n=1) const
const OdTrVisDisplayId & cur() const
OdTrVisRendition::DisplayIdCodes code() const
OdTrVisDisplayListIterator(const OdTrVisDisplayId *pList, OdUInt32 nData)
static bool isIdentity(const OdGeMatrix3d &mtx)
static bool isEqual(const TObj &obj1, const TObj &obj2)