+ erasePreview();
+}
+
+void HYDROGUI_PolylineOp::startOperation()
+{
+ if( myCurve )
+ {
+ delete myCurve;
+ myCurve = 0;
+ }
+
+ HYDROGUI_Operation::startOperation();
+
+ HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
+ aPanel->reset();
+
+ if( myIsEdit )
+ myEditedObject = Handle(HYDROData_Polyline)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+ if( !myEditedObject.IsNull() )
+ {
+ int anIntDim = myEditedObject->GetDimension();
+ CurveCreator::Dimension aDim = CurveCreator::Dim3d;
+ if( anIntDim == 2 )
+ aDim = CurveCreator::Dim2d;
+ myCurve = new CurveCreator_Curve(aDim);
+ QList<PolylineSection> aPolylineData = myEditedObject->GetPolylineData();
+
+ CurveCreator_CurveEditor* anEdit = new CurveCreator_CurveEditor(myCurve);
+ for( int i = 0 ; i < aPolylineData.size() ; i++ ){
+ std::string aName = HYDROGUI_Tool::ToQString(aPolylineData[i].mySectionName).toStdString();
+ bool isClosed = aPolylineData[i].myIsClosed;
+ CurveCreator::Type aType = CurveCreator::Polyline;
+ if( aPolylineData[i].myType == PolylineSection::SECTION_SPLINE ){
+ aType = CurveCreator::BSpline;
+ }
+ CurveCreator::Coordinates aCoords;
+ for( int j = 0 ; j < aPolylineData[i].myCoords.size() ; j++ ){
+ aCoords.push_back(aPolylineData[i].myCoords[j]);
+ }
+ anEdit->addSection( aName, aType, isClosed, aCoords );
+ }
+ delete anEdit;
+ aPanel->setPolylineName( myEditedObject->GetName() );
+
+ }
+ else{
+ myCurve = new CurveCreator_Curve(CurveCreator::Dim2d);
+ aPanel->setCurve(myCurve);
+ QString aNewName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_POLYLINE_NAME" ) );
+ aPanel->setPolylineName(aNewName);
+ }
+ aPanel->setCurve(myCurve);
+
+ if( myAISCurve )
+ myAISCurve->setCurve(myCurve);
+
+ displayPreview();
+}
+
+void HYDROGUI_PolylineOp::abortOperation()
+{
+ erasePreview();
+
+ HYDROGUI_Operation::abortOperation();
+}
+
+void HYDROGUI_PolylineOp::commitOperation()
+{
+ erasePreview();
+
+ HYDROGUI_Operation::commitOperation();