virtual bool setClosed( const int theISection,
const bool theIsClosed );
-
- //! For internal use only! Undo/Redo are not used here.
- virtual bool setSectionTypeInternal( const int theISection,
- const CurveCreator::SectionType theType );
- /**
- * Set type of the specified section (or all sections
- * if \a theISection is -1).
- */
- virtual bool setSectionType( const int theISection,
- const CurveCreator::SectionType theType );
-
-
/***********************************************/
/*** Point methods ***/
/***********************************************/
#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include <TDataStd_BooleanList.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_IntegerList.hxx>
#include <TDataStd_RealList.hxx>
#include <TopoDS_Shape.hxx>
HYDROData_ProfileUZ::SectionType HYDROData_ProfileUZ::GetSectionType( const int /*theSectionIndex*/ ) const
{
- return SECTION_POLYLINE;
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList, false );
+ if ( aTypesList.IsNull() || aTypesList->IsEmpty() )
+ return SECTION_POLYLINE;
+
+ return (SectionType)aTypesList->First();
}
void HYDROData_ProfileUZ::SetSectionType( const int /*theSectionIndex*/,
- const SectionType /*theSectionType*/ )
+ const SectionType theSectionType )
{
+ Handle(TDataStd_ExtStringList) aNamesList;
+ Handle(TDataStd_IntegerList) aTypesList;
+ Handle(TDataStd_BooleanList) aClosuresList;
+ getSectionsLists( aNamesList, aTypesList, aClosuresList );
+ if ( aTypesList.IsNull() )
+ return;
+
+ // Refill the existing list
+ aTypesList->Clear();
+ aTypesList->Append( theSectionType );
}
bool HYDROData_ProfileUZ::IsClosedSection( const int /*theSectionIndex*/ ) const
QString aProfileName;
if( !myEditedObject.IsNull() )
{
- CurveCreator::Coordinates aCurveCoords;
- CurveCreator::SectionsMap aSectionsMap;
-
- HYDROData_ProfileUZ::PointsList aSectPointsList = myEditedObject->GetParametricPoints();
- CurveCreator::PosPointsList aPoints;
- for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+ Handle(HYDROData_ProfileUZ) aProfileUZ = myEditedObject->GetProfileUZ( false );
+ if ( !aProfileUZ.IsNull() )
{
- const HYDROData_ProfileUZ::Point& aSectPoint = aSectPointsList.Value( k );
- aCurveCoords.clear();
- aCurveCoords.push_back( aSectPoint.X() );
- aCurveCoords.push_back( aSectPoint.Y() );
+ CurveCreator::Coordinates aCurveCoords;
+ CurveCreator::SectionsMap aSectionsMap;
+
+ HYDROData_ProfileUZ::PointsList aSectPointsList = aProfileUZ->GetPoints();
+ CurveCreator::PosPointsList aPoints;
+ for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+ {
+ const HYDROData_ProfileUZ::Point& aSectPoint = aSectPointsList.Value( k );
+ aCurveCoords.clear();
+ aCurveCoords.push_back( aSectPoint.X() );
+ aCurveCoords.push_back( aSectPoint.Y() );
+
+ CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( k, aCurveCoords );
+ aPoints.push_back( aPosPoint );
+ }
+
+ aSectionsMap[0] = aPoints;
+ myProfile->addPointsInternal( aSectionsMap );
+
+ HYDROData_ProfileUZ::SectionType aSectType = aProfileUZ->GetSectionType( 0 );
- CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( k, aCurveCoords );
- aPoints.push_back( aPosPoint );
+ CurveCreator::SectionType aCurveType = CurveCreator::Polyline;
+ if( aSectType == HYDROData_ProfileUZ::SECTION_SPLINE )
+ aCurveType = CurveCreator::Spline;
+
+ myProfile->setSectionType( 0, aCurveType );
}
- aSectionsMap[0] = aPoints;
- myProfile->addPointsInternal( aSectionsMap );
aProfileName = myEditedObject->GetName();
}
if( aProfileObj.IsNull() )
return false;
+ Handle(HYDROData_ProfileUZ) aProfileUZ = aProfileObj->GetProfileUZ();
+ if ( aProfileUZ.IsNull() )
+ return false;
+
aProfileObj->SetName(aProfileName);
HYDROData_ProfileUZ::PointsList aProfileParamPoints;
}
aProfileObj->SetParametricPoints( aProfileParamPoints );
+ HYDROData_ProfileUZ::SectionType aSectType = HYDROData_ProfileUZ::SECTION_POLYLINE;
+ if ( myProfile->getSectionType( 0 ) == CurveCreator::Spline )
+ aSectType = HYDROData_ProfileUZ::SECTION_SPLINE;
+
+ aProfileUZ->SetSectionType( 0, aSectType );
+
aProfileObj->Update();
theUpdateFlags = UF_Model;