+HYDROGUI_InputPanel* HYDROGUI_PolylineOp::createInputPanel() const
+{
+ HYDROGUI_PolylineDlg* aDlg = new HYDROGUI_PolylineDlg( module(), getName() );
+ connect( aDlg, SIGNAL( selectionChanged() ), this, SLOT( onEditorSelectionChanged() ) );
+ return aDlg;
+}
+
+bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
+ QString& theErrorMsg )
+{
+ HYDROGUI_PolylineDlg* aPanel = (HYDROGUI_PolylineDlg*)inputPanel();
+
+ int aStudyId = module()->getStudyId();
+ bool aHasDoc = HYDROData_Document::HasDocument(aStudyId);
+ Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( aStudyId );
+ if( aDocument.IsNull() )
+ return false;
+
+ Handle(HYDROData_Polyline) aPolylineObj;
+ if( myIsEdit ){
+ aPolylineObj = myEditedObject;
+ }
+ else{
+ aPolylineObj = Handle(HYDROData_Polyline)::DownCast( aDocument->CreateObject( KIND_POLYLINE ) );
+
+ //double aZValue = double( ++ZValueIncrement ) * 1e-2; // empiric value, to be revised
+ //aPolylineObj->SetZValue( aZValue );
+ }
+
+ if( aPolylineObj.IsNull() )
+ return false;
+
+ QString aPolylineName = aPanel->getPolylineName();
+ aPolylineObj->SetName(aPolylineName);
+ int aDimInt = 3;
+ if( myCurve->getDimension() == CurveCreator::Dim2d )
+ aDimInt = 2;
+ aPolylineObj->SetDimension(aDimInt);
+ QList<PolylineSection> aPolylineData;
+ for( int i=0 ; i < myCurve->getNbSections() ; i++ ){
+ PolylineSection aSect;
+ aSect.mySectionName = HYDROGUI_Tool::ToExtString( QString::fromLocal8Bit(myCurve->getSectionName(i).c_str()));
+ aSect.myIsClosed = myCurve->isClosed(i);
+ aSect.myType = PolylineSection::SECTION_POLYLINE;
+ if( myCurve->getType(i) == CurveCreator::BSpline ){
+ aSect.myType = PolylineSection::SECTION_SPLINE;
+ }
+ CurveCreator::Coordinates aCoords = myCurve->getPoints(i);
+ for( int j = 0 ; j < aCoords.size() ; j++ ){
+ aSect.myCoords << aCoords.at(j);
+ }
+ aPolylineData << aSect;
+ }
+ aPolylineObj->SetPolylineData(aPolylineData);
+
+ theUpdateFlags = UF_Model;
+ module()->setObjectVisible( HYDROGUI_Tool::GetActiveGraphicsViewId( module() ), aPolylineObj, true );
+ return true;
+}
+