// Created on: 1997-04-14
// Created by: Olga KOULECHOVA
// Copyright (c) 1997-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
-
-#include <BRepFeat_MakeLinearForm.ixx>
-
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgoAPI_Section.hxx>
+#include <BRepBuilderAPI.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepExtrema_ExtCF.hxx>
+#include <BRepExtrema_ExtPC.hxx>
+#include <BRepExtrema_ExtPF.hxx>
#include <BRepFeat.hxx>
-
-#include <LocOpe.hxx>
-#include <LocOpe_LinearForm.hxx>
-#include <LocOpe_Gluer.hxx>
-#include <LocOpe_FindEdges.hxx>
-
-#include <gp_Vec.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Lin.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Pnt.hxx>
-
-#include <gp_Vec2d.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Geom_Curve.hxx>
-
+#include <BRepFeat_MakeLinearForm.hxx>
+#include <BRepLib_MakeEdge.hxx>
+#include <BRepLib_MakeFace.hxx>
+#include <BRepLib_MakeVertex.hxx>
+#include <BRepLib_MakeWire.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepTools.hxx>
+#include <BRepTools_Modifier.hxx>
+#include <BRepTools_TrsfModification.hxx>
+#include <BRepTools_WireExplorer.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2d_Line.hxx>
-
-#include <Geom_Plane.hxx>
-#include <Geom_Surface.hxx>
+#include <Geom_Curve.hxx>
#include <Geom_CylindricalSurface.hxx>
+#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
-
+#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
+#include <GeomLProp_CLProps.hxx>
#include <GeomProjLib.hxx>
-
-#include <Geom2d_Curve.hxx>
-#include <Geom2d_Curve.hxx>
-
+#include <gp_Dir.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Vec2d.hxx>
+#include <IntRes2d_IntersectionPoint.hxx>
+#include <LocOpe.hxx>
+#include <LocOpe_FindEdges.hxx>
+#include <LocOpe_Gluer.hxx>
+#include <LocOpe_LinearForm.hxx>
+#include <Precision.hxx>
+#include <Standard_ConstructionError.hxx>
+#include <TColGeom_Array1OfCurve.hxx>
+#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
-
#include <TColStd_Array1OfReal.hxx>
-#include <IntRes2d_IntersectionPoint.hxx>
-
-#include <BRepTools_WireExplorer.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-
-#include <TopExp_Explorer.hxx>
#include <TopExp.hxx>
-
-#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
-#include <TopOpeBRepBuild_HBuilder.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
-
-#include <TColgp_Array1OfPnt.hxx>
-
-#include <TColGeom_Array1OfCurve.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Face.hxx>
-
-#include <BRepLib_MakeVertex.hxx>
-#include <BRepLib_MakeEdge.hxx>
-#include <BRepLib_MakeFace.hxx>
-
-#include <BRepTools.hxx>
-
-#include <BRepBuilderAPI.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-
-//modified by NIZNHY-PKV Fri Mar 22 16:51:33 2002 f
-//#include <BRepAlgo_Section.hxx>
-//#include <BRepAlgo_Common.hxx>
-#include <BRepAlgoAPI_Section.hxx>
-#include <BRepAlgoAPI_Common.hxx>
-//modified by NIZNHY-PKV Fri Mar 22 16:51:35 2002 t
-
-#include <BRepExtrema_ExtPC.hxx>
-#include <BRepExtrema_ExtPF.hxx>
-#include <BRepExtrema_ExtCF.hxx>
-
-#include <BRepTools_Modifier.hxx>
-#include <BRepTools_TrsfModification.hxx>
-
-#include <Standard_ConstructionError.hxx>
-
-#include <Precision.hxx>
-
-#include <GeomLProp_CLProps.hxx>
-
-#include <BRepBuilderAPI_Transform.hxx>
-#include <BRepLib_MakeWire.hxx>
-//#include <DbgTools.hxx>
+#include <TopTools_MapOfShape.hxx>
-#ifdef DEB
+#ifdef OCCT_DEBUG
extern Standard_Boolean BRepFeat_GettraceFEAT();
extern Standard_Boolean BRepFeat_GettraceFEATRIB();
#endif
const Standard_Integer Mode,
const Standard_Boolean Modify)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << "BRepFeat_MakeLinearForm::Init" << endl;
+ if (trc) std::cout << "BRepFeat_MakeLinearForm::Init" << std::endl;
#endif
Standard_Boolean RevolRib = Standard_False;
Done();
myListOfEdges.Clear();
mySlface.Clear();
- TopoDS_Shape aLocalShape = W.Oriented(TopAbs_FORWARD);
- myWire = TopoDS::Wire(aLocalShape);
+ TopoDS_Shape aLocalShapeW = W.Oriented(TopAbs_FORWARD);
+ myWire = TopoDS::Wire(aLocalShapeW);
// myWire = TopoDS::Wire(W.Oriented(TopAbs_FORWARD));
myDir = Direc;
myDir1 = Direc1;
myFuse = Standard_False;
else // if(Mode == 1)
myFuse = Standard_True;
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (trc) {
- if (myFuse) cout << " Fuse" << endl;
- if (!myFuse) cout << " Cut" << endl;
+ if (myFuse) std::cout << " Fuse" << std::endl;
+ if (!myFuse) std::cout << " Cut" << std::endl;
}
#endif
if(!myDir1.IsEqual(nulldir, myTol, myTol)) {
Standard_Real ang = myDir1.Angle(myDir);
if(ang != M_PI) {
-#ifdef DEB
- if (trc) cout << " Directions must be opposite" << endl;
+#ifdef OCCT_DEBUG
+ if (trc) std::cout << " Directions must be opposite" << std::endl;
#endif
myStatusError = BRepFeat_BadDirect;
NotDone();
else {
// Rib is centre in the middle of translation
-#ifdef DEB
- if (trc) cout << " Rib is centre" << endl;
+#ifdef OCCT_DEBUG
+ if (trc) std::cout << " Rib is centre" << std::endl;
#endif
const gp_Vec& DirTranslation = (Direc + Direc1) * 0.5;
gp_Trsf T;
6.*myBnd, -6.*myBnd, 6.*myBnd);
TopoDS_Face PlaneFace = TopoDS::Face(PlaneF.Shape());
- //modified by NIZNHY-PKV Fri Mar 22 16:49:28 2002 f
- //BRepAlgo_Common PlaneS(BndBox, PlaneFace);
BRepAlgoAPI_Common PlaneS(BndBox, PlaneFace);
- //modified by NIZNHY-PKV Fri Mar 22 16:49:39 2002 t
TopExp_Explorer EXP;
TopoDS_Shape PlaneSect = PlaneS.Shape();
EXP.Init(PlaneSect, TopAbs_WIRE);
OnFirstEdge, OnLastEdge);
if(!Data) {
-#ifdef DEB
- if (trc) cout << " No Extreme faces" << endl;
+#ifdef OCCT_DEBUG
+ if (trc) std::cout << " No Extreme faces" << std::endl;
#endif
myStatusError = BRepFeat_NoExtFace;
NotDone();
SliList.Append(FirstFace);
if(Sliding) { // sliding
-#ifdef DEB
- if (trc) cout << " Sliding" << endl;
+#ifdef OCCT_DEBUG
+ if (trc) std::cout << " Sliding" << std::endl;
#endif
- Standard_Boolean Sliding = Standard_False;
+ Sliding = Standard_False;
Handle(Geom_Surface) s = BRep_Tool::Surface(FirstFace);
if (s->DynamicType() ==
STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
// ---case of sliding : construction of the profile face
if(Sliding) {
-#ifdef DEB
- if (trc) cout << " still Sliding" << endl;
+#ifdef OCCT_DEBUG
+ if (trc) std::cout << " still Sliding" << std::endl;
#endif
TopoDS_Face Prof;
Standard_Boolean ProfileOK;
FirstEdge,LastEdge);
if (!ProfileOK) {
-#ifdef DEB
- cout << "Not computable" << endl;
- if (trc) cout << "Face profile not computable" << endl;
+#ifdef OCCT_DEBUG
+ if (trc)
+ {
+ std::cout << "Not computable" << std::endl;
+ std::cout << "Face profile not computable" << std::endl;
+ }
#endif
myStatusError = BRepFeat_NoFaceProf;
NotDone();
Sliding = Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
// Control if there is everything required to have the material at the proper side
if(falseside == Standard_False) {
-#ifdef DEB
- cout << "Verify plane and wire orientation" << endl;
+#ifdef OCCT_DEBUG
+ std::cout << "Verify plane and wire orientation" << std::endl;
#endif
myStatusError = BRepFeat_FalseSide;
NotDone();
pt = myLastPnt;
Standard_Real fpar = IntPar(cc, myFirstPnt);
Standard_Real lpar = IntPar(cc, pt);
- Handle(Geom_Curve) ccc;
if(fpar > lpar) {
- ccc = Handle(Geom_Curve)::DownCast(cc->Reversed());
- cc = ccc;
+ cc = cc->Reversed();
}
}
TopoDS_Edge ee1;
counter++;
}
else {
- Standard_Real f, l;
Handle(Geom_Curve) cc = BRep_Tool::Curve(E, f, l);
gp_Pnt pf = BRep_Tool::Pnt(TopExp::FirstVertex(E,Standard_True));
gp_Pnt pl = myLastPnt;
SlidMap.Clear();
if(Sliding && counter1 > counter) {
- TopTools_ListIteratorOfListOfShape it;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm;
TopExp_Explorer EX2(w, TopAbs_EDGE);
Standard_Integer ii = 0;
if(Sliding) {
TopoDS_Face F;
BB.MakeFace(F, myPln, myTol);
+ w.Closed (BRep_Tool::IsClosed (w));
BB.Add(F, w);
// BRepLib_MakeFace F(myPln->Pln(),w, Standard_True);
mySkface = F;
// ---Case without sliding : construction of the profile face
if(!Sliding) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
if (trc) {
- if (Modify) cout << " Sliding failure" << endl;
- cout << " no Sliding" << endl;
+ if (Modify) std::cout << " Sliding failure" << std::endl;
+ std::cout << " no Sliding" << std::endl;
}
#endif
TopoDS_Face Prof;
FirstEdge,LastEdge,OnFirstFace,OnLastFace);
if (!ProfileOK) {
-#ifdef DEB
- cout << "Not computable" << endl;
- if (trc) cout << " Face profile not computable" << endl;
+#ifdef OCCT_DEBUG
+ if (trc)
+ {
+ std::cout << "Not computable" << std::endl;
+ std::cout << " Face profile not computable" << std::endl;
+ }
#endif
myStatusError = BRepFeat_NoFaceProf;
NotDone();
Propagate(SliList, Prof, myFirstPnt, myLastPnt, falseside);
// Control if there is everything required to have the material at the proper side
if(falseside == Standard_False) {
-#ifdef DEB
- cout << "Verify plane and wire orientation" << endl;
+#ifdef OCCT_DEBUG
+ std::cout << "Verify plane and wire orientation" << std::endl;
#endif
myStatusError = BRepFeat_FalseSide;
NotDone();
TopoDS_Shape comp;
- BRep_Builder BB;
BB.MakeShell(TopoDS::Shell(comp));
for(; it.More(); it.Next()) {
BB.Add(comp, it.Value());
}
+ comp.Closed (BRep_Tool::IsClosed (comp));
mySUntil = comp;
void BRepFeat_MakeLinearForm::Add(const TopoDS_Edge& E,
const TopoDS_Face& F)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << "BRepFeat_MakeLinearForm::Add" << endl;
+ if (trc) std::cout << "BRepFeat_MakeLinearForm::Add" << std::endl;
#endif
if(mySlface.IsEmpty()) {
TopExp_Explorer exp;
}
}
if (!exp.More()) {
- Standard_ConstructionError::Raise();
+ throw Standard_ConstructionError();
}
if (!mySlface.IsBound(F)) {
void BRepFeat_MakeLinearForm::Perform()
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEAT();
- if (trc) cout << "BRepFeat_MakeLinearForm::Perform()" << endl;
+ if (trc) std::cout << "BRepFeat_MakeLinearForm::Perform()" << std::endl;
#endif
if(mySbase.IsNull() || mySkface.IsNull() || myPbase.IsNull()) {
-#ifdef DEB
- if (trc) cout << " Fields not initialized" << endl;
+#ifdef OCCT_DEBUG
+ if (trc) std::cout << " Fields not initialized" << std::endl;
#endif
myStatusError = BRepFeat_NotInitialized;
NotDone();
for(; exx.More(); exx.Next()) {
const TopoDS_Edge& e = TopoDS::Edge(exx.Current());
if(!myMap.IsBound(e)) {
-#ifdef DEB
- if (trc) cout << " Sliding face not in Base shape" << endl;
+#ifdef OCCT_DEBUG
+ if (trc) std::cout << " Sliding face not in Base shape" << std::endl;
#endif
myStatusError = BRepFeat_IncSlidFace;
NotDone();
SetGluedFaces(mySlface, theForm, myGluedF); // management of sliding faces
if(!myGluedF.IsEmpty() && !mySUntil.IsNull()) {
-#ifdef DEB
- cout << "The case is not computable" << endl;
- if (trc) cout << " Glued faces not empty and Until shape not null" << endl;
+#ifdef OCCT_DEBUG
+ if (trc)
+ {
+ std::cout << "The case is not computable" << std::endl;
+ std::cout << " Glued faces not empty and Until shape not null" << std::endl;
+ }
#endif
myStatusError = BRepFeat_InvShape;
NotDone();
const gp_Pnt& Lastpnt,
Standard_Boolean& falseside)
{
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Boolean trc = BRepFeat_GettraceFEATRIB();
- if (trc) cout << "BRepFeat_MakeLinearForm::Propagate" << endl;
+ if (trc) std::cout << "BRepFeat_MakeLinearForm::Propagate" << std::endl;
#endif
gp_Pnt Firstpoint = Firstpnt;
gp_Pnt Lastpoint = Lastpnt;
Standard_Boolean v1OK = Standard_False, v2OK= Standard_False;
TopoDS_Vertex v1, v2, v3, v4, ve1, ve2;
- //modified by NIZNHY-PKV Fri Mar 22 16:50:24 2002 f
- //BRepAlgo_Section sect (fac, CurrentFace, Standard_False);
BRepAlgoAPI_Section sect (fac, CurrentFace, Standard_False);
- //modified by NIZNHY-PKV Fri Mar 22 16:50:32 2002 t
sect.Approximation(Standard_True);
sect.Build();
TopoDS_Vertex Vprevious;
gp_Pnt ptprev;
- Standard_Real tvp, dp;
+ Standard_Real dp;
while (!(LastOK && FirstOK)) {
if (v1OK) {
Vprevious=v2;
ptprev=p2;
- tvp=t2;
}
else {
Vprevious=v1;
ptprev=p1;
- tvp=t1;
}
// find edge connected to v1 or v2:
}
}
- //modified by NIZNHY-PKV Fri Mar 22 16:50:53 2002 f
- //BRepAlgo_Section sectf (fac, CurrentFace, Standard_False);
BRepAlgoAPI_Section sectf (fac, CurrentFace, Standard_False);
- //modified by NIZNHY-PKV Fri Mar 22 16:51:03 2002 t
sectf.Approximation(Standard_True);
sectf.Build();
for (it.Initialize(ledg); it.More(); it.Next()) {
const TopTools_ListOfShape& gfac = thePrism.Shapes(it.Value());
if (gfac.Extent() != 1) {
-#ifdef DEB
- cout << "Pb SetGluedFace" << endl;
+#ifdef OCCT_DEBUG
+ std::cout << "Pb SetGluedFace" << std::endl;
#endif
}
theMap.Bind(gfac.First(),fac);