+ else
+ {
+ aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject( KIND_POLYLINEXY ) );
+ }
+
+ if( aPolylineObj.IsNull() )
+ return false;
+
+ aPolylineObj->SetName( aPolylineName );
+
+ for ( int i = 0 ; i < myCurve->getNbSections() ; i++ )
+ {
+ TCollection_AsciiString aSectName = HYDROGUI_Tool::ToAsciiString( myCurve->getSectionName( i ).c_str() );
+ CurveCreator::SectionType aCurveType = myCurve->getSectionType( i );
+ bool aSectClosure = myCurve->isClosed( i );
+
+ HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE;
+
+ if ( aCurveType == CurveCreator::Spline )
+ aSectType = HYDROData_PolylineXY::SECTION_SPLINE;
+
+ aPolylineObj->AddSection( aSectName, aSectType, aSectClosure );
+
+ // Add the points fro section
+ CurveCreator::Coordinates aCurveCoords = myCurve->getPoints( i );
+
+ if ( aCurveCoords.size() <= 2 )
+ {
+ theErrorMsg = tr( "NUMBER_OF_SECTION_POINTS_INCORRECT" );
+ return false;
+ }
+
+ for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
+ {
+ HYDROData_PolylineXY::Point aSectPoint;
+
+ aSectPoint.SetX( aCurveCoords.at( k ) );
+ k++;
+ aSectPoint.SetY( aCurveCoords.at( k ) );
+
+ aPolylineObj->AddPoint( i, aSectPoint );
+ }
+ }
+
+ if ( !myIsEdit )
+ {
+ aPolylineObj->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
+ }
+
+ // Update the wire of polyline
+ aPolylineObj->Update();
+ module()->setIsToUpdate( aPolylineObj );
+
+ // the viewer should be release from the widget before the module update it
+ // because it has an opened local context and updated presentation should not be displayed in it
+ if ( aPanel )
+ aPanel->setOCCViewer( 0 );
+
+ theUpdateFlags = UF_Model;
+
+ // the polyline should be rebuild in all viewers, where it is displayed
+ theUpdateFlags |= UF_Viewer | UF_GV_Forced;
+ theUpdateFlags |= UF_OCCViewer | UF_OCC_Forced;
+ theUpdateFlags |= UF_VTKViewer;
+
+ size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
+ if ( anActiveViewId == 0 )
+ {
+ anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
+ }
+
+ if( !myIsEdit )
+ {
+ module()->setObjectVisible( anActiveViewId, aPolylineObj, true );
+ QString anEntry = HYDROGUI_DataObject::dataObjectEntry( aPolylineObj );
+ theBrowseObjectsEntries.append( anEntry );
+ }
+
+ return true;