CFx SDK Documentation  2020SP3
TrVecBaseModule.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 // TrVec module
24 
25 #ifndef ODBASETRVECMODULE
26 #define ODBASETRVECMODULE
27 
28 #include "TD_PackPush.h"
29 
30 #include "Gs/GsBaseModule.h"
31 #include "../TrVisRenderClient.h"
32 
33 // Forward declaration
35 
40 {
42 };
43 
48 
53 {
54  virtual void hostUpdate(OdGsDCRect* pRect) = 0;
55 };
56 
62 {
63  protected:
66  public:
68  {
72  };
73  public:
75 
77  { m_pRenderClient = pRenderClient; m_pPropResolver = pPropsResolver; }
79 
81 
82  virtual void generateProperties(OdRxDictionary* /*pInfo*/) const {}
83 
84  virtual void configureForPlatform(OdTrVisRenderClient * /*pRenderClient*/, DeviceSetupType /*devType*/) {}
85 
86  virtual DeviceSetupType deviceSetupOverride() const { return kDtDefault; }
87 
88  virtual bool onRenderingBegin(OdGsDCRect* /*pUpdatedRect*/ = NULL, OdTrVectorizerUpdateHost* /*pUpdateHost*/ = NULL) { return true; }
89  virtual void onRenderingEnd(OdGsDCRect* /*pUpdatedRect*/ = NULL, OdTrVectorizerUpdateHost* /*pUpdateHost*/ = NULL) {}
90 
91  virtual bool hasDirectRenderBuffer() const { return false; }
92  virtual OdUInt8 *getDirectRenderBuffer(OdUInt32* /*pWidth*/, OdUInt32* /*pHeight*/, OdUInt32* /*pFormat*/ = NULL, OdUInt32* /*pAlignment*/ = NULL) { return NULL; }
93 };
94 
99 
100 #define ODRX_DECLARE_PROPERTY_TRV(PropName) \
101  struct _##PropName##_PropDesc : public OdRxObjectImpl<OdRxPropDesc> \
102  { \
103  OdTrVectorizerPropertyResolverPtr m_pResolver; \
104  static OdRxObjectPtr createObject(const OdTrVectorizerPropertyResolver *pResolver); \
105  static inline OdString _name(); \
106  OdString name() const; \
107  OdRxObjectPtr prop_get(const void* pThis) const; \
108  void prop_put(void* pThis, OdRxObject* pVal); \
109  };
110 
111 #define ODRX_GENERATE_PROPERTY_TRV(PropName) \
112  pInfo->putAt(_##PropName##_PropDesc::_name(), _##PropName##_PropDesc::createObject(m_pPropResolver));
113 
114 #define ODRX_INHERIT_PROPERTIES_TRV(BASE_CLASS) \
115  BASE_CLASS::generateProperties(pInfo);
116 
117 #define ODRX_DEFINE_PROPERTY_METHODS_PREFIX_TRV(ClassPrefix, PropName, PropHolder, getMethodName, putMethodName, accessFn) \
118  OdRxObjectPtr ClassPrefix _##PropName##_PropDesc::createObject(const OdTrVectorizerPropertyResolver *pResolver) \
119  { \
120  OdRxObjectPtr pThis = OdRxObjectPtr(new _##PropName##_PropDesc, kOdRxObjAttach); \
121  static_cast<_##PropName##_PropDesc*>(pThis.get())->m_pResolver = pResolver; \
122  return pThis; \
123  } \
124  inline OdString ClassPrefix _##PropName##_PropDesc::_name() \
125  { \
126  static OdString sName(OD_T(#PropName)); \
127  return sName; \
128  } \
129  OdString ClassPrefix _##PropName##_PropDesc::name() const \
130  { \
131  return _name(); \
132  } \
133  OdRxObjectPtr ClassPrefix _##PropName##_PropDesc::prop_get(const void* pThis) const \
134  { \
135  return (OdRxObject*)OdRxVariantValue((static_cast<PropHolder*>(m_pResolver->hostByPropsDict((OdRxDictionary*)pThis)))->getMethodName()); \
136  } \
137  void ClassPrefix _##PropName##_PropDesc::prop_put(void* pThis, OdRxObject* pVal) \
138  { \
139  (static_cast<PropHolder*>(m_pResolver->hostByPropsDict((OdRxDictionary*)pThis)))->putMethodName(OdRxVariantValue(pVal)->accessFn()); \
140  }
141 
142 #define ODRX_DEFINE_PROPERTY_PREFIX_TRV(ClassPrefix, PropName, PropHolder, accessFn) \
143  ODRX_DEFINE_PROPERTY_METHODS_PREFIX_TRV(ClassPrefix, PropName, PropHolder, get_##PropName, put_##PropName, accessFn)
144 
149 {
150  OdTrVectorizerPropertyResolverPtr m_pPropResolver;
151  protected:
152  void initApp();
153  void uninitApp();
154 
157 
159  virtual void releasePropertyResolver();
160 };
161 
162 #include "TD_PackPop.h"
163 
164 #endif // ODBASETRVECMODULE
OdTrVectorizerPropertyResolver::hostByPropsDict
virtual OdTrVectorizerModuleHost * hostByPropsDict(OdRxDictionary *pInfo) const =0
NULL
#define NULL
Definition: GsProperties.h:177
OdTrVectorizerModuleHostPtr
OdSmartPtr< OdTrVectorizerModuleHost > OdTrVectorizerModuleHostPtr
Definition: TrVecBaseModule.h:98
OdUInt8
unsigned char OdUInt8
Definition: OdPlatformSettings.h:759
GsBaseModule.h
OdTrVectorizerModuleHost::createRendition
virtual OdTrVisRenditionPtr createRendition()
Definition: TrVecBaseModule.h:80
OdTrVectorizerModuleHost::configureForPlatform
virtual void configureForPlatform(OdTrVisRenderClient *, DeviceSetupType)
Definition: TrVecBaseModule.h:84
OdTrVectorizerPropertyResolver
Definition: TrVecBaseModule.h:40
OdTrVectorizerModuleHost::m_pPropResolver
OdTrVectorizerPropertyResolverPtr m_pPropResolver
Definition: TrVecBaseModule.h:65
OdTrVectorizerModuleHost::renderClient
OdTrVisRenderClient * renderClient() const
Definition: TrVecBaseModule.h:78
OdRxObject
Definition: RxObject.h:564
OdGsDCRect
Definition: GsDefs.h:111
TD_PackPop.h
OdTrVectorizerModuleHost::OdTrVectorizerModuleHost
OdTrVectorizerModuleHost()
Definition: TrVecBaseModule.h:74
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
OdTrVectorizerModuleHost
Definition: TrVecBaseModule.h:62
OdTrVectorizerModuleHost::setRenderClient
void setRenderClient(OdTrVisRenderClient *pRenderClient, OdTrVectorizerPropertyResolver *pPropsResolver)
Definition: TrVecBaseModule.h:76
OdTrVectorizerModuleHost::onRenderingBegin
virtual bool onRenderingBegin(OdGsDCRect *=NULL, OdTrVectorizerUpdateHost *=NULL)
Definition: TrVecBaseModule.h:88
OdTrVectorizerUpdateHost::hostUpdate
virtual void hostUpdate(OdGsDCRect *pRect)=0
BaseGLES2Module::releasePropertyResolver
virtual void releasePropertyResolver()
OdSmartPtr< OdTrVectorizerPropertyResolver >
BaseGLES2Module::uninitApp
void uninitApp()
OdTrVectorizerModuleHost::kDtOnScreen
@ kDtOnScreen
Definition: TrVecBaseModule.h:70
BaseGLES2Module::createVectorizeView
virtual OdSmartPtr< OdGsViewImpl > createVectorizeView()
OdTrVectorizerModuleHost::DeviceSetupType
DeviceSetupType
Definition: TrVecBaseModule.h:68
OdTrVectorizerUpdateHost
Definition: TrVecBaseModule.h:53
OdTrVectorizerModuleHost::generateProperties
virtual void generateProperties(OdRxDictionary *) const
Definition: TrVecBaseModule.h:82
OdRxDictionary
Definition: RxDictionary.h:114
TD_PackPush.h
OdTrVisRenderClient
Definition: TrVisRenderClient.h:40
BaseGLES2Module::createVectorizeDevice
virtual OdSmartPtr< OdGsBaseVectorizeDevice > createVectorizeDevice(OdTrVectorizerModuleHost *pModuleHost, OdTrVectorizerModuleHost::DeviceSetupType creationHint)
OdTrVectorizerPropertyResolverPtr
OdSmartPtr< OdTrVectorizerPropertyResolver > OdTrVectorizerPropertyResolverPtr
Definition: TrVecBaseModule.h:47
OdTrVectorizerModuleHost::getDirectRenderBuffer
virtual OdUInt8 * getDirectRenderBuffer(OdUInt32 *, OdUInt32 *, OdUInt32 *=NULL, OdUInt32 *=NULL)
Definition: TrVecBaseModule.h:92
OdTrVectorizerModuleHost::onRenderingEnd
virtual void onRenderingEnd(OdGsDCRect *=NULL, OdTrVectorizerUpdateHost *=NULL)
Definition: TrVecBaseModule.h:89
BaseGLES2Module
Definition: TrVecBaseModule.h:149
OdTrVectorizerModuleHost::hasDirectRenderBuffer
virtual bool hasDirectRenderBuffer() const
Definition: TrVecBaseModule.h:91
OdGsBaseModule
Definition: GsBaseModule.h:41
BaseGLES2Module::initApp
void initApp()
OdTrVectorizerModuleHost::m_pRenderClient
OdTrVisRenderClient * m_pRenderClient
Definition: TrVecBaseModule.h:64
BaseGLES2Module::createPropertyResolver
virtual OdTrVectorizerPropertyResolverPtr createPropertyResolver()
OdTrVisRenditionPtr
OdSmartPtr< OdTrVisRendition > OdTrVisRenditionPtr
Definition: TrVisRendition.h:434
OdTrVectorizerModuleHost::deviceSetupOverride
virtual DeviceSetupType deviceSetupOverride() const
Definition: TrVecBaseModule.h:86
OdTrVectorizerModuleHost::kDtOffScreen
@ kDtOffScreen
Definition: TrVecBaseModule.h:71
OdTrVectorizerModuleHost::kDtDefault
@ kDtDefault
Definition: TrVecBaseModule.h:69