// Created on: 1999-06-17
// Created by: data exchange team
// Copyright (c) 1999-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 <ShapeConstruct.ixx>
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Geom_Conic.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <GeomConvert_ApproxCurve.hxx>
-#include <GeomConvert.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_Conic.hxx>
+#include <Geom2d_Curve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
-#include <Geom2dConvert_ApproxCurve.hxx>
#include <Geom2dConvert.hxx>
+#include <Geom2dConvert_ApproxCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_Conic.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_ElementarySurface.hxx>
+#include <Geom_OffsetCurve.hxx>
+#include <Geom_Plane.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_Surface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColgp_Array2OfPnt.hxx>
-#include <TColStd_Array2OfReal.hxx>
-#include <GeomConvert_ApproxSurface.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
-#include <Geom_OffsetCurve.hxx>
-#include <ShapeConstruct_Curve.hxx>
-#include <Precision.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <GeomAPI.hxx>
+#include <GeomConvert.hxx>
+#include <GeomConvert_ApproxCurve.hxx>
+#include <GeomConvert_ApproxSurface.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <gp_Pln.hxx>
#include <gp_Vec.hxx>
-#include <GeomAPI.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
+#include <Precision.hxx>
#include <ShapeAnalysis_Edge.hxx>
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-#include <Geom_Plane.hxx>
+#include <ShapeConstruct.hxx>
+#include <ShapeConstruct_Curve.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array2OfPnt.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_Array2OfReal.hxx>
#include <TopAbs_Orientation.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
//=======================================================================
//function : ConvertCurveToBSpline
//purpose :
//=======================================================================
-
Handle(Geom_BSplineCurve) ShapeConstruct::ConvertCurveToBSpline(const Handle(Geom_Curve)& C3D,
const Standard_Real First,
const Standard_Real Last,
if(C3D->IsKind(STANDARD_TYPE(Geom_Conic)))
MaxDeg = Min(MaxDeg,6);
- Handle(Geom_TrimmedCurve) tcurve = new Geom_TrimmedCurve(C3D,First,Last); //protection agains parabols ets
+ Handle(Geom_Curve) tcurve = new Geom_TrimmedCurve(C3D,First,Last); //protection agains parabols ets
try {
OCC_CATCH_SIGNALS
GeomConvert_ApproxCurve approx (tcurve, Tol3d, Continuity, MaxSegments, MaxDeg);
if ( approx.HasResult() )
- aBSpline = Handle(Geom_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline = approx.Curve();
else
aBSpline = GeomConvert::CurveToBSplineCurve(C3D,Convert_QuasiAngular);
}
- catch (Standard_Failure) {
-#ifdef DEB
- cout << "Warning: GeomConvert_ApproxSurface Exception: ";
- Standard_Failure::Caught()->Print(cout); cout << endl;
+ catch (Standard_Failure const& anException) {
+#ifdef OCCT_DEBUG
+ std::cout << "Warning: GeomConvert_ApproxSurface Exception: ";
+ anException.Print(std::cout); std::cout << std::endl;
#endif
+ (void)anException;
aBSpline = GeomConvert::CurveToBSplineCurve(C3D,Convert_QuasiAngular);
}
}
{
Handle(Geom2d_BSplineCurve) aBSpline2d;
if(C2D->IsKind(STANDARD_TYPE(Geom2d_Conic))) {
- Handle(Geom2d_TrimmedCurve) tcurve = new Geom2d_TrimmedCurve(C2D,First,Last); //protection agains parabols ets
+ Handle(Geom2d_Curve) tcurve = new Geom2d_TrimmedCurve(C2D,First,Last); //protection agains parabols ets
Geom2dConvert_ApproxCurve approx (tcurve, Tol2d, Continuity, MaxSegments, MaxDegree);
if ( approx.HasResult() )
- aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+ aBSpline2d = approx.Curve();
else
aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
}
Handle(Geom_BSplineCurve) bspl = ConvertCurveToBSpline(basis, VF, VL, Tol3d, cnt, MaxSegments, MaxDegree);
gp_Ax1 axis = revol->Axis();
Handle(Geom_SurfaceOfRevolution) newRevol = new Geom_SurfaceOfRevolution(bspl,axis);
-#ifdef DEB
- cout <<" Revolution on offset converted" << endl;
+#ifdef OCCT_DEBUG
+ std::cout <<" Revolution on offset converted" << std::endl;
#endif
S = newRevol;
}
}
- Handle(Geom_RectangularTrimmedSurface) aSurface = new Geom_RectangularTrimmedSurface(S,UF,UL,VF,VL);
+ Handle(Geom_Surface) aSurface = new Geom_RectangularTrimmedSurface(S,UF,UL,VF,VL);
Handle(Geom_BSplineSurface) errSpl;
for(Standard_Integer cnt = (Continuity > GeomAbs_C3 ? GeomAbs_C3: Continuity); cnt >= 0 ; ) {
try {
Standard_Boolean Done = anApprox.IsDone();
if (anApprox.MaxError() <= Tol3d && Done) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
Standard_Integer nbOfSpan = (anApprox.Surface()->NbUKnots()-1)*(anApprox.Surface()->NbVKnots()-1);
- cout << "\terror = " << anApprox.MaxError() << "\tspans = " << nbOfSpan << endl;
- cout << " Surface is aproximated with continuity " << (GeomAbs_Shape)cnt <<endl;
+ std::cout << "\terror = " << anApprox.MaxError() << "\tspans = " << nbOfSpan << std::endl;
+ std::cout << " Surface is aproximated with continuity " << (GeomAbs_Shape)cnt <<std::endl;
#endif
S = anApprox.Surface();
Handle(Geom_BSplineSurface) Bsc = Handle(Geom_BSplineSurface)::DownCast(S);
}
else {
if(anApprox.HasResult())
- errSpl = Handle(Geom_BSplineSurface)::DownCast(anApprox.Surface());
-#ifdef DEB
- cout << "\terror = " << anApprox.MaxError() <<endl;
+ errSpl = anApprox.Surface();
+#ifdef OCCT_DEBUG
+ std::cout << "\terror = " << anApprox.MaxError() <<std::endl;
#endif
break;
}
}
- catch (Standard_Failure) {
-#ifdef DEB
- cout << "Warning: GeomConvert_ApproxSurface Exception: try to decrease continuity ";
- Standard_Failure::Caught()->Print(cout); cout << endl;
+ catch (Standard_Failure const& anException) {
+#ifdef OCCT_DEBUG
+ std::cout << "Warning: GeomConvert_ApproxSurface Exception: try to decrease continuity ";
+ anException.Print(std::cout); std::cout << std::endl;
#endif
+ (void)anException;
if(cnt > 0) cnt--;
continue;
}
B.SameParameter(theEdge,Standard_False);
return (i <= edges->Length());
}
- catch ( Standard_Failure ) {
-#ifdef DEB
- cout<<"Error: ShapeConstruct::JoinPCurves Exception in GeomConvert_CompCurveToBSplineCurve: ";
- Standard_Failure::Caught()->Print(cout); cout<<endl;
+ catch ( Standard_Failure const& anException) {
+#ifdef OCCT_DEBUG
+ std::cout<<"Error: ShapeConstruct::JoinPCurves Exception in GeomConvert_CompCurveToBSplineCurve: ";
+ anException.Print(std::cout); std::cout<<std::endl;
#endif
+ (void)anException;
}
return Standard_False;
}