// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <BRepFill_Pipe.ixx>
-#include <Standard_ErrorHandler.hxx>
-
-#include <BRep_Tool.hxx>
+#include <Adaptor3d_CurveOnSurface.hxx>
#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepBuilderAPI_Copy.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
-#include <BRepLib_MakeVertex.hxx>
-#include <BRepTools_Substitution.hxx>
-
-#include <GeomFill_CorrectedFrenet.hxx>
-#include <GeomFill_Frenet.hxx>
-#include <GeomFill_DiscreteTrihedron.hxx>
-#include <GeomFill_CurveAndTrihedron.hxx>
-
+#include <BRepFill_Edge3DLaw.hxx>
+#include <BRepFill_LocationLaw.hxx>
+#include <BRepFill_Pipe.hxx>
#include <BRepFill_SectionPlacement.hxx>
#include <BRepFill_ShapeLaw.hxx>
-#include <BRepFill_Edge3DLaw.hxx>
#include <BRepFill_Sweep.hxx>
-
+#include <BRepLib.hxx>
+#include <BRepLib_MakeVertex.hxx>
+#include <BRepTools_Substitution.hxx>
+#include <Geom2dAdaptor_HCurve.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_OffsetCurve.hxx>
+#include <Geom_TrimmedCurve.hxx>
#include <GeomAbs_Shape.hxx>
-#include <TopExp.hxx>
+#include <GeomAdaptor_HSurface.hxx>
+#include <GeomFill_CorrectedFrenet.hxx>
+#include <GeomFill_CurveAndTrihedron.hxx>
+#include <GeomFill_DiscreteTrihedron.hxx>
+#include <GeomFill_Frenet.hxx>
+#include <gp_Pnt.hxx>
+#include <Precision.hxx>
+#include <ShapeUpgrade_RemoveLocations.hxx>
+#include <Standard_DomainError.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <StdFail_NotDone.hxx>
+#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
+#include <TColStd_DataMapOfIntegerInteger.hxx>
#include <TopAbs_ShapeEnum.hxx>
+#include <TopExp.hxx>
#include <TopoDS.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Solid.hxx>
#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Wire.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
-#include <TColStd_DataMapOfIntegerInteger.hxx>
-#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
-
-#include <Precision.hxx>
-#include <Standard_NotImplemented.hxx>
-
-#include <Geom_TrimmedCurve.hxx>
-#include <Geom_OffsetCurve.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <BRepBuilderAPI_Transform.hxx>
-#include <BRepBuilderAPI_Copy.hxx>
-#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <BRepLib.hxx>
-
-#include <Geom2dAdaptor_HCurve.hxx>
-#include <GeomAdaptor_HSurface.hxx>
-#include <Adaptor3d_CurveOnSurface.hxx>
-
-#include <ShapeUpgrade_RemoveLocations.hxx>
+#include <TopTools_SequenceOfShape.hxx>
#ifdef DRAW
#include <DBRep.hxx>
static Standard_Boolean Affich = 0;
#endif
+// ---------------------------------------------------------------------------------
+// static function: UpdateMap
+// purpose:
+// ---------------------------------------------------------------------------------
+static Standard_Boolean UpdateMap(const TopoDS_Shape& theKey,
+ const TopoDS_Shape& theValue,
+ TopTools_DataMapOfShapeListOfShape& theMap)
+{
+ if(!theMap.IsBound(theKey))
+ {
+ TopTools_ListOfShape thelist;
+ theMap.Bind(theKey, thelist);
+ }
+ TopTools_ListOfShape& aList = theMap.ChangeFind(theKey);
+ TopTools_ListIteratorOfListOfShape anIt(aList);
+ Standard_Boolean found = Standard_False;
+
+ for(; anIt.More(); anIt.Next())
+ {
+ if(theValue.IsSame(anIt.Value()))
+ {
+ found = Standard_True;
+ break;
+ }
+ }
+
+ if(!found)
+ aList.Append(theValue);
+
+ return !found;
+}
+
static void ReverseModifiedEdges(TopoDS_Shape& aShape,
TopTools_MapOfShape& Emap)
{
myLoc->Law(1)->D0(first, M, V);
fila.SetValues(M(1,1), M(1,2), M(1,3), V.X(),
M(2,1), M(2,2), M(2,3), V.Y(),
- M(3,1), M(3,2), M(3,3), V.Z(),
- 1.e-12, 1.e-14);
+ M(3,1), M(3,2), M(3,3), V.Z());
fila.Multiply(myTrsf);
TopLoc_Location LocFirst(fila);
}
ShapeUpgrade_RemoveLocations RemLoc;
+ RemLoc.SetRemoveLevel(TopAbs_COMPOUND);
RemLoc.Remove(myFirst);
myFirst = RemLoc.GetResult();
- TopLoc_Location theLoc = myFirst.Location();
- if (!theLoc.IsIdentity())
- {
- TopoDS_Shape NewMyFirst = BRepBuilderAPI_Copy(myFirst);
- RemLoc.Remove(NewMyFirst);
- NewMyFirst = RemLoc.GetResult();
- TopLoc_Location theIdentity;
- NewMyFirst.Location(theIdentity);
- myFirst = BRepBuilderAPI_Transform(NewMyFirst, theLoc.Transformation(), Standard_True);
- }
myLoc->Law(myLoc->NbLaw())->GetDomain(first, last);
myLoc->Law(myLoc->NbLaw())->D0(last,M, V);
// try { // Not good, but there are no other means to test SetValues
fila.SetValues(M(1,1), M(1,2), M(1,3), V.X(),
M(2,1), M(2,2), M(2,3), V.Y(),
- M(3,1), M(3,2), M(3,3), V.Z(),
- 1.e-12, 1.e-14);
+ M(3,1), M(3,2), M(3,3), V.Z());
fila.Multiply(myTrsf);
TopLoc_Location LocLast(fila);
if (! myLoc->IsClosed() || LocFirst != LocLast) {
RemLoc.Remove(myLast);
myLast = RemLoc.GetResult();
- theLoc = myLast.Location();
- if (!theLoc.IsIdentity())
- {
- TopoDS_Shape NewMyLast = BRepBuilderAPI_Copy(myLast);
- RemLoc.Remove(NewMyLast);
- NewMyLast = RemLoc.GetResult();
- TopLoc_Location theIdentity;
- NewMyLast.Location(theIdentity);
- myLast = BRepBuilderAPI_Transform(NewMyLast, theLoc.Transformation(), Standard_True);
- }
#if DRAW
if (Affich) {
return myShape;
}
+//=======================================================================
+//function : ErrorOnSurface
+//purpose :
+//=======================================================================
+
+Standard_Real BRepFill_Pipe::ErrorOnSurface() const
+{
+ return myErrorOnSurf;
+}
+
//=======================================================================
//function : FirstShape
return myLast;
}
+//=======================================================================
+//function : Generated
+//purpose :
+//=======================================================================
+void BRepFill_Pipe::Generated(const TopoDS_Shape& theShape,
+ TopTools_ListOfShape& theList)
+{
+ theList.Clear();
+
+ if (theShape.IsSame(myProfile))
+ theList.Append(myShape);
+ else
+ {
+ if (theShape.ShapeType() == TopAbs_FACE ||
+ theShape.ShapeType() == TopAbs_WIRE)
+ {
+ if(myGenMap.IsBound(theShape))
+ theList = myGenMap.Find(theShape);
+ }
+ else if (theShape.ShapeType() == TopAbs_EDGE)
+ {
+ TopoDS_Iterator itw(mySpine);
+ for (; itw.More(); itw.Next())
+ {
+ const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
+ const TopoDS_Shape& aFace = Face(aSpineEdge, TopoDS::Edge(theShape));
+ theList.Append(aFace);
+ }
+ }
+ else if (theShape.ShapeType() == TopAbs_VERTEX)
+ {
+ TopoDS_Iterator itw(mySpine);
+ for (; itw.More(); itw.Next())
+ {
+ const TopoDS_Edge& aSpineEdge = TopoDS::Edge(itw.Value());
+ const TopoDS_Shape& anEdge = Edge(aSpineEdge, TopoDS::Vertex(theShape));
+ theList.Append(anEdge);
+ }
+ }
+ }
+}
//=======================================================================
//function : Face
MkSw.Build( myReversedEdges, myTapes, myRails,
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
TopoDS_Shape aLocalShape = MkSw.Shape();
+ myErrorOnSurf = MkSw.ErrorOnSurface();
return TopoDS::Wire(aLocalShape);
// return TopoDS::Wire(MkSw.Shape());
}
B.MakeShell(TopoDS::Shell(result));
B.MakeWire(W);
B.Add(W, S);
- W.Closed(S.Closed());
+ W.Closed(BRep_Tool::IsClosed(S));
TheS = W;
if (!FirstShape.IsNull()) {
B.MakeWire(W);
B.Add(W, FirstShape);
- W.Closed(FirstShape.Closed());
+ W.Closed(BRep_Tool::IsClosed(FirstShape));
TheFirst = W;
}
if (!LastShape.IsNull()) {
B.MakeWire(W);
B.Add(W, LastShape);
- W.Closed(LastShape.Closed());
+ W.Closed(BRep_Tool::IsClosed(LastShape));
TheLast = W;
}
+ result.Closed (BRep_Tool::IsClosed (result));
break;
}
if ( !mySpine.Closed() && !TheFirst.IsNull()) {
B.Add(result, TheFirst.Reversed());
}
+ result.Closed (BRep_Tool::IsClosed (result));
break;
}
MkSw.Build( myReversedEdges, myTapes, myRails,
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
result = MkSw.Shape();
+ UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
+ myErrorOnSurf = MkSw.ErrorOnSurface();
Handle(TopTools_HArray2OfShape) aSections = MkSw.Sections();
MkSw.Build( myReversedEdges, myTapes, myRails,
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
result = MkSw.Shape();
+ UpdateMap(TheS.Located(myProfile.Location()), result, myGenMap);
+ myErrorOnSurf = MkSw.ErrorOnSurface();
//Correct <myFirst> and <myLast>
ReverseModifiedEdges(myFirst, myReversedEdges);
ReverseModifiedEdges(myLast, myReversedEdges);
BS.Add(solid,TopoDS::Shell(aLocalShape));
// BS.Add(solid,TopoDS::Shell(result.Reversed()));
}
+ UpdateMap(TheS.Located(myProfile.Location()), solid, myGenMap);
return solid;
}
else {
case TopAbs_WIRE :
{
- Standard_Integer ii = InitialLength+1;
Handle(BRepFill_ShapeLaw) Section =
- new (BRepFill_ShapeLaw) (TopoDS::Wire(S), Standard_False);
- InitialLength += Section->NbLaw();
-
- for (; (ii<=InitialLength) && (!result); ii++) {
- if (E.IsSame(Section->Edge(ii)) ) result = ii;
+ new (BRepFill_ShapeLaw) (TopoDS::Wire(S), Standard_False);
+ Standard_Integer NbLaw = Section->NbLaw();
+
+ for (Standard_Integer ii = 1; (ii<=NbLaw) && (!result); ii++) {
+ if (E.IsSame(Section->Edge(ii)) ) result = InitialLength + ii;
}
+ InitialLength += NbLaw;
break;
}
C->DynamicType() == STANDARD_TYPE(Geom_OffsetCurve))
{
if (C->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve))
- C = (*((Handle(Geom_TrimmedCurve)*)&C))->BasisCurve();
+ C = Handle(Geom_TrimmedCurve)::DownCast (C)->BasisCurve();
if (C->DynamicType() == STANDARD_TYPE(Geom_OffsetCurve))
- C = (*((Handle(Geom_OffsetCurve)*)&C))->BasisCurve();
+ C = Handle(Geom_OffsetCurve)::DownCast (C)->BasisCurve();
}
if (C->DynamicType() == STANDARD_TYPE(Geom_BSplineCurve))
{
- const Handle(Geom_BSplineCurve)& BC = *((Handle(Geom_BSplineCurve)*)&C);
+ Handle(Geom_BSplineCurve) BC (Handle(Geom_BSplineCurve)::DownCast (C));
Standard_Integer NbKnots = BC->NbKnots();
Standard_Integer RealNbKnots = NbKnots;
if (first > BC->FirstParameter())