bool anIsSectionClosed = aPolylineXY->IsClosedSection( 0 );
HYDROData_IPolyline::SectionType aSectionType = aPolylineXY->GetSectionType( 0 );
+ NCollection_Sequence<Polyline3DPoint> aResPoints = GetProfilePoints3D();
+
+ TopoDS_Wire aResWire = HYDROData_PolylineXY::BuildWire( aSectionType, anIsSectionClosed, aResPoints );
+ SetTopShape( aResWire );
+ SetShape3D( aResWire );
+}
+
+HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetProfilePoints3D()
+{
+ Handle(HYDROData_PolylineXY) aPolylineXY = GetPolylineXY();
+ if ( aPolylineXY.IsNull() )
+ return Polyline3DPoints();
+
HYDROData_IPolyline::PointsList aPolylinePoints = aPolylineXY->GetPoints( 0 );
if ( aPolylinePoints.IsEmpty() )
- return;
+ return Polyline3DPoints();
Handle(HYDROData_ProfileUZ) aProfileUZ = GetProfileUZ();
aProfileUZ = GetChildProfileUZ();
if ( aProfileUZ.IsNull() )
- return;
+ return Polyline3DPoints();
HYDROData_IPolyline::PointsList aProfilePoints = aProfileUZ->GetPoints();
if ( aProfilePoints.IsEmpty() )
- return;
+ return NCollection_Sequence<HYDROData_Polyline3D::Polyline3DPoint>();
const HYDROData_IPolyline::Point& aFirstPoint = aPolylinePoints.First();
const HYDROData_IPolyline::Point& aLastPoint = aPolylinePoints.Last();
// Add last point as is
aResPoints.Append( Polyline3DPoint( aLastPoint.X(), aLastPoint.Y(), aLastParPoint.Y() ) );
- TopoDS_Wire aResWire = HYDROData_PolylineXY::BuildWire( aSectionType, anIsSectionClosed, aResPoints );
- SetTopShape( aResWire );
- SetShape3D( aResWire );
-}
+ return aResPoints;
+}
QColor HYDROData_Polyline3D::DefaultFillingColor() const
{
for (int i = 0; i < thePoly->NbSections(); i++)
{
anPartStart.push_back(x.size());
- HYDROData_PolylineXY::PointsList aPointList = thePoly->GetPoints(i);
+ HYDROData_PolylineXY::PointsList aPointList = thePoly->GetPoints(i, true);
for (int j = 1; j <= aPointList.Size(); j++)
{
gp_XY P = aPointList(j);
- theDocument->Transform(P, false);
+ //theDocument->Transform(P, false);
x.push_back( P.X());
y.push_back( P.Y());
}
if (thePoly->IsClosedSection(i))
{
gp_XY P = aPointList(1);
- theDocument->Transform(P, false);
+ //theDocument->Transform(P, false);
x.push_back( P.X());
y.push_back( P.Y());
}
}
- aSHPObj = SHPCreateObject( SHPT_ARC, -1, thePoly->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
+ aSHPObj = SHPCreateObject (SHPT_ARC, -1, thePoly->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], NULL, NULL );
SHPWriteObject( theShpHandle, -1, aSHPObj );
SHPDestroyObject( aSHPObj );
return 1;
SHPHandle theShpHandle,
Handle(HYDROData_Polyline3D) thePoly )
{
- SHPObject *aSHPObj;
+ SHPObject *aSHPObj;
std::vector<double> x, y, z;
std::vector<int> anPartStart;
+ anPartStart.push_back(0); //one section only
- for (int i = 0; i < thePoly->GetPolylineXY()->NbSections(); i++)
- if (thePoly->GetPolylineXY()->GetSectionType(i) == HYDROData_IPolyline::SECTION_SPLINE)
- return -1;
-
- for (int i = 0; i < thePoly->GetPolylineXY()->NbSections(); i++)
- {
- anPartStart.push_back(x.size());
- HYDROData_PolylineXY::PointsList aPointList = thePoly->GetPolylineXY()->GetPoints(i);
- for (int j = 1; j <= aPointList.Size(); j++)
- {
- gp_XY P = aPointList(j);
- theDocument->Transform(P, false);
- x.push_back( P.X());
- y.push_back( P.Y());
- z.push_back(thePoly->GetAltitudeObject()->GetAltitudeForPoint(gp_XY (aPointList(j).X(), aPointList(j).Y())));
- }
- if ( thePoly->GetPolylineXY()->IsClosedSection(i))
- {
- gp_XY P = aPointList(1);
- theDocument->Transform(P, false);
- x.push_back( P.X());
- y.push_back( P.Y());
- z.push_back(thePoly->GetAltitudeObject()->GetAltitudeForPoint(gp_XY (aPointList(1).X(), aPointList(1).Y())));
+ if (thePoly->GetPolylineXY()->GetSectionType(0) == HYDROData_IPolyline::SECTION_SPLINE)
+ return -1;
- }
+ HYDROData_Polyline3D::Polyline3DPoints aPointList3D = thePoly->GetProfilePoints3D();
+ for (int j = 1; j <= aPointList3D.Size(); j++)
+ {
+ const gp_XYZ& P = aPointList3D(j);
+ //theDocument->Transform(P, false);
+ x.push_back(P.X());
+ y.push_back(P.Y());
+ z.push_back(P.Z());
}
-
- aSHPObj = SHPCreateObject( SHPT_ARCZ, -1, thePoly->GetPolylineXY()->NbSections(), &anPartStart[0], NULL, x.size(), &x[0], &y[0], &z[0], NULL );
+ if ( thePoly->GetPolylineXY()->IsClosedSection(0))
+ {
+ const gp_XYZ& P = aPointList3D(1);
+ //theDocument->Transform(P, false);
+ x.push_back(P.X());
+ y.push_back(P.Y());
+ z.push_back(P.Z());
+ }
+
+ aSHPObj = SHPCreateObject( SHPT_ARCZ, -1, 1, &anPartStart[0], NULL, x.size(), &x[0], &y[0], &z[0], NULL );
SHPWriteObject( theShpHandle, -1, aSHPObj );
SHPDestroyObject( aSHPObj );
return 1;