- }
-
- Handle(HYDROData_Profile) aProfileObj;
- if( myIsEdit ){
- aProfileObj = myEditedObject;
- }
- else{
- aProfileObj = Handle(HYDROData_Profile)::DownCast( doc()->CreateObject( KIND_PROFILE ) );
- }
-
- if( aProfileObj.IsNull() )
- return false;
-
- Handle(HYDROData_ProfileUZ) aProfileUZ = aProfileObj->GetProfileUZ();
- if ( aProfileUZ.IsNull() )
- return false;
-
- aProfileObj->SetName(aProfileName);
-
- HYDROData_ProfileUZ::PointsList aProfileParamPoints;
-
- CurveCreator::Coordinates aCurveCoords = myProfile->getPoints( 0 );
- if ( aCurveCoords.size() <= 2 )
- {
- theErrorMsg = tr( "NUMBER_OF_PROFILE_POINTS_INCORRECT" );
- return false;
- }
-
- for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
- {
- HYDROData_ProfileUZ::Point aProfileParamPoint;
-
- aProfileParamPoint.SetX( aCurveCoords.at( k ) );
- k++;
- aProfileParamPoint.SetY( aCurveCoords.at( k ) );
-
- aProfileParamPoints.Append( aProfileParamPoint );
- }
- 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;