+void HYDROGUI_LandCoverOp::onAddPolylines()
+{
+ HYDROGUI_LandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_LandCoverDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ // Add polylines selected in the module browser
+ Handle(HYDROData_PolylineXY) aPolyXY;
+ HYDROGUI_ListModel::Object2VisibleList aSelectedPolylines;
+ HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
+
+ if ( aSeq.IsEmpty() || !confirmPolylinesChange() )
+ return;
+
+ for( int anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
+ {
+ aPolyXY = Handle(HYDROData_PolylineXY)::DownCast( aSeq.Value( anIndex ));
+ if (!aPolyXY.IsNull())
+ aSelectedPolylines.append( HYDROGUI_ListModel::Object2Visible( aPolyXY, true ) );
+ }
+
+ if ( aPanel->includePolylines( aSelectedPolylines ) )
+ {
+ closePreview();
+ onCreatePreview( aPanel->getPolylineNames() );
+ }
+}
+
+void HYDROGUI_LandCoverOp::onRemovePolylines()
+{
+ // Remove selected polylines from the calculation case
+ HYDROGUI_LandCoverDlg* aPanel = ::qobject_cast<HYDROGUI_LandCoverDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
+
+ QStringList aSelectedList = aPanel->getSelectedPolylineNames();
+ if ( aSelectedList.isEmpty() || !confirmPolylinesChange() )
+ return;
+
+ HYDROGUI_ListModel::Object2VisibleList aSelectedPolylines;
+ for (int i = 0; i < aSelectedList.length(); i++)
+ {
+ Handle(HYDROData_PolylineXY) anObject = Handle(HYDROData_PolylineXY)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) ) );
+ if ( anObject.IsNull() )
+ continue;
+
+ aSelectedPolylines.append( HYDROGUI_ListModel::Object2Visible( anObject, true ) );
+ }
+
+ module()->update( UF_OCCViewer );
+
+ if ( aPanel->excludePolylines( aSelectedPolylines ) )
+ {
+ closePreview();
+ onCreatePreview( aPanel->getPolylineNames() );
+ }
+}
+