#include <ShapeFix_Shape.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <QColor>
-
+#include <BRepTopAdaptor_FClass2d.hxx>
HYDROData_ShapeFile::HYDROData_ShapeFile() : myHSHP(NULL)
{
TopoDS_Edge E;
int nParts = anObj->nParts;
gp_Pln pln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
- BRepBuilderAPI_MakeFace aFBuilder(pln);
//Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
//sfs->FixFaceTool()->FixOrientationMode() = 1;
-
+ TopTools_SequenceOfShape aWires;
for ( int i = 0 ; i < nParts ; i++ )
{
BRepBuilderAPI_MakeWire aBuilder;
aBuilder.Build();
W = TopoDS::Wire(aBuilder.Shape());
- W.Reverse();
- aFBuilder.Add(W);
+ W.Orientation(TopAbs_FORWARD);
+ BRepBuilderAPI_MakeFace aDB(pln, W);
+ TopoDS_Face aDummyFace = TopoDS::Face(aDB.Shape());
+ BRepTopAdaptor_FClass2d FClass(aDummyFace, Precision::PConfusion());
+ if ( i == 0 && FClass.PerformInfinitePoint() == TopAbs_OUT)
+ W.Reverse();
+ if ( i > 0 && FClass.PerformInfinitePoint() != TopAbs_IN)
+ W.Reverse();
+
+ aWires.Append(W);
}
+
+ BRepBuilderAPI_MakeFace aFBuilder(pln, TopoDS::Wire(aWires(1)));
+ for (int i = 2; i <= aWires.Length(); i++)
+ aFBuilder.Add(TopoDS::Wire(aWires(i)));
+ TopoDS_Face DF = TopoDS::Face(aFBuilder.Shape());
- aFBuilder.Build();
- TopoDS_Face DF = aFBuilder.Face();
BRepLib::BuildCurves3d(DF);
- bool IsInf = DF.Infinite();
if(!DF.IsNull())
{
//sfs->Init ( DF );