#include <QColor>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <TopExp.hxx>
+#include <OSD_Timer.hxx>
+#include <BRepLib_MakeVertex.hxx>
+#include <NCollection_List.hxx>
+#include <GC_MakeSegment.hxx>
+#include <BRep_Builder.hxx>
#ifdef WIN32
#pragma warning( disable: 4996 )
#endif
+//SHP->TFaces (Import)
+#define OSD_TIMER
+
HYDROData_ShapeFile::HYDROData_ShapeFile() : myHSHP(NULL)
{
}
int nParts = anObj->nParts;
gp_Pln pln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
- //Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
- //sfs->FixFaceTool()->FixOrientationMode() = 1;
TopTools_SequenceOfShape aWires;
for ( int i = 0 ; i < nParts ; i++ )
{
else
EndIndex = anObj->nVertices;
- for ( int k = StartIndex; k < EndIndex - 1 ; k++ )
+ NCollection_List<TopoDS_Vertex> aVertices;
+ gp_Pnt FP (anObj->padfX[StartIndex], anObj->padfY[StartIndex], 0);
+ TopoDS_Vertex V = BRepLib_MakeVertex(FP).Vertex();
+ aVertices.Append(V);
+
+ for ( int k = StartIndex + 1; k < EndIndex; k++ )
{
- gp_Pnt P1 (anObj->padfX[k], anObj->padfY[k], 0);
- gp_Pnt P2 (anObj->padfX[k+1], anObj->padfY[k+1], 0);
+ gp_Pnt P1 (anObj->padfX[k - 1], anObj->padfY[k-1], 0); //prev point
+ gp_Pnt P2 (anObj->padfX[k], anObj->padfY[k], 0); //current point
if (P1.Distance(P2) < Precision::Confusion())
continue;
- BRepBuilderAPI_MakeEdge aMakeEdge(P1, P2);
- aBuilder.Add(TopoDS::Edge(aMakeEdge.Shape()));
+ TopoDS_Vertex V = BRepLib_MakeVertex(P2).Vertex();
+ Handle_Geom_TrimmedCurve aTC = GC_MakeSegment(P1,P2).Value();
+ TopoDS_Edge E = BRepLib_MakeEdge(aTC, aVertices.Last(), V).Edge();
+ aVertices.Append(V);
+ aBuilder.Add(E);
}
aBuilder.Build();
aFBuilder.Add(TopoDS::Wire(aWires(i)));
F = TopoDS::Face(aFBuilder.Shape());
- BRepLib::BuildCurves3d(F);
}
int HYDROData_ShapeFile::ImportPolygons(const QString theFileName, QStringList& thePolygonsList, TopTools_SequenceOfShape& theFaces, int& theShapeTypeOfFile)
TopoDS_Face aF;
if (myHSHP->nShapeType == 5)
{
+#ifdef OSD_TIMER
+ OSD_Timer timer;
+ timer.Start();
+#endif
for (size_t i = 0; i < mySHPObjects.size(); i++)
{
ReadSHPPolygon(mySHPObjects[i], i, aF);
theFaces.Append(aF);
}
+#ifdef OSD_TIMER
+ timer.Stop();
+ timer.Show();
+#endif
return 1;
}
else