CFx SDK Documentation  2023 SP0
GsModel.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 
24 #ifndef __ODGSMODEL_H_INCLUDED_
25 #define __ODGSMODEL_H_INCLUDED_
26 
27 #include "Gs/Gs.h"
28 
29 class OdGiPathNode;
30 
31 #include "TD_PackPush.h"
32 
40 {
41 public:
43 
47  virtual OdGsModel* model() const = 0;
48 
52  virtual void setDrawableNull() = 0;
53 
62  virtual bool extents(OdGeExtents3d& extents) const = 0;
63 };
64 
65 typedef OdGiDrawablePtr (*OdGiOpenDrawableFn)(OdDbStub* id);
66 
67 class OdGsModelReactor;
68 
77 {
78 public:
80 
86  virtual void setOpenDrawableFn(OdGiOpenDrawableFn openDrawableFn) = 0;
87 
94  virtual void onAdded(OdGiDrawable* pAdded, OdGiDrawable* pParent) = 0;
95 
102  virtual void onAdded(OdGiDrawable* pAdded, OdDbStub* parentID) = 0;
103 
110  virtual void onModified(OdGiDrawable* pModified, OdGiDrawable* pParent) = 0;
111 
118  virtual void onModified(OdGiDrawable* pModified, OdDbStub* parentID) = 0;
119 
126  virtual void onErased(OdGiDrawable* pErased, OdGiDrawable* pParent) = 0;
127 
134  virtual void onErased(OdGiDrawable* pErased, OdDbStub* parentID) = 0;
135 
142  virtual void onUnerased(OdGiDrawable* pUnerased, OdGiDrawable* pParent);
143 
150  virtual void onUnerased(OdGiDrawable* pUnerased, OdDbStub* parentID);
151 
152  // Invalidation Hint
153 
159  {
160  kInvalidateIsolines = 0, // Invalidate isolines
161  kInvalidateViewportCache = 1, // Invalidate viewport cache
162  kInvalidateAll = 2, // Invalidate all caches
163  kInvalidateMaterials = 3, // Invalidate materials
164  kInvalidateLinetypes = 4 // Invalidate all linetype caches
165  };
166 
184  virtual void invalidate(InvalidationHint hint) = 0;
185 
191  virtual void invalidate(OdGsView* pView) = 0;
192 
198  virtual void invalidateVisible( OdGsDevice* pDevice ) = 0;
199 
205  virtual void setTransform(const OdGeMatrix3d&) = 0;
206 
210  virtual OdGeMatrix3d transform() const = 0;
211 
219  virtual void highlight(const OdGiPathNode& path, bool bDoIt = true, const OdGsView* pView = 0) = 0;
220 
225  {
226  kMinRenderType = -3, // Number of RenderType's in negative values range
227  kUserBg1 = -3, // User-defined background rendering type without Z-buffer
228  kUserBg2 = -2, // User-defined background rendering type with own Z-buffer
229  kUserBg3 = -1, // User-defined background rendering type with Z-buffer
230  kMain = 0, // Use main Z-buffer
231  kSprite, // Use alternate Z-buffer (for sprites)
232  kDirect, // Render on device directly
233  kHighlight, // Render on device directly (skipping frame buffer and Z-buffer)
234  kHighlightSelection, // Render on device directly using highlighting style (skipping frame buffer and Z-buffer)
235  kDirectTopmost, // Render on top of all other render types without Z-buffer
236  kContrast, // Render with contrast style
237  kCount, // Number of primary predefined RenderType's
238  kUserFg1 = kCount, // User-defined foreground rendering type with Z-buffer
239  kUserFg2, // User-defined foreground rendering type with own Z-buffer
240  kUserFg3, // Second user-defined foreground rendering type without Z-buffer
241  kMaxRenderType, // Number of RenderType's in positive values range
242  kNumRenderTypes = kMaxRenderType - kMinRenderType // Exact number of RenderType's including predefined and user-defined RenderType's
243  };
244 
250  virtual void setRenderType(RenderType renderType) = 0;
251 
255  virtual RenderType renderType() const = 0;
256 
257  //virtual bool addSceneGraphRoot(OdGiDrawable* pRoot) = 0;
258  //virtual bool eraseSceneGraphRoot(OdGiDrawable* pRoot) = 0;
259 
269 
276  virtual void setViewClippingOverride(bool bEnable) = 0;
277 
283  virtual void setBackground(OdDbStub *backgroundId) = 0;
284 
288  virtual OdDbStub *background() const = 0;
289 
301  virtual void setVisualStyle(OdDbStub *visualStyleId) = 0;
302 
306  virtual OdDbStub *visualStyle() const = 0;
307 
315  virtual void setVisualStyle(const OdGiVisualStyle &visualStyle) = 0;
316 
324  virtual bool visualStyle(OdGiVisualStyle &visualStyle) const = 0;
325 
331  virtual void addModelReactor(OdGsModelReactor *pReactor) = 0;
332 
338  virtual void removeModelReactor(OdGsModelReactor *pReactor) = 0;
339 
345  virtual void setEnableSectioning(bool bEnable) = 0;
346 
351  virtual bool isSectioningEnabled() const = 0;
352 
365  virtual bool setSectioning(const OdGePoint3dArray &points, const OdGeVector3d &upVector) = 0;
366 
386  virtual bool setSectioning(const OdGePoint3dArray &points, const OdGeVector3d &upVector,
387  double dTop, double dBottom) = 0;
388 
397  virtual void setSectioningVisualStyle(OdDbStub *visualStyleId) = 0;
398 
404  virtual void setEnableLinetypes(bool bEnable) = 0;
405 
409  virtual bool isLinetypesEnabled() const = 0;
410 
418  virtual void setSelectable(bool bEnable) = 0;
419 
425  virtual bool isSelectable() const = 0;
426 
432  virtual void setEnableLightsInBlocks(bool bEnable) = 0;
433 
437  virtual bool isLightsInBlocksEnabled() const = 0;
438 };
439 
447 {
448  public:
450  virtual ~OdGsModelReactor() { }
451 
452  //virtual bool onSceneGraphRootAdded(OdGsModel *pModel, OdGiDrawable *pAdded) { return true; }
453  //virtual bool onSceneGraphRootErased(OdGsModel *pModel, OdGiDrawable *pErased) { return true; }
454 
455  virtual bool onAdded(OdGsModel *pModel, OdGiDrawable *pAdded, OdGiDrawable *pParent) { return true; }
456  virtual bool onAdded(OdGsModel *pModel, OdGiDrawable *pAdded, OdDbStub *parentID) { return true; }
457 
458  virtual bool onErased(OdGsModel *pModel, OdGiDrawable *pErased, OdGiDrawable *pParent) { return true; }
459  virtual bool onErased(OdGsModel *pModel, OdGiDrawable *pErased, OdDbStub *parentID) { return true; }
460 
461  virtual bool onModified(OdGsModel *pModel, OdGiDrawable *pModified, OdGiDrawable *pParent) { return true; }
462  virtual bool onModified(OdGsModel *pModel, OdGiDrawable *pModified, OdDbStub *parentID) { return true; }
463 
464  virtual bool onUnerased(OdGsModel *pModel, OdGiDrawable *pUnerased, OdGiDrawable *pParent) { return onAdded(pModel, pUnerased, pParent); }
465  virtual bool onUnerased(OdGsModel *pModel, OdGiDrawable *pUnerased, OdDbStub *parentID) { return onAdded(pModel, pUnerased, parentID); }
466 };
467 
468 #include "TD_PackPop.h"
469 
470 #endif // __ODGSMODEL_H_INCLUDED_
OdSmartPtr< OdGiDrawable > OdGiDrawablePtr
Definition: GiCommonDraw.h:39
OdGiDrawablePtr(* OdGiOpenDrawableFn)(OdDbStub *id)
Definition: GsModel.h:65
#define ODRX_ABSTRACT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
ODRX_DECLARE_MEMBERS(OdGsCache)
virtual void setDrawableNull()=0
virtual bool extents(OdGeExtents3d &extents) const =0
virtual OdGsModel * model() const =0
virtual void removeModelReactor(OdGsModelReactor *pReactor)=0
virtual void onErased(OdGiDrawable *pErased, OdDbStub *parentID)=0
virtual bool isLightsInBlocksEnabled() const =0
virtual void addModelReactor(OdGsModelReactor *pReactor)=0
virtual void onUnerased(OdGiDrawable *pUnerased, OdGiDrawable *pParent)
virtual bool visualStyle(OdGiVisualStyle &visualStyle) const =0
virtual void setVisualStyle(OdDbStub *visualStyleId)=0
virtual OdGeMatrix3d transform() const =0
virtual void setVisualStyle(const OdGiVisualStyle &visualStyle)=0
virtual void invalidateVisible(OdGsDevice *pDevice)=0
virtual OdDbStub * background() const =0
virtual void onAdded(OdGiDrawable *pAdded, OdDbStub *parentID)=0
virtual void setRenderType(RenderType renderType)=0
virtual void setViewClippingOverride(bool bEnable)=0
virtual RenderType renderType() const =0
ODRX_DECLARE_MEMBERS(OdGsModel)
virtual void setBackground(OdDbStub *backgroundId)=0
@ kDirect
Definition: GsModel.h:232
@ kContrast
Definition: GsModel.h:236
@ kUserFg2
Definition: GsModel.h:239
@ kMaxRenderType
Definition: GsModel.h:241
@ kHighlightSelection
Definition: GsModel.h:234
@ kHighlight
Definition: GsModel.h:233
@ kSprite
Definition: GsModel.h:231
@ kUserFg3
Definition: GsModel.h:240
@ kCount
Definition: GsModel.h:237
@ kDirectTopmost
Definition: GsModel.h:235
virtual void highlight(const OdGiPathNode &path, bool bDoIt=true, const OdGsView *pView=0)=0
virtual void invalidate(OdGsView *pView)=0
virtual void invalidate(InvalidationHint hint)=0
virtual void onErased(OdGiDrawable *pErased, OdGiDrawable *pParent)=0
virtual void setTransform(const OdGeMatrix3d &)=0
virtual void setRenderModeOverride(OdGsView::RenderMode mode=OdGsView::kNone)=0
virtual void setSectioningVisualStyle(OdDbStub *visualStyleId)=0
virtual void onModified(OdGiDrawable *pModified, OdDbStub *parentID)=0
virtual void setSelectable(bool bEnable)=0
virtual bool isLinetypesEnabled() const =0
virtual bool setSectioning(const OdGePoint3dArray &points, const OdGeVector3d &upVector)=0
virtual void onAdded(OdGiDrawable *pAdded, OdGiDrawable *pParent)=0
virtual OdDbStub * visualStyle() const =0
virtual void onModified(OdGiDrawable *pModified, OdGiDrawable *pParent)=0
InvalidationHint
Definition: GsModel.h:159
virtual void onUnerased(OdGiDrawable *pUnerased, OdDbStub *parentID)
virtual bool isSelectable() const =0
virtual void setEnableLightsInBlocks(bool bEnable)=0
virtual bool setSectioning(const OdGePoint3dArray &points, const OdGeVector3d &upVector, double dTop, double dBottom)=0
virtual void setEnableLinetypes(bool bEnable)=0
virtual bool isSectioningEnabled() const =0
virtual void setOpenDrawableFn(OdGiOpenDrawableFn openDrawableFn)=0
virtual void setEnableSectioning(bool bEnable)=0
virtual bool onErased(OdGsModel *pModel, OdGiDrawable *pErased, OdDbStub *parentID)
Definition: GsModel.h:459
virtual ~OdGsModelReactor()
Definition: GsModel.h:450
virtual bool onAdded(OdGsModel *pModel, OdGiDrawable *pAdded, OdDbStub *parentID)
Definition: GsModel.h:456
virtual bool onAdded(OdGsModel *pModel, OdGiDrawable *pAdded, OdGiDrawable *pParent)
Definition: GsModel.h:455
virtual bool onErased(OdGsModel *pModel, OdGiDrawable *pErased, OdGiDrawable *pParent)
Definition: GsModel.h:458
virtual bool onModified(OdGsModel *pModel, OdGiDrawable *pModified, OdDbStub *parentID)
Definition: GsModel.h:462
virtual bool onUnerased(OdGsModel *pModel, OdGiDrawable *pUnerased, OdGiDrawable *pParent)
Definition: GsModel.h:464
virtual bool onUnerased(OdGsModel *pModel, OdGiDrawable *pUnerased, OdDbStub *parentID)
Definition: GsModel.h:465
virtual bool onModified(OdGsModel *pModel, OdGiDrawable *pModified, OdGiDrawable *pParent)
Definition: GsModel.h:461
Definition: Gs.h:133
RenderMode
Definition: Gs.h:138
@ kNone
Definition: Gs.h:147