X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_ProfileOp.cxx;h=bda67417e629b265e12c3a3345c31629ace59d38;hb=f34b90e9e4e02ba65419134d5d37a2e42aecfabf;hp=a9a9cf2cdeb0a2280f2744e85ed1fe1c3ad9af33;hpb=1c6465288cda49e75392724ddc01aba7cfe4ef68;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx index a9a9cf2c..bda67417 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx @@ -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(); } @@ -177,6 +190,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 +217,26 @@ 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; + theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer; return true; }