0029730: OCAF User's Guide correction for case of attributes with User defined GUID
[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>
e8862cf4 30
31#include <Message_ProgressIndicator.hxx>
32
42cf5bc1 33class TopoDS_Face;
34class TopoDS_Wire;
35class TopoDS_Edge;
36class Bnd_Box2d;
37class TopoDS_Vertex;
38class TopoDS_Shell;
39class TopoDS_Solid;
40class TopoDS_CompSolid;
41class TopoDS_Compound;
42class TopoDS_Shape;
43class Message_ProgressIndicator;
44class BRep_Builder;
45class BRepTools_WireExplorer;
46class BRepTools_Modification;
47class BRepTools_Modifier;
48class BRepTools_TrsfModification;
49class BRepTools_NurbsConvertModification;
50class BRepTools_GTrsfModification;
51class BRepTools_Substitution;
52class BRepTools_Quilt;
53class BRepTools_ShapeSet;
54class BRepTools_ReShape;
2651bfde 55class Geom_Curve;
56class Geom2d_Curve;
57class Geom_Surface;
42cf5bc1 58
59
60//! The BRepTools package provides utilities for BRep
61//! data structures.
62//!
63//! * WireExplorer : A tool to explore the topology of
64//! a wire in the order of the edges.
65//!
66//! * ShapeSet : Tools used for dumping, writing and
67//! reading.
68//!
69//! * UVBounds : Methods to compute the limits of the
70//! boundary of a face, a wire or an edge in the
71//! parametric space of a face.
72//!
73//! * Update : Methods to call when a topology has
74//! been created to compute all missing data.
75//!
76//! * UpdateFaceUVPoints : Method to update the UV
77//! points stored with the edges on a face. This
78//! method ensure that connected edges have the same
79//! UV point on their common extremity.
80//!
81//! * Compare : Method to compare two vertices.
82//!
83//! * Compare : Method to compare two edges.
84//!
85//! * OuterWire : A method to find the outer wire of a
86//! face.
87//!
88//! * Map3DEdges : A method to map all the 3D Edges of
89//! a Shape.
90//!
91//! * Dump : A method to dump a BRep object.
92class BRepTools
93{
94public:
95
96 DEFINE_STANDARD_ALLOC
97
98
99 //! Returns in UMin, UMax, VMin, VMax the bounding
100 //! values in the parametric space of F.
101 Standard_EXPORT static void UVBounds (const TopoDS_Face& F, Standard_Real& UMin, Standard_Real& UMax, Standard_Real& VMin, Standard_Real& VMax);
102
103 //! Returns in UMin, UMax, VMin, VMax the bounding
104 //! values of the wire in the parametric space of F.
105 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);
106
107 //! Returns in UMin, UMax, VMin, VMax the bounding
108 //! values of the edge in the parametric space of F.
109 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);
110
111 //! Adds to the box <B> the bounding values in the
112 //! parametric space of F.
113 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, Bnd_Box2d& B);
114
115 //! Adds to the box <B> the bounding values of the
116 //! wire in the parametric space of F.
117 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, const TopoDS_Wire& W, Bnd_Box2d& B);
118
119 //! Adds to the box <B> the bounding values of the
120 //! edge in the parametric space of F.
121 Standard_EXPORT static void AddUVBounds (const TopoDS_Face& F, const TopoDS_Edge& E, Bnd_Box2d& B);
122
123 //! Update a vertex (nothing is done)
124 Standard_EXPORT static void Update (const TopoDS_Vertex& V);
125
126 //! Update an edge, compute 2d bounding boxes.
127 Standard_EXPORT static void Update (const TopoDS_Edge& E);
128
129 //! Update a wire (nothing is done)
130 Standard_EXPORT static void Update (const TopoDS_Wire& W);
131
132 //! Update a Face, update UV points.
133 Standard_EXPORT static void Update (const TopoDS_Face& F);
134
135 //! Update a shell (nothing is done)
136 Standard_EXPORT static void Update (const TopoDS_Shell& S);
137
138 //! Update a solid (nothing is done)
139 Standard_EXPORT static void Update (const TopoDS_Solid& S);
140
141 //! Update a composite solid (nothing is done)
142 Standard_EXPORT static void Update (const TopoDS_CompSolid& C);
143
144 //! Update a compound (nothing is done)
145 Standard_EXPORT static void Update (const TopoDS_Compound& C);
146
147 //! Update a shape, call the corect update.
148 Standard_EXPORT static void Update (const TopoDS_Shape& S);
149
150 //! For all the edges of the face <F> reset the UV
151 //! points to ensure that connected faces have the
152 //! same point at there common extremity.
153 Standard_EXPORT static void UpdateFaceUVPoints (const TopoDS_Face& F);
154
155 //! Removes all the triangulations of the faces of <S>
156 //! and removes all polygons on triangulations of the
157 //! edges.
158 Standard_EXPORT static void Clean (const TopoDS_Shape& S);
159
160 //! Removes all the pcurves of the edges of <S> that
161 //! refer to surfaces not belonging to any face of <S>
162 Standard_EXPORT static void RemoveUnusedPCurves (const TopoDS_Shape& S);
163
164 //! verifies that each face from the shape <S> has got
165 //! a triangulation with a deflection <= deflec and
166 //! the edges a discretisation on this triangulation.
167 Standard_EXPORT static Standard_Boolean Triangulation (const TopoDS_Shape& S, const Standard_Real deflec);
168
169 //! Returns True if the distance between the two
170 //! vertices is lower than their tolerance.
171 Standard_EXPORT static Standard_Boolean Compare (const TopoDS_Vertex& V1, const TopoDS_Vertex& V2);
172
173 //! Returns True if the distance between the two
174 //! edges is lower than their tolerance.
175 Standard_EXPORT static Standard_Boolean Compare (const TopoDS_Edge& E1, const TopoDS_Edge& E2);
176
177 //! Returns the outer most wire of <F>. Returns a Null
178 //! wire if <F> has no wires.
179 Standard_EXPORT static TopoDS_Wire OuterWire (const TopoDS_Face& F);
180
181 //! Stores in the map <M> all the 3D topology edges
182 //! of <S>.
183 Standard_EXPORT static void Map3DEdges (const TopoDS_Shape& S, TopTools_IndexedMapOfShape& M);
184
185 //! Verifies that the edge <E> is found two times on
186 //! the face <F> before calling BRep_Tool::IsClosed.
187 Standard_EXPORT static Standard_Boolean IsReallyClosed (const TopoDS_Edge& E, const TopoDS_Face& F);
188
11af6cdd 189 //! Detect closedness of face in U and V directions
190 Standard_EXPORT static void DetectClosedness (const TopoDS_Face& theFace,
191 Standard_Boolean& theUclosed,
192 Standard_Boolean& theVclosed);
193
42cf5bc1 194 //! Dumps the topological structure and the geometry
195 //! of <Sh> on the stream <S>.
196 Standard_EXPORT static void Dump (const TopoDS_Shape& Sh, Standard_OStream& S);
197
198 //! Writes <Sh> on <S> in an ASCII format.
199 Standard_EXPORT static void Write (const TopoDS_Shape& Sh, Standard_OStream& S, const Handle(Message_ProgressIndicator)& PR = NULL);
200
201 //! Reads a Shape from <S> in returns it in <Sh>.
202 //! <B> is used to build the shape.
203 Standard_EXPORT static void Read (TopoDS_Shape& Sh, Standard_IStream& S, const BRep_Builder& B, const Handle(Message_ProgressIndicator)& PR = NULL);
204
205 //! Writes <Sh> in <File>.
206 Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape& Sh, const Standard_CString File, const Handle(Message_ProgressIndicator)& PR = NULL);
207
208 //! Reads a Shape from <File>, returns it in <Sh>.
209 //! <B> is used to build the shape.
210 Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& Sh, const Standard_CString File, const BRep_Builder& B, const Handle(Message_ProgressIndicator)& PR = NULL);
211
2651bfde 212 //! Evals real tolerance of edge <theE>.
213 //! <theC3d>, <theC2d>, <theS>, <theF>, <theL> are
214 //! correspondently 3d curve of edge, 2d curve on surface <theS> and
215 //! rang of edge
216 //! If calculated tolerance is more then current edge tolerance, edge is updated.
217 //! Method returns actual tolerance of edge
218 Standard_EXPORT static Standard_Real EvalAndUpdateTol(const TopoDS_Edge& theE,
219 const Handle(Geom_Curve)& theC3d,
220 const Handle(Geom2d_Curve) theC2d,
221 const Handle(Geom_Surface)& theS,
222 const Standard_Real theF,
223 const Standard_Real theL);
42cf5bc1 224
225
226
227protected:
228
229
230
231
232
233private:
234
235
236
237
238friend class BRepTools_WireExplorer;
239friend class BRepTools_Modification;
240friend class BRepTools_Modifier;
241friend class BRepTools_TrsfModification;
242friend class BRepTools_NurbsConvertModification;
243friend class BRepTools_GTrsfModification;
244friend class BRepTools_Substitution;
245friend class BRepTools_Quilt;
246friend class BRepTools_ShapeSet;
247friend class BRepTools_ReShape;
248
249};
250
251
252
253
254
255
256
257#endif // _BRepTools_HeaderFile