CFx SDK Documentation  2023 SP0
GsBaseVectorizeView.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 ODGSBASEVECTORIZEVIEW_INC
25 #define ODGSBASEVECTORIZEVIEW_INC
26 
27 #include "TD_PackPush.h"
28 
29 #include <stdlib.h>
30 #include <utility>
31 
32 #include "Gs/GsViewImpl.h"
33 #include "Ge/GeExtents3d.h"
34 #include "Gs/GsViewPropsDef.h"
36 
53 {
54 public:
57 
58 public:
67  static OdGsBaseVectorizeView* safeCast(OdGsView* pView);
68 
71  virtual OdGiContext* userGiContext() const;
72  virtual void setUserGiContext(OdGiContext* pUserGiContext);
73  virtual void update();
74 
75  virtual void select(const OdGePoint2d* aPtDc, int numPoints, OdGsSelectionReactor* pReactor,
78 
79  virtual bool viewExtents(OdGeBoundBlock3d& extents) const;
80 
81  bool sceneDept(double& zNear, double& zFar, OdGsOverlayId nOverlay) const;
82  bool sceneDept(double& zNear, double& zFar) const;
83 
84 protected:
85 
86  virtual void updateGeometryByDevice();
87 
90 public:
91  virtual OdUInt32 numVectorizers() const = 0;
92 
93 protected:
94  virtual OdGsBaseVectorizer* getVectorizer(bool bDisplay) = 0;
95  virtual void releaseVectorizer(OdGsBaseVectorizer* pVect) = 0;
96 
97  virtual void updateGeometry();
98  virtual void updateScreen();
99 
100 private:
101  void setVectThreadIndex(OdGsBaseVectorizer* pVect, bool bAssignIndex, int idx = -1);
102 
103  //data
104 protected:
106 
107 private:
109  friend class VectorizerAutoPtr;
110  friend class BaseVectScheduler;
111 };
112 
114 {
115  return static_cast<OdGsBaseVectorizeView*>(OdSmartPtr<OdGsViewImpl>(pView).get());
116 }
117 
125 {
126 public:
127  VectorizerAutoPtr(OdGsBaseVectorizeView& view, bool bDisplay): m_view(view), m_obj(NULL)
128  {
129  m_obj = m_view.getVectorizer(bDisplay);
130  if(m_obj && bDisplay)
131  m_view.setVectThreadIndex(m_obj, true);
132  }
134  {
135  if(m_obj)
136  {
137  m_view.setVectThreadIndex(m_obj, false);
139  }
140  }
142  {
143  return static_cast<OdGsBaseVectorizer*>(m_obj);
144  }
145 
147  {
148  return const_cast<const OdGsBaseVectorizer*>(m_obj);
149  }
150 
151  const OdGsBaseVectorizer* get() const
152  {
153  return const_cast<const OdGsBaseVectorizer*>(m_obj);
154  }
155 
157  {
158  return static_cast<OdGsBaseVectorizer*>(m_obj);
159  }
160 
161 protected:
164 };
165 
166 #include "TD_PackPop.h"
167 
168 #define IMPL_VECTORIZER_DEFAULT()\
169  virtual OdUInt32 numVectorizers() const { return 1; }\
170  virtual OdGsBaseVectorizer* getVectorizer(bool /*bDisplay*/)\
171  { return this; }\
172  virtual void releaseVectorizer(OdGsBaseVectorizer* pVect)\
173  {ODA_ASSERT(pVect == (OdGsBaseVectorizer*)this); }
174 
175 #define IMPL_VECTORIZER_DEFAULT_EX()\
176  IMPL_VECTORIZER_DEFAULT()\
177  virtual void clearLinetypeCache(){ OdGiBaseVectorizerImpl::clearLinetypeCache(); }\
178  ODRX_USING_HEAP_OPERATORS(OdGiBaseVectorizer);
179 
180 #endif // ODGSBASEVECTORIZEVIEW_INC
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdGsOverlayId
Definition: GsOverlayDefs.h:40
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
bool sceneDept(double &zNear, double &zFar, OdGsOverlayId nOverlay) const
virtual void select(const OdGePoint2d *aPtDc, int numPoints, OdGsSelectionReactor *pReactor, OdGsView::SelectionMode mode=OdGsView::kCrossing)
static OdGsBaseVectorizeView * safeCast(OdGsView *pView)
virtual void updateGeometry()
virtual OdGsBaseVectorizer * getVectorizer(bool bDisplay)=0
virtual OdGiContext * userGiContext() const
virtual void setUserGiContext(OdGiContext *pUserGiContext)
virtual void releaseVectorizer(OdGsBaseVectorizer *pVect)=0
virtual OdUInt32 numVectorizers() const =0
virtual void update()
OdSmartPtr< OdGiContext > m_userGiContext
bool sceneDept(double &zNear, double &zFar) const
virtual bool viewExtents(OdGeBoundBlock3d &extents) const
virtual void updateGeometryByDevice()
virtual void updateScreen()
TD_USING(OdGsViewImpl::select)
Definition: Gs.h:133
SelectionMode
Definition: Gs.h:157
@ kCrossing
Definition: Gs.h:159
virtual void select(const OdGsDCPoint *points, int numPoints, OdGsSelectionReactor *pReactor, SelectionMode mode=kCrossing)
static OdGsViewImpl * safeCast(OdGsView *pView)
Definition: GsViewImpl.h:933
const T * get() const
Definition: SmartPtr.h:326
OdGsBaseVectorizer * m_obj
VectorizerAutoPtr(OdGsBaseVectorizeView &view, bool bDisplay)
OdGsBaseVectorizeView & m_view
OdGsBaseVectorizer * get()
OdGsBaseVectorizer * operator->()
const OdGsBaseVectorizer * get() const