CFx SDK Documentation  2020SP3
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
OdTrVisRendition::DisplayIdCodes
DisplayIdCodes
Definition: TrVisRendition.h:114
OdTrVisDisplayCodeKeeper::pushSelMarkers
static void pushSelMarkers(TArray &arry, const void *pHlBranch)
Definition: TrVisDisplayCodeProc.h:72
OdTrVisRendition::kDisplayCodeUnhighlight
@ kDisplayCodeUnhighlight
Definition: TrVisRendition.h:117
OdTrVisRendition::kDisplayCodePushMatrix
@ kDisplayCodePushMatrix
Definition: TrVisRendition.h:118
OdTrVisDisplayListIterator
Definition: TrVisDisplayCodeProc.h:101
OdTrVisDisplayCodeKeeper::pushPushMatrix
static void pushPushMatrix(TArray &arry, const OdGeMatrix3d &mtx)
Definition: TrVisDisplayCodeProc.h:59
OdTrVisDisplayCodeKeeper::pushHighlight
static void pushHighlight(TArray &arry)
Definition: TrVisDisplayCodeProc.h:44
OdTrVisDisplayListIterator::isCode
bool isCode() const
Definition: TrVisDisplayCodeProc.h:110
TD_PackPop.h
OdTrVisFastComparator::isIdentity
static bool isIdentity(const OdGeMatrix3d &mtx)
Definition: TrVisDisplayCodeProc.h:91
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdGeMatrix3d
Definition: GeMatrix3d.h:73
OdTrVisDisplayListIterator::skipCode
void skipCode()
Definition: TrVisDisplayCodeProc.h:112
OD_TYPENAME
#define OD_TYPENAME
Definition: OdPlatform.h:581
OdTrVisDisplayListIterator::step
bool step()
Definition: TrVisDisplayCodeProc.h:122
OdTrVisDisplayListIterator::code
OdTrVisRendition::DisplayIdCodes code() const
Definition: TrVisDisplayCodeProc.h:111
OdTrVisDisplayCodeKeeper
Definition: TrVisDisplayCodeProc.h:36
OdTrVisFastComparator
Definition: TrVisDisplayCodeProc.h:84
TrVisRendition.h
OdTrVisRendition::kDisplayCodeSelMarkers
@ kDisplayCodeSelMarkers
Definition: TrVisRendition.h:120
OdTrVisRendition::kDisplayCodeZero
@ kDisplayCodeZero
Definition: TrVisRendition.h:115
OdTrVisRendition::kDisplayCodeHighlight
@ kDisplayCodeHighlight
Definition: TrVisRendition.h:116
OdTrVisDisplayListIterator::cur
const OdTrVisDisplayId & cur() const
Definition: TrVisDisplayCodeProc.h:119
TD_PackPush.h
OdTrVisRendition::kDisplayCodeRange
@ kDisplayCodeRange
Definition: TrVisRendition.h:122
OdTrVisDisplayCodeKeeper::pushHighlight
static void pushHighlight(TArray &arry, bool bHighlight)
Definition: TrVisDisplayCodeProc.h:54
OdTrVisDisplayListIterator::OdTrVisDisplayListIterator
OdTrVisDisplayListIterator(const OdTrVisDisplayId *pList, OdUInt32 nData)
Definition: TrVisDisplayCodeProc.h:105
OdIntPtr
ptrdiff_t OdIntPtr
Definition: OdPlatformSettings.h:884
OdTrVisDisplayCodeKeeper::pushZero
static void pushZero(TArray &arry)
Definition: TrVisDisplayCodeProc.h:39
OdTrVisRendition::kDisplayCodePopMatrix
@ kDisplayCodePopMatrix
Definition: TrVisRendition.h:119
OdTrVisDisplayCodeKeeper::pushPopMatrix
static void pushPopMatrix(TArray &arry)
Definition: TrVisDisplayCodeProc.h:67
OdTrVisDisplayListIterator::cur
OdTrVisDisplayId & cur()
Definition: TrVisDisplayCodeProc.h:118
OdGeMatrix3d::entry
double entry[4][4]
Definition: GeMatrix3d.h:675
OdTrVisDisplayListIterator::isEOF
bool isEOF() const
Definition: TrVisDisplayCodeProc.h:109
OdTrVisDisplayCodeKeeper::pushUnhighlight
static void pushUnhighlight(TArray &arry)
Definition: TrVisDisplayCodeProc.h:49
OdTrVisFastComparator::isEqual
static bool isEqual(const TObj &obj1, const TObj &obj2)
Definition: TrVisDisplayCodeProc.h:87
OdTrVisDisplayListIterator::next
OdTrVisDisplayId & next(OdUInt32 n=1)
Definition: TrVisDisplayCodeProc.h:120
OdGeMatrix3d::kIdentity
static GE_STATIC_EXPORT const OdGeMatrix3d kIdentity
Definition: GeMatrix3d.h:79
OdTrVisDisplayListIterator::next
const OdTrVisDisplayId & next(OdUInt32 n=1) const
Definition: TrVisDisplayCodeProc.h:121
OdUInt64
Definition: Int64.h:137