CFx SDK Documentation  2023 SP0
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
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
unsigned char OdUInt8
OdSmartPtr< OdTrVectorizerPropertyResolver > OdTrVectorizerPropertyResolverPtr
OdSmartPtr< OdTrVectorizerModuleHost > OdTrVectorizerModuleHostPtr
OdSmartPtr< OdTrVisRendition > OdTrVisRenditionPtr
virtual OdSmartPtr< OdGsViewImpl > createVectorizeView()
virtual OdSmartPtr< OdGsBaseVectorizeDevice > createVectorizeDevice(OdTrVectorizerModuleHost *pModuleHost, OdTrVectorizerModuleHost::DeviceSetupType creationHint)
virtual OdTrVectorizerPropertyResolverPtr createPropertyResolver()
virtual void releasePropertyResolver()
virtual bool hasDirectRenderBuffer() const
void setRenderClient(OdTrVisRenderClient *pRenderClient, OdTrVectorizerPropertyResolver *pPropsResolver)
virtual void onRenderingEnd(OdGsDCRect *=NULL, OdTrVectorizerUpdateHost *=NULL)
virtual void configureForPlatform(OdTrVisRenderClient *, DeviceSetupType)
virtual void generateProperties(OdRxDictionary *) const
OdTrVisRenderClient * m_pRenderClient
virtual OdUInt8 * getDirectRenderBuffer(OdUInt32 *, OdUInt32 *, OdUInt32 *=NULL, OdUInt32 *=NULL)
virtual OdTrVisRenditionPtr createRendition()
virtual DeviceSetupType deviceSetupOverride() const
OdTrVectorizerPropertyResolverPtr m_pPropResolver
virtual bool onRenderingBegin(OdGsDCRect *=NULL, OdTrVectorizerUpdateHost *=NULL)
OdTrVisRenderClient * renderClient() const
virtual OdTrVectorizerModuleHost * hostByPropsDict(OdRxDictionary *pInfo) const =0
virtual void hostUpdate(OdGsDCRect *pRect)=0