X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ProfileOp.cxx;h=609bdafdf98cca622bbcfa9f42d153daee9234d9;hb=7810759dad7d7f4552ad1008af73112509256813;hp=a9a9cf2cdeb0a2280f2744e85ed1fe1c3ad9af33;hpb=1c6465288cda49e75392724ddc01aba7cfe4ef68;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx index a9a9cf2c..609bdafd 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx @@ -24,7 +24,7 @@ #include "HYDROGUI_ProfileDlg.h" #include "HYDROGUI_Tool.h" #include "HYDROGUI_UpdateFlags.h" - +#include #include "HYDROData_Document.h" #include "HYDROData_Profile.h" #include "CurveCreator_Profile.hxx" @@ -91,23 +91,36 @@ void HYDROGUI_ProfileOp::startOperation() 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 ); - CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( k, aCurveCoords ); - aPoints.push_back( aPosPoint ); + HYDROData_ProfileUZ::SectionType aSectType = aProfileUZ->GetSectionType( 0 ); + + 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(); } @@ -142,7 +155,8 @@ HYDROGUI_InputPanel* HYDROGUI_ProfileOp::createInputPanel() const } bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags, - QString& theErrorMsg ) + QString& theErrorMsg, + QStringList& theBrowseObjectsEntries ) { HYDROGUI_ProfileDlg* aPanel = ::qobject_cast( inputPanel() ); if ( !aPanel ) @@ -177,6 +191,10 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags, if( aProfileObj.IsNull() ) return false; + Handle(HYDROData_ProfileUZ) aProfileUZ = aProfileObj->GetProfileUZ(); + if ( aProfileUZ.IsNull() ) + return false; + aProfileObj->SetName(aProfileName); HYDROData_ProfileUZ::PointsList aProfileParamPoints; @@ -200,9 +218,34 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags, } 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 ); + + if ( !myIsEdit ) + { + aProfileObj->SetBorderColor( HYDROData_Profile::DefaultBorderColor() ); + } + + // At first we update the child u,z profile object + aProfileUZ->SetToUpdate( true ); + aProfileUZ->Update(); + + // And now we update our edited object aProfileObj->Update(); + module()->setIsToUpdate( aProfileObj ); theUpdateFlags = UF_Model; + if ( myIsEdit ) + theUpdateFlags |= UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; + else + { + QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aProfileObj ); + theBrowseObjectsEntries.append( anEntry ); + } + return true; }