#include <CAM_Application.h>
#include <SUIT_Desktop.h>
#include <QListWidget.h>
+#include <HYDROGUI_ObjListBox.h>
HYDROGUI_ExportSinusXDlg::HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule, const QString& theTitle )
aLayout->setMargin( 5 );
aLayout->setSpacing( 5 );
- myQListW = new QListWidget(mainFrame());
+ QList<ObjectKind> anAllowedTypesToSave;
+ anAllowedTypesToSave.append(KIND_BATHYMETRY);
+ anAllowedTypesToSave.append(KIND_POLYLINEXY);
+ anAllowedTypesToSave.append(KIND_PROFILE);
- myQListW->setSelectionMode(QAbstractItemView::ExtendedSelection);
- aLayout->addWidget(myQListW, 0, 0, 1, 2);
+ myList = new HYDROGUI_ObjListBox( theModule, tr( "OBJECT_TO_EXPORT" ), anAllowedTypesToSave, mainFrame() );
+ aLayout->addWidget( myList, 0, 0 );
- myIncludeBtn = new QPushButton( tr( "INCLUDE" ) );
- myExcludeBtn = new QPushButton( tr( "EXCLUDE" ) );
- aLayout->addWidget(myIncludeBtn, 1, 0 );
- aLayout->addWidget(myExcludeBtn, 1, 1 );
-
- myExport = new QPushButton( tr( "EXPORT" ) );
+ myExportBtn = new QPushButton( tr( "EXPORT" ) );
QHBoxLayout* aBtnsLayout = qobject_cast<QHBoxLayout*>(buttonFrame()->layout());
- aBtnsLayout->addWidget( myExport, 0 );
+ aBtnsLayout->addWidget( myExportBtn, 0 );
aBtnsLayout->addWidget( myCancel, 0 );
aBtnsLayout->addStretch( 1 );
aBtnsLayout->addWidget( myHelp, 0 );
-
- //TODO connect
- //connect( myExport, SIGNAL( clicked() ), SLOT( onExport() ) );
- connect( myIncludeBtn, SIGNAL( clicked() ), SIGNAL( IncludeItems() ) );
- connect( myExcludeBtn, SIGNAL( clicked() ), SIGNAL( ExcludeItems() ) );
- myEnt2WIMap.clear();
+ connect( myExportBtn, SIGNAL( clicked() ), SIGNAL( ExportItems() ) );
}
{
}
-void HYDROGUI_ExportSinusXDlg::addItems(const HYDROData_SequenceOfObjects& theSelectedItems)
-{
- for (int i = 1; i <= theSelectedItems.Size(); i++)
- {
- QString anEntName = theSelectedItems.Value(i)->GetName();
- if (!myEnt2WIMap.contains(anEntName))
- {
- QListWidgetItem* aWI = new QListWidgetItem();
- aWI->setText(anEntName);
- myEnt2WIMap[anEntName] = aWI; ///TODO free this map
- myQListW->addItem(aWI);
- }
- }
- myQListW->update();
-}
-void HYDROGUI_ExportSinusXDlg::RemoveItems()
+HYDROData_SequenceOfObjects HYDROGUI_ExportSinusXDlg::GetSelectedEntities()
{
- for (int i = 0; i < myQListW->selectedItems().size(); i++)
- {
- QListWidgetItem* anItem = myQListW->selectedItems()[i];
- QMap<QString, QListWidgetItem*>::iterator aMapIt;
- for (aMapIt = myEnt2WIMap.begin(); aMapIt != myEnt2WIMap.end(); ++aMapIt)
- if (aMapIt.value() == anItem)
- {
- aMapIt = myEnt2WIMap.erase(aMapIt);
- delete anItem;
- //myQListW->takeItem(anItem);
- }
- else
- ++aMapIt;
- }
- myQListW->update();
-}
-
+ return myList->selectedObjects();
+}
\ No newline at end of file
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifndef HYDROGUI_ExportSinusXDlg_H
-#define HYDROGUI_ExportSinusXDlg_H
+#ifndef HYDROGUI_EXPORTSINUSXDLG_H
+#define HYDROGUI_EXPORTSINUSXDLG_H
#include "HYDROGUI_InputPanel.h"
#include <HYDROData_Entity.h>
class QPushButton;
class QListWidget;
class QListWidgetItem;
+class HYDROGUI_ObjListBox;
class HYDROGUI_ExportSinusXDlg : public HYDROGUI_InputPanel
public:
HYDROGUI_ExportSinusXDlg( HYDROGUI_Module* theModule, const QString& theTitle );
virtual ~HYDROGUI_ExportSinusXDlg();
- void addItems(const HYDROData_SequenceOfObjects& theSelectedItems);
- void RemoveItems();
+ HYDROData_SequenceOfObjects GetSelectedEntities();
signals:
- void IncludeItems();
- void ExcludeItems();
-
+ void ExportItems();
private:
- QPushButton* myExport;
- QPushButton* myIncludeBtn;
- QPushButton* myExcludeBtn;
- QListWidget* myQListW;
- QMap<QString, QListWidgetItem*> myEnt2WIMap;
+ HYDROGUI_ObjListBox* myList;
+ QPushButton* myExportBtn;
};
#include <HYDROData_PolylineXY.h>
#include <HYDROData_Profile.h>
#include <HYDROData_Entity.h>
+#include <HYDROGUI_ObjListBox.h>
+#include <QMessageBox>
HYDROGUI_ExportSinusXOp::HYDROGUI_ExportSinusXOp( HYDROGUI_Module* theModule )
HYDROGUI_InputPanel* HYDROGUI_ExportSinusXOp::createInputPanel() const
{
HYDROGUI_ExportSinusXDlg* aPanel = new HYDROGUI_ExportSinusXDlg( module(), getName() );
- connect( aPanel, SIGNAL( IncludeItems() ), SLOT( onIncludeItems() ) );
- connect( aPanel, SIGNAL( ExcludeItems() ), SLOT( onExcludeItems() ) );
+ connect( aPanel, SIGNAL( ExportItems() ), SLOT( onExportItems() ) );
return aPanel;
}
-void HYDROGUI_ExportSinusXOp::onIncludeItems()
+void HYDROGUI_ExportSinusXOp::onExportItems()
{
HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast<HYDROGUI_ExportSinusXDlg*>( inputPanel() );
if ( !aPanel )
return;
-
- HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( module() );
- HYDROData_SequenceOfObjects aSelectedItems;
-
- if ( aSeq.IsEmpty())
- return;
-
- for( int i = 1; i <= aSeq.Length(); i++ )
- {
- Handle_HYDROData_Entity anEnt = aSeq.Value( i );
- if (anEnt->IsKind( STANDARD_TYPE( HYDROData_Bathymetry)) ||
- anEnt->IsKind( STANDARD_TYPE( HYDROData_PolylineXY)) ||
- anEnt->IsKind( STANDARD_TYPE( HYDROData_Profile)) )
- aSelectedItems.Append(anEnt);
- }
-
- aPanel->addItems( aSelectedItems );
-
-}
-
-void HYDROGUI_ExportSinusXOp::onExcludeItems()
-{
- HYDROGUI_ExportSinusXDlg* aPanel = ::qobject_cast<HYDROGUI_ExportSinusXDlg*>( inputPanel() );
- if ( !aPanel )
- return;
- aPanel->RemoveItems( );
-
+ int T = aPanel->GetSelectedEntities().Size();
}