1 // Created on: 1995-04-19
2 // Created by: Yves FRICAUD
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepFill_OffsetWire_HeaderFile
18 #define _BRepFill_OffsetWire_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TopoDS_Face.hxx>
25 #include <Standard_Real.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <TopoDS_Shape.hxx>
28 #include <GeomAbs_JoinType.hxx>
29 #include <BRepFill_IndexedDataMapOfOrientedShapeListOfShape.hxx>
30 #include <BRepMAT2d_BisectingLocus.hxx>
31 #include <BRepMAT2d_LinkTopoBilo.hxx>
32 #include <TopTools_DataMapOfShapeShape.hxx>
33 #include <TopTools_ListOfShape.hxx>
34 #include <BRepFill_DataMapOfOrientedShapeListOfShape.hxx>
35 #include <TopTools_SequenceOfShape.hxx>
36 #include <TColgp_SequenceOfPnt.hxx>
37 class Standard_ConstructionError;
38 class Standard_NoSuchObject;
40 class BRepMAT2d_BisectingLocus;
41 class BRepMAT2d_LinkTopoBilo;
44 class BRepFill_TrimEdgeTool;
47 //! Constructs a Offset Wire to a spine (wire or face).
48 //! Offset direction will be to outer region in case of
49 //! positive offset value and to inner region in case of
50 //! negative offset value.
51 //! Inner/Outer region for open wire is defined by the
52 //! following rule: when we go along the wire (taking into
53 //! account of edges orientation) then outer region will be
54 //! on the right side, inner region will be on the left side.
55 //! In case of closed wire, inner region will always be
56 //! inside the wire (at that, edges orientation is not taken
58 //! The Wire or the Face must be planar and oriented correctly.
59 class BRepFill_OffsetWire
66 Standard_EXPORT BRepFill_OffsetWire();
68 Standard_EXPORT BRepFill_OffsetWire(const TopoDS_Face& Spine, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
70 //! Initialize the evaluation of Offseting.
71 Standard_EXPORT void Init (const TopoDS_Face& Spine, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
73 //! Performs an OffsetWire at an altitude <Alt> from
74 //! the face ( According to the orientation of the
76 Standard_EXPORT void Perform (const Standard_Real Offset, const Standard_Real Alt = 0.0);
78 //! Performs an OffsetWire
79 Standard_EXPORT void PerformWithBiLo (const TopoDS_Face& WSP, const Standard_Real Offset, const BRepMAT2d_BisectingLocus& Locus, BRepMAT2d_LinkTopoBilo& Link, const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Real Alt = 0.0);
81 Standard_EXPORT Standard_Boolean IsDone() const;
83 Standard_EXPORT const TopoDS_Face& Spine() const;
85 //! returns the generated shape.
86 Standard_EXPORT const TopoDS_Shape& Shape() const;
88 //! Returns the shapes created from a subshape
89 //! <SpineShape> of the spine.
90 //! Returns the last computed Offset.
91 Standard_EXPORT const TopTools_ListOfShape& GeneratedShapes (const TopoDS_Shape& SpineShape);
93 Standard_EXPORT GeomAbs_JoinType JoinType() const;
107 Standard_EXPORT BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Generated();
109 //! Prepare the spine as follow
110 //! - Cut the spine-Edges at the extrema of curvature and
111 //! at the inflexion points.
112 Standard_EXPORT void PrepareSpine();
114 //! Add the OffsetWire <Other> to <me> and update <myMap>
115 Standard_EXPORT void Add (const BRepFill_OffsetWire& Other);
117 Standard_EXPORT void UpdateDetromp (BRepFill_DataMapOfOrientedShapeListOfShape& Detromp, const TopoDS_Shape& Shape1, const TopoDS_Shape& Shape2, const TopTools_SequenceOfShape& Vertices, const TColgp_SequenceOfPnt& Params, const Bisector_Bisec& Bisec, const Standard_Boolean SOnE, const Standard_Boolean EOnE, const BRepFill_TrimEdgeTool& Trim) const;
119 //! Constructs the wires with the trimmed offset edges.
120 Standard_EXPORT void MakeWires();
122 //! Fix holes between open wires where it is possible
123 Standard_EXPORT void FixHoles();
127 TopoDS_Face myWorkSpine;
128 Standard_Real myOffset;
129 Standard_Boolean myIsOpenResult;
130 TopoDS_Shape myShape;
131 Standard_Boolean myIsDone;
132 GeomAbs_JoinType myJoinType;
133 BRepFill_IndexedDataMapOfOrientedShapeListOfShape myMap;
134 BRepMAT2d_BisectingLocus myBilo;
135 BRepMAT2d_LinkTopoBilo myLink;
136 TopTools_DataMapOfShapeShape myMapSpine;
137 Standard_Boolean myCallGen;
148 #endif // _BRepFill_OffsetWire_HeaderFile