zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/////////////////////////////////////////////////////////////////////////////// 
// Copyright (C) 2002-2016, Open Design Alliance (the "Alliance"). 
// All rights reserved. 
// 
// This software and its documentation and related materials are owned by 
// the Alliance. The software may only be incorporated into application 
// programs owned by members of the Alliance, subject to a signed 
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable  
// trade secrets of the Alliance and its suppliers. The software is also 
// protected by copyright law and international treaty provisions. Application  
// programs incorporating this software must include the following statement 
// with their copyright notices:
//   
//   This application incorporates Teigha(R) software pursuant to a license 
//   agreement with Open Design Alliance.
//   Teigha(R) Copyright (C) 2002-2016 by Open Design Alliance. 
//   All rights reserved.
//
// By use of this software, its documentation or related materials, you 
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
 
#ifndef __ODGIORTOCLIPPEREX_H__
#define __ODGIORTOCLIPPEREX_H__
 
#include "Gi/GiOrthoClipper.h"
#include "Gi/GiAbstractClipBoundary.h"
 
#include "TD_PackPush.h"
 
class OdGeBoundBlock3d;
class OdStreamBuf;
 
/** \details
 
    {group:OdGi_Classes}
*/
class ODGI_EXPORT OdGiOrthoClipperEx : public OdGiOrthoClipper
{
public:
  ODRX_DECLARE_MEMBERS(OdGiOrthoClipperEx);
 
  // Initial clipper interface support
 
  TD_USING(OdGiOrthoClipper::set);
  TD_USING(OdGiOrthoClipper::get);
 
  // Extend initial interface by inverted clipping boundary support
 
  virtual void set(bool bInverted,
                   OdUInt32 nPoints,          // points counter. 0 - disables XY clip; 2 - defines rectangle.
                   const OdGePoint2d* points, // points defining sides of clipping prism perpendicular to XY
                   bool bClipLowerZ = false, double dLowerZ = 0.0,
                   bool bClipUpperZ = false, double dUpperZ = 0.0) = 0;
 
  virtual void set(bool bInverted,
                   const OdGePoint2dArray& points, // points defining sides of clipping prism perpendicular to XY
                   bool bClipLowerZ = false, double dLowerZ = 0.0,
                   bool bClipUpperZ = false, double dUpperZ = 0.0) = 0;
 
  virtual void get(bool &bInverted, OdGePoint2dArray& points,
                   bool& bClipLowerZ, double& dLowerZ,
                   bool& bClipUpperZ, double& dUpperZ) const = 0;
 
  // Extend initial interface by extended clipping boundary support
 
  virtual void set(bool bPreprocess, OdUInt32 nCounts, const int *counts,
                   OdUInt32 nPoints, const OdGePoint2d *points,
                   bool bClipLowerZ = false, double dLowerZ = 0.0,
                   bool bClipUpperZ = false, double dUpperZ = 0.0) = 0;
 
  virtual void set(bool bPreprocess, const OdIntArray& counts, const OdGePoint2dArray& points,
                   bool bClipLowerZ = false, double dLowerZ = 0.0,
                   bool bClipUpperZ = false, double dUpperZ = 0.0) = 0;
 
  virtual void get(OdIntArray& counts, OdGePoint2dArray& points,
                   bool& bClipLowerZ, double& dLowerZ,
                   bool& bClipUpperZ, double& dUpperZ) const = 0;
 
  // Stubs for old extended clipping boundary interface
 
  void set(OdUInt32 nCounts, const int *counts,
           OdUInt32 nPoints, const OdGePoint2d *points,
           bool bClipLowerZ = false, double dLowerZ = 0.0,
           bool bClipUpperZ = false, double dUpperZ = 0.0)
  { set(false, nCounts, counts, nPoints, points, bClipLowerZ, dLowerZ, bClipUpperZ, dUpperZ); }
 
  void set(const OdIntArray& counts, const OdGePoint2dArray& points,
           bool bClipLowerZ = false, double dLowerZ = 0.0,
           bool bClipUpperZ = false, double dUpperZ = 0.0)
  { set(false, counts, points, bClipLowerZ, dLowerZ, bClipUpperZ, dUpperZ); }
 
  // Some classification functionality applicable for single (top) clipping stage
 
  virtual bool isEmpty() const = 0;
  virtual bool isInverted() const = 0;
  virtual bool isExtended() const = 0;
  virtual bool isSingleClipStage() const = 0;
  virtual bool isEmptyClipSet() const = 0;
 
  // Support direct setting of clipping boundaries
 
  virtual void set(OdGiClipBoundary* pBoundary, OdGiAbstractClipBoundary* pClipInfo = NULL, const OdGeMatrix3d *pXform = NULL) = 0;
  virtual OdGiAbstractClipBoundary::BoundaryType getType() const = 0;
 
  // Configuration
 
  virtual void enableAnalyticCurvesClipping(bool bEnable) = 0;
  virtual bool isAnalyticCurvesClippingEnabled() const = 0;
 
  virtual void enable() = 0;
  virtual void disable() = 0;
  virtual bool enabled() const = 0;
 
  enum ClipLimit
  {
    kPolyClipLimit = 0, // Memory limit (in bytes) which limits internal clipping structures number
    kNumClipLimits
  };
  virtual void setLimit(ClipLimit clipLimit, OdUInt32 nLimit) = 0;
  virtual OdUInt32 getLimit(ClipLimit clipLimit) const = 0;
 
  // Support mutiple clip stages
 
  struct ClipPlane
  {
    OdGePoint3d m_origin;
    OdGeVector3d m_normal;
    enum MarkType
    {
      kNoMark = 0,
      kMarkLower,
      kMarkUpper
    } m_markType;
    ClipPlane() : m_markType(kNoMark) {}
  };
  typedef OdArray<ClipPlane, OdMemoryAllocator<ClipPlane> > ClipPlanesArray;
  enum CountsClassify
  {
    kCCDontClassify = 0,      // Avoid classification
    kCCClassifiedByInclusion, // Classify by polygon-polygon inclusion
    kCCClassifiedByInteger,   // Classify by positive/negative counts number
    kCCClassifiedByOrder,     // Classify by CW/CCW ordering
    kCCClassifiedByNormal,    // Classify by positive/negative normal
    kCCClassifiedByXor,       // Preprocess by Xor operation (intersection)
    kCCClassifiedBySignedXor  // Preprocess by set of Union/Subtract operations
  };
 
  virtual void pushClipStage(OdGiClipBoundary* pBoundary, OdGiAbstractClipBoundary* pClipInfo = NULL, const OdGeMatrix3d *pXform = NULL) = 0;
  virtual void pushClipStage(OdUInt32 numPlanes, const ClipPlane *pPlanes) = 0;
  virtual void pushClipStage(OdUInt32 nCounts, const int *counts,
                             OdUInt32 nPoints, const OdGePoint2d *points,
                             bool bInverted = false, CountsClassify countsClass = kCCDontClassify, const OdGeMatrix3d *pXform = NULL,
                             OdUInt32 numPlanes = 0, const ClipPlane *pPlanes = NULL) = 0;
  virtual void pushClipStage(OdUInt32 nCounts, const int *counts,
                             OdUInt32 nPoints, const OdGePoint3d *points, const OdGeVector3d *pNormal = NULL,
                             bool bInverted = false, CountsClassify countsClass = kCCDontClassify, const OdGeMatrix3d *pXform = NULL,
                             OdUInt32 numPlanes = 0, const ClipPlane *pPlanes = NULL) = 0;
 
  virtual bool popClipStage() = 0;
 
  virtual void clearClipping(bool bClearCache = false) = 0; // Clear all clipping stages
  virtual void clearTemporaryArrays() = 0; // Clear all temporarily allocated arrays and caches
 
  virtual OdUInt32 numClipStages() const = 0;
  virtual void classifyClipStage(OdUInt32 nStage, OdUInt32 *pNPlanes, OdUInt32 *pNPolys = NULL, bool *bFirstPolyInverted = NULL) const = 0;
  virtual bool getClipStage(OdUInt32 nStage, OdIntArray& counts, OdGePoint2dArray& points, OdGeVector3d *pNormal = NULL) const = 0;
  virtual bool getClipStage(OdUInt32 nStage, OdIntArray& counts, OdGePoint3dArray& points, OdGeVector3d *pNormal = NULL) const = 0;
  virtual bool getClipStage(OdUInt32 nStage, ClipPlanesArray& planes) const = 0;
 
  // Interface compatibility with OdGiOrthoPrismIntersector
 
  virtual OdUInt32 clipStatus() const = 0;
  virtual void clearClipStatus() = 0;
 
  // Some helpful checking routines
 
  enum VisibilityStatus
  {
    kStatusInvisible = -1,
    kStatusClipped   =  0,
    kStatusVisible   =  1
  };
  virtual VisibilityStatus checkPointVisibility(const OdGePoint3d &pt) const = 0;
  virtual VisibilityStatus checkSphereVisibility(const OdGePoint3d &origin, double radius) const = 0;
  virtual VisibilityStatus checkExtentsVisibility(const OdGeExtents3d &extents) const = 0;
  virtual VisibilityStatus checkBoundsVisibility(const OdGeBoundBlock3d &bb) const = 0;
 
  // Clipping engine debugging
 
  virtual void enableLogging(OdStreamBuf *pStream) = 0;
  virtual void disableLogging() = 0;
  virtual bool isLoggingEnabled() const = 0;
};
 
typedef OdSmartPtr<OdGiOrthoClipperEx> OdGiOrthoClipperExPtr;
 
#include "TD_PackPop.h"
 
#endif //#ifndef __ODGIORTOCLIPPEREX_H__