0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / BRepOffsetAPI / BRepOffsetAPI_MakePipe.cxx
CommitLineData
b311480e 1// Created on: 1994-07-12
2// Created by: Bruno DUMORTIER
3// Copyright (c) 1994-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <BRepFill_Pipe.hxx>
19#include <BRepOffsetAPI_MakePipe.hxx>
20#include <TopAbs_ShapeEnum.hxx>
21#include <TopExp.hxx>
7fd59977 22#include <TopExp_Explorer.hxx>
42cf5bc1 23#include <TopoDS.hxx>
7fd59977 24#include <TopoDS_Edge.hxx>
42cf5bc1 25#include <TopoDS_Face.hxx>
26#include <TopoDS_Shape.hxx>
7fd59977 27#include <TopoDS_Vertex.hxx>
42cf5bc1 28#include <TopoDS_Wire.hxx>
73920cd4 29#include <TopTools_IndexedMapOfShape.hxx>
7fd59977 30
31//=======================================================================
32//function : BRepOffsetAPI_MakePipe
471ce736 33//purpose : constructor
7fd59977 34//=======================================================================
7fd59977 35BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine ,
471ce736 36 const TopoDS_Shape& Profile)
7fd59977 37 : myPipe(Spine, Profile)
38{
39 Build();
40}
41
42//=======================================================================
471ce736 43//function : BRepOffsetAPI_MakePipe
44//purpose : constructor
45// Set the mode of sweeping
a31abc03 46// It can be:
47// - Frenet
48// - Corrected Frenet
49// - Discrete Trihedron
471ce736 50// Also set the flag that indicates attempt to approximate
a31abc03 51// a C1-continuous surface if a swept surface proved
52// to be C0.
53//=======================================================================
54
471ce736 55BRepOffsetAPI_MakePipe::BRepOffsetAPI_MakePipe(const TopoDS_Wire& Spine ,
56 const TopoDS_Shape& Profile,
57 const GeomFill_Trihedron aMode,
58 const Standard_Boolean ForceApproxC1)
59 : myPipe(Spine, Profile, aMode, ForceApproxC1)
a31abc03 60{
471ce736 61 Build();
a31abc03 62}
63
64//=======================================================================
7fd59977 65//function : Pipe
66//purpose :
67//=======================================================================
68
69const BRepFill_Pipe& BRepOffsetAPI_MakePipe::Pipe() const
70{
71 return myPipe;
72}
73
74
75//=======================================================================
76//function : Build
77//purpose :
78//=======================================================================
79
80void BRepOffsetAPI_MakePipe::Build()
81{
82 myShape = myPipe.Shape();
73920cd4 83 //Check for emptiness of result
84 TopTools_IndexedMapOfShape theMap;
85 TopExp::MapShapes(myShape, theMap);
86 if (theMap.Extent() == 1)
87 NotDone();
88 else
89 Done();
7fd59977 90}
91
92
93//=======================================================================
94//function : FirstShape
95//purpose :
96//=======================================================================
97
98TopoDS_Shape BRepOffsetAPI_MakePipe::FirstShape()
99{
100 return myPipe.FirstShape();
101}
102
103
104//=======================================================================
105//function : LastShape
106//purpose :
107//=======================================================================
108
109TopoDS_Shape BRepOffsetAPI_MakePipe::LastShape()
110{
111 return myPipe.LastShape();
112}
113
5e9548e7 114//=======================================================================
115//function : Generated
116//purpose : standard method
117//=======================================================================
118const TopTools_ListOfShape& BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& S)
119{
120 myPipe.Generated(S, myGenerated);
121 return myGenerated;
122}
7fd59977 123
124//=======================================================================
125//function : Generated
5e9548e7 126//purpose : returns generated elementary subshape
7fd59977 127//=======================================================================
128
5e9548e7 129TopoDS_Shape BRepOffsetAPI_MakePipe::Generated(const TopoDS_Shape& SSpine,
130 const TopoDS_Shape& SProfile)
7fd59977 131{
132 if (SProfile.ShapeType () == TopAbs_EDGE) {
133 return myPipe.Face (TopoDS::Edge (SSpine), TopoDS::Edge (SProfile));
134 }
135 else if (SProfile.ShapeType () == TopAbs_VERTEX) {
136 return myPipe.Edge (TopoDS::Edge (SSpine), TopoDS::Vertex (SProfile));
137 }
138
139//POP pour NT
140 TopoDS_Shape bid;
141 return bid;
142}
143
73920cd4 144//=======================================================================
145//function : ErrorOnSurface
146//purpose :
147//=======================================================================
148
149Standard_Real BRepOffsetAPI_MakePipe::ErrorOnSurface() const
150{
151 return myPipe.ErrorOnSurface();
152}