0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepTools / BRepTools.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-08-28
2// Created by: Remi LEQUETTE
3// Copyright (c) 1992-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _BRepTools_HeaderFile
18#define _BRepTools_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Real.hxx>
25#include <Standard_Boolean.hxx>
26#include <TopTools_IndexedMapOfShape.hxx>
27#include <Standard_OStream.hxx>
28#include <Standard_IStream.hxx>
29#include <Standard_CString.hxx>
30class TopoDS_Face;
31class TopoDS_Wire;
32class TopoDS_Edge;
33class Bnd_Box2d;
34class TopoDS_Vertex;
35class TopoDS_Shell;
36class TopoDS_Solid;
37class TopoDS_CompSolid;
38class TopoDS_Compound;
39class TopoDS_Shape;
40class Message_ProgressIndicator;
41class BRep_Builder;
42class BRepTools_WireExplorer;
43class BRepTools_Modification;
44class BRepTools_Modifier;
45class BRepTools_TrsfModification;
46class BRepTools_NurbsConvertModification;
47class BRepTools_GTrsfModification;
48class BRepTools_Substitution;
49class BRepTools_Quilt;
50class BRepTools_ShapeSet;
51class BRepTools_ReShape;
52
53
54//! The BRepTools package provides utilities for BRep
55//! data structures.
56//!
57//! * WireExplorer : A tool to explore the topology of
58//! a wire in the order of the edges.
59//!
60//! * ShapeSet : Tools used for dumping, writing and
61//! reading.
62//!
63//! * UVBounds : Methods to compute the limits of the
64//! boundary of a face, a wire or an edge in the
65//! parametric space of a face.
66//!
67//! * Update : Methods to call when a topology has
68//! been created to compute all missing data.
69//!
70//! * UpdateFaceUVPoints : Method to update the UV
71//! points stored with the edges on a face. This
72//! method ensure that connected edges have the same
73//! UV point on their common extremity.
74//!
75//! * Compare : Method to compare two vertices.
76//!
77//! * Compare : Method to compare two edges.
78//!
79//! * OuterWire : A method to find the outer wire of a
80//! face.
81//!
82//! * Map3DEdges : A method to map all the 3D Edges of
83//! a Shape.
84//!
85//! * Dump : A method to dump a BRep object.
86class BRepTools
87{
88public:
89
90 DEFINE_STANDARD_ALLOC
91
92
93 //! Returns in UMin, UMax, VMin, VMax the bounding
94 //! values in the parametric space of F.
95 Standard_EXPORT static void UVBounds (const TopoDS_Face& F, Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax);
96
97 //! Returns in UMin, UMax, VMin, VMax the bounding
98 //! values of the wire in the parametric space of F.
99 Standard_EXPORT static void UVBounds (const TopoDS_Face& F, const TopoDS_Wire& W, Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax);
100
101 //! Returns in UMin, UMax, VMin, VMax the bounding
102 //! values of the edge in the parametric space of F.
103 Standard_EXPORT static void UVBounds (const TopoDS_Face& F, const TopoDS_Edge& E, Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax);
104
105 //! Adds to the box <B> the bounding values in the
106 //! parametric space of F.
107 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, Bnd_Box2d& B);
108
109 //! Adds to the box <B> the bounding values of the
110 //! wire in the parametric space of F.
111 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, const TopoDS_Wire& W, Bnd_Box2d& B);
112
113 //! Adds to the box <B> the bounding values of the
114 //! edge in the parametric space of F.
115 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, const TopoDS_Edge& E, Bnd_Box2d& B);
116
117 //! Update a vertex (nothing is done)
118 Standard_EXPORT static void Update (const TopoDS_Vertex& V);
119
120 //! Update an edge, compute 2d bounding boxes.
121 Standard_EXPORT static void Update (const TopoDS_Edge& E);
122
123 //! Update a wire (nothing is done)
124 Standard_EXPORT static void Update (const TopoDS_Wire& W);
125
126 //! Update a Face, update UV points.
127 Standard_EXPORT static void Update (const TopoDS_Face& F);
128
129 //! Update a shell (nothing is done)
130 Standard_EXPORT static void Update (const TopoDS_Shell& S);
131
132 //! Update a solid (nothing is done)
133 Standard_EXPORT static void Update (const TopoDS_Solid& S);
134
135 //! Update a composite solid (nothing is done)
136 Standard_EXPORT static void Update (const TopoDS_CompSolid& C);
137
138 //! Update a compound (nothing is done)
139 Standard_EXPORT static void Update (const TopoDS_Compound& C);
140
141 //! Update a shape, call the corect update.
142 Standard_EXPORT static void Update (const TopoDS_Shape& S);
143
144 //! For all the edges of the face <F> reset the UV
145 //! points to ensure that connected faces have the
146 //! same point at there common extremity.
147 Standard_EXPORT static void UpdateFaceUVPoints (const TopoDS_Face& F);
148
149 //! Removes all the triangulations of the faces of <S>
150 //! and removes all polygons on triangulations of the
151 //! edges.
152 Standard_EXPORT static void Clean (const TopoDS_Shape& S);
153
154 //! Removes all the pcurves of the edges of <S> that
155 //! refer to surfaces not belonging to any face of <S>
156 Standard_EXPORT static void RemoveUnusedPCurves (const TopoDS_Shape& S);
157
158 //! verifies that each face from the shape <S> has got
159 //! a triangulation with a deflection <= deflec and
160 //! the edges a discretisation on this triangulation.
161 Standard_EXPORT static Standard_Boolean Triangulation (const TopoDS_Shape& S, const Standard_Real deflec);
162
163 //! Returns True if the distance between the two
164 //! vertices is lower than their tolerance.
165 Standard_EXPORT static Standard_Boolean Compare (const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
166
167 //! Returns True if the distance between the two
168 //! edges is lower than their tolerance.
169 Standard_EXPORT static Standard_Boolean Compare (const TopoDS_Edge& E1, const TopoDS_Edge& E2);
170
171 //! Returns the outer most wire of <F>. Returns a Null
172 //! wire if <F> has no wires.
173 Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& F);
174
175 //! Stores in the map <M> all the 3D topology edges
176 //! of <S>.
177 Standard_EXPORT static void Map3DEdges (const TopoDS_Shape& S, TopTools_IndexedMapOfShape& M);
178
179 //! Verifies that the edge <E> is found two times on
180 //! the face <F> before calling BRep_Tool::IsClosed.
181 Standard_EXPORT static Standard_Boolean IsReallyClosed (const TopoDS_Edge& E, const TopoDS_Face& F);
182
183 //! Dumps the topological structure and the geometry
184 //! of <Sh> on the stream <S>.
185 Standard_EXPORT static void Dump (const TopoDS_Shape& Sh, Standard_OStream& S);
186
187 //! Writes <Sh> on <S> in an ASCII format.
188 Standard_EXPORT static void Write (const TopoDS_Shape& Sh, Standard_OStream& S, const Handle(Message_ProgressIndicator)& PR = NULL);
189
190 //! Reads a Shape from <S> in returns it in <Sh>.
191 //! <B> is used to build the shape.
192 Standard_EXPORT static void Read (TopoDS_Shape& Sh, Standard_IStream& S, const BRep_Builder& B, const Handle(Message_ProgressIndicator)& PR = NULL);
193
194 //! Writes <Sh> in <File>.
195 Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape& Sh, const Standard_CString File, const Handle(Message_ProgressIndicator)& PR = NULL);
196
197 //! Reads a Shape from <File>, returns it in <Sh>.
198 //! <B> is used to build the shape.
199 Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& Sh, const Standard_CString File, const BRep_Builder& B, const Handle(Message_ProgressIndicator)& PR = NULL);
200
201
202
203
204protected:
205
206
207
208
209
210private:
211
212
213
214
215friend class BRepTools_WireExplorer;
216friend class BRepTools_Modification;
217friend class BRepTools_Modifier;
218friend class BRepTools_TrsfModification;
219friend class BRepTools_NurbsConvertModification;
220friend class BRepTools_GTrsfModification;
221friend class BRepTools_Substitution;
222friend class BRepTools_Quilt;
223friend class BRepTools_ShapeSet;
224friend class BRepTools_ReShape;
225
226};
227
228
229
230
231
232
233
234#endif // _BRepTools_HeaderFile