9592ae24 |
1 | // Copyright (c) 2021 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #ifndef _BRepTools_PurgeLocations_HeaderFile |
15 | #define _BRepTools_PurgeLocations_HeaderFile |
16 | |
17 | #include <Standard.hxx> |
18 | #include <Standard_Type.hxx> |
19 | #include <Standard_Transient.hxx> |
20 | #include <BRepTools_ReShape.hxx> |
21 | #include <TopTools_LocationSet.hxx> |
22 | |
9592ae24 |
23 | |
9592ae24 |
24 | |
25 | //! Removes location datums, which satisfy conditions: |
26 | //! aTrsf.IsNegative() || (Abs(Abs(aTrsf.ScaleFactor()) - 1.) > TopLoc_Location::ScalePrec()) |
27 | //! from all locations of shape and its subshapes |
28 | class BRepTools_PurgeLocations |
29 | { |
30 | |
31 | public: |
32 | |
33 | Standard_EXPORT BRepTools_PurgeLocations(); |
34 | |
35 | //! Removes all locations correspodingly to criterium from theShape. |
36 | Standard_EXPORT Standard_Boolean Perform(const TopoDS_Shape& theShape); |
37 | |
38 | //! Returns shape with removed locations. |
39 | Standard_EXPORT const TopoDS_Shape& GetResult() const; |
40 | |
41 | Standard_EXPORT Standard_Boolean IsDone() const; |
42 | |
43 | //! Returns modified shape obtained from initial shape. |
44 | TopoDS_Shape ModifiedShape(const TopoDS_Shape& theInitShape) const; |
45 | |
46 | private: |
47 | |
48 | void AddShape(const TopoDS_Shape& theS); |
49 | Standard_Boolean PurgeLocation(const TopoDS_Shape& theS, TopoDS_Shape& theRes); |
50 | |
51 | Standard_Boolean myDone; |
52 | TopoDS_Shape myShape; |
53 | TopTools_IndexedMapOfShape myMapShapes; |
54 | TopTools_LocationSet myLocations; |
55 | TopTools_DataMapOfShapeShape myMapNewShapes; |
56 | Handle(BRepTools_ReShape) myReShape; |
57 | |
58 | }; |
59 | |
60 | #endif // _BRepTools_PurgeLocations_HeaderFile |