-// File: IGESControl_IGESBoundary.cxx
-// Created: Sat Feb 5 16:35:04 2000
-// Author: data exchange team
-// <det@kinox>
+// Created on: 2000-02-05
+// Created by: data exchange team
+// Copyright (c) 2000-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// 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.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
//06.01.99 pdn renaming ShapeFix_Wire::FixLittle to ShapeFix_Wire::FixSmall
//:n1 abv 20.01.99: BUC60328.rle (loopback): call FixSmall with Max(1.,preci)
//S4181 pdn 15.04.99 implementing of reading IGES elementary surfaces. (instead of shift, reverce and
//scale factors the transformation matrix and scale factor used)
-#include <IGESControl_IGESBoundary.ixx>
-#include <TColStd_HSequenceOfTransient.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Plane.hxx>
#include <GeomAdaptor_Curve.hxx>
-#include <Precision.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Wire.hxx>
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-#include <ShapeBuild_Edge.hxx>
-#include <ShapeAnalysis_Wire.hxx>
-#include <ShapeAnalysis_ShapeTolerance.hxx>
-#include <ShapeFix_Edge.hxx>
-#include <ShapeFix_Wire.hxx>
-#include <ShapeFix_ShapeTolerance.hxx>
+#include <IGESControl_IGESBoundary.hxx>
+#include <IGESData_IGESEntity.hxx>
+#include <IGESGeom_BSplineCurve.hxx>
#include <IGESToBRep.hxx>
+#include <IGESToBRep_CurveAndSurface.hxx>
#include <IGESToBRep_TopoCurve.hxx>
-#include <Message_Msg.hxx>
#include <Interface_Static.hxx>
+#include <Message_Msg.hxx>
+#include <Precision.hxx>
#include <ShapeAlgo.hxx>
#include <ShapeAlgo_AlgoContainer.hxx>
#include <ShapeAlgo_ToolContainer.hxx>
-#include <IGESGeom_BSplineCurve.hxx>
-
+#include <ShapeAnalysis_ShapeTolerance.hxx>
+#include <ShapeAnalysis_Wire.hxx>
+#include <ShapeBuild_Edge.hxx>
+#include <ShapeExtend_WireData.hxx>
+#include <ShapeFix_Edge.hxx>
+#include <ShapeFix_ShapeTolerance.hxx>
+#include <ShapeFix_Wire.hxx>
+#include <Standard_Type.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
//=======================================================================
//function : IGESControl_IGESBoundary
//purpose :
//=======================================================================
-
IGESControl_IGESBoundary::IGESControl_IGESBoundary() : IGESToBRep_IGESBoundary()
{
}
}
}
+//=======================================================================
+//function : Connect
+//purpose : Connects theNextWD to theWD using theSAW.
+// First, connects edges of theNextWD by calling ShapeFix_Wire::FixConnected(). This
+// is necessary when theNextWD was built using multiple curves from the Composite
+// Curve (as ShapeExtend_WireData::Wire() would otherwise produce a wrong
+// disconnected TopoDS_Wire).
+// FixConnected() will only update the edges resulting from different composite
+// curve segments. Edges resulting from splitting C0 curve will already be
+// connected.
+//=======================================================================
+static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
+ const Handle(ShapeExtend_WireData)& theWD,
+ const Handle(ShapeExtend_WireData)& theNextWD,
+ const Standard_Boolean theConnectNextWD,
+ const Standard_Real theMaxTol,
+ Standard_Real& theDistMin,
+ Standard_Boolean& theReverseWD,
+ Standard_Boolean& theReverseNextWD)
+{
+ theSAW->Load (theWD);
+ if (theConnectNextWD) {
+ Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
+ sfw->Load (theNextWD);
+ sfw->ClosedWireMode() = Standard_False; //internal connections are enough
+ sfw->FixConnected();
+ }
+ return ShapeAlgo::AlgoContainer()->ConnectNextWire (theSAW, theNextWD,
+ theMaxTol, theDistMin, theReverseWD, theReverseNextWD);
+}
+
//=======================================================================
//function : Transfer
//purpose :
else if (( surfcurv == -3 && len3d > 0) || len2d == 0)
GTranslate2d = Standard_False;
- if (GTranslate3d && GTranslate2d)
+ if (GTranslate3d && GTranslate2d) {
//Setting preference in the case of inconsitency between 3D and 2D
if (surfcurv == 2) Preferred3d = Standard_False;
else if (surfcurv == 3) Preferred2d = Standard_False;
else if (myfilepreference == 2) Preferred3d = Standard_False;
else if (myfilepreference == 3) Preferred2d = Standard_False;
else Preferred3d = Standard_False;
-
+ }
if (GTranslate3d && GTranslate2d && len3d != len2d) {
GTranslate3d = Preferred3d;
GTranslate2d = Preferred2d;
TopoDS_Edge edge3d = Lsewd3d->Edge (iedge), edge2d = Lsewd2d->Edge (iedge);
if (!IGESToBRep::TransferPCurve (edge2d, edge3d, myface)) continue;
if (sfe->FixReversed2d (edge3d, myface)) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Warning: IGESToBRep_IGESBoundary: 2D curve of edge was reversed" << endl;
#endif
}
Standard_Real maxdev = BRep_Tool::Tolerance (edge3d);
//pdn 08.04.99 S4135 recomputing only if deviation is greater than maxtol
if (maxdev > maxtol) { //:e2
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Warning: IGESToBRep_IGESBoundary: Deviation = " << maxdev << endl;
#endif
ShapeFix_ShapeTolerance().SetTolerance (edge3d, Precision::Confusion());
for (Standard_Integer ie = 1; ie <= iedge; ie++)
ShapeBuild_Edge().RemovePCurve (Lsewd3d->Edge (ie), myface);
if (Preferred3d) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 2D is ignored" << endl;
#endif
}
else {
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Warning: IGESToBRep_IGESBoundary: 3D and 2D curves are inconsistent; 3D is ignored" << endl;
#endif
Lsewd = Lsewd2d;
}
okCurve = okCurve && ShapeAlgo::AlgoContainer()->ConnectNextWire (saw, Lsewd, maxtol, distmin, revsewd, revnextsewd);
if (!okCurve) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Warning: IGESToBRep_IGESBoundary: Curves " << i - 1 << " and " << i << " cannot be connected" << endl;
#endif
Gsewd3d = new ShapeExtend_WireData;
}
if (number > 1) {
- saw->Load (mysewd);
- okCurve = okCurve &&
- ShapeAlgo::AlgoContainer()->ConnectNextWire (saw, Gsewd, maxtol,
- distmin, revsewd, revnextsewd);
- saw3d->Load (mysewd3d);
- okCurve3d = okCurve3d &&
- ShapeAlgo::AlgoContainer()->ConnectNextWire (saw3d, Gsewd3d, maxtol,
- distmin, revsewd, revnextsewd);
- saw2d->Load (mysewd2d);
- okCurve2d = okCurve2d &&
- ShapeAlgo::AlgoContainer()->ConnectNextWire (saw2d, Gsewd2d, maxtol,
- distmin, revsewd, revnextsewd);
+ okCurve = okCurve && Connect (saw, mysewd, Gsewd, (len3d > 1) || (len2d > 1), maxtol,
+ distmin, revsewd, revnextsewd);
+ okCurve3d = okCurve3d && Connect (saw3d, mysewd3d, Gsewd3d, len3d > 1, maxtol,
+ distmin, revsewd, revnextsewd);
+ okCurve2d = okCurve2d && Connect (saw2d, mysewd2d, Gsewd2d, len2d > 1, maxtol,
+ distmin, revsewd, revnextsewd);
}
else {
mysewd = Gsewd;