: HYDROGUI_Wizard( theModule, theTitle )
{
addPage( createObjectsPage() );
+ addPage( createGroupsPage() );
addPage( createZonesPage() );
}
SIGNAL( boundarySelected( const QString & ) ) );
myGeomObjects = new QListWidget( aPage );
- myGeomObjects->setSelectionMode( QListWidget::SingleSelection );
+ myGeomObjects->setSelectionMode( QListWidget::ExtendedSelection );
myGeomObjects->setEditTriggers( QListWidget::NoEditTriggers );
myGeomObjects->setViewMode( QListWidget::ListMode );
myGeomObjects->setSortingEnabled( true );
myAvailableGeomObjects = new QListWidget( aPage );
- myAvailableGeomObjects->setSelectionMode( QListWidget::SingleSelection );
+ myAvailableGeomObjects->setSelectionMode( QListWidget::ExtendedSelection );
myAvailableGeomObjects->setEditTriggers( QListWidget::NoEditTriggers );
myAvailableGeomObjects->setViewMode( QListWidget::ListMode );
myAvailableGeomObjects->setSortingEnabled( true );
- connect( myGeomObjects, SIGNAL( currentTextChanged( const QString & ) ),
- SIGNAL( objectSelected( const QString & ) ) );
+ connect( myGeomObjects, SIGNAL( itemSelectionChanged() ),
+ SIGNAL( objectsSelected() ) );
QFrame* anObjectsFrame = new QFrame( aPage );
QGridLayout* anObjsLayout = new QGridLayout( anObjectsFrame );
return aPage;
}
+QWizardPage* HYDROGUI_CalculationDlg::createGroupsPage() {
+ QWizardPage* aPage = new QWizardPage( mainFrame() );
+ QFrame* aFrame = new QFrame( aPage );
+
+ myGroups = new QListWidget( aPage );
+ myGroups->setSelectionMode( QListWidget::ExtendedSelection );
+ myGroups->setEditTriggers( QListWidget::NoEditTriggers );
+ myGroups->setViewMode( QListWidget::ListMode );
+ myGroups->setSortingEnabled( true );
+
+ myAvailableGroups = new QListWidget( aPage );
+ myAvailableGroups->setSelectionMode( QListWidget::ExtendedSelection );
+ myAvailableGroups->setEditTriggers( QListWidget::NoEditTriggers );
+ myAvailableGroups->setViewMode( QListWidget::ListMode );
+ myAvailableGroups->setSortingEnabled( true );
+
+ connect( myGroups, SIGNAL( itemSelectionChanged() ),
+ SIGNAL( groupsSelected() ) );
+
+ QFrame* aGroupsFrame = new QFrame( aPage );
+ QGridLayout* aGroupsLayout = new QGridLayout( aGroupsFrame );
+ aGroupsLayout->setMargin( 5 );
+ aGroupsLayout->setSpacing( 5 );
+ aGroupsFrame->setLayout( aGroupsLayout );
+
+ QFrame* aBtnsFrame = new QFrame( aGroupsFrame );
+ QVBoxLayout* aBtnsLayout = new QVBoxLayout( aBtnsFrame );
+ aBtnsLayout->setMargin( 5 );
+ aBtnsLayout->setSpacing( 5 );
+ aBtnsFrame->setLayout( aBtnsLayout );
+ QPushButton* anAddBtn = new QPushButton( tr("INCLUDE"), aBtnsFrame );
+ QPushButton* aRemoveBtn = new QPushButton( tr("EXCLUDE"), aBtnsFrame );
+
+ // Fill the butons frame with two buttons
+ aBtnsLayout->addWidget( anAddBtn );
+ aBtnsLayout->addWidget( aRemoveBtn );
+ aBtnsLayout->addStretch( 1 );
+
+ QLabel* anIncludedLabel = new QLabel( tr( "INCLUDED_GROUPS" ), aGroupsFrame );
+ QLabel* anAvailableLabel = new QLabel( tr( "AVAILABLE_GROUPS" ), aGroupsFrame );
+
+ // Fill the objects frame with two lists, two labels and with buttons frame
+ aGroupsLayout->addWidget( anAvailableLabel, 0, 0, Qt::AlignHCenter );
+ aGroupsLayout->addWidget( anIncludedLabel, 0, 2, Qt::AlignHCenter );
+ aGroupsLayout->addWidget( myAvailableGroups, 1, 0, Qt::AlignHCenter );
+ aGroupsLayout->addWidget( aBtnsFrame, 1, 1, Qt::AlignHCenter );
+ aGroupsLayout->addWidget( myGroups, 1, 2, Qt::AlignHCenter );
+
+ // Fill the page
+ QGridLayout* aPageLayout = new QGridLayout( aPage );
+ aPageLayout->setMargin( 5 );
+ aPageLayout->setSpacing( 5 );
+ aPageLayout->setVerticalSpacing( 10 );
+ aPageLayout->addWidget( aGroupsFrame, 0, 0, Qt::AlignHCenter );
+
+ aPage->setLayout( aPageLayout );
+
+ connect( anAddBtn, SIGNAL( clicked() ), SIGNAL( addGroups() ) );
+ connect( aRemoveBtn, SIGNAL( clicked() ), SIGNAL( removeGroups() ) );
+
+ return aPage;
+}
+
QWizardPage* HYDROGUI_CalculationDlg::createZonesPage() {
QWizardPage* aPage = new QWizardPage( mainFrame() );
QFrame* aFrame = new QFrame( aPage );
signals:
void addObjects();
void removeObjects();
- void objectSelected( const QString & theObjName );
+ void objectsSelected();
+
+ void addGroups();
+ void removeGroups();
+ void groupsSelected();
+
void boundarySelected( const QString & theObjName );
void setMergeType( int theMergeType, QString& theBathymetryName );
void createRegion( const QList<SUIT_DataObject*>& theZonesList );
private:
QWizardPage* createObjectsPage();
+ QWizardPage* createGroupsPage();
QWizardPage* createZonesPage();
QGroupBox* myObjectNameGroup;
QListWidget* myAvailableGeomObjects;
QListWidget* myGeomObjects;
+ QListWidget* myAvailableGroups;
+ QListWidget* myGroups;
+
HYDROGUI_DataBrowser* myBrowser;
Handle(HYDROData_CalculationCase) myEditedObject;
QComboBox* myBathymetryChoice;
// Connect signals and slots
connect( aPanel, SIGNAL( addObjects() ), SLOT( onAddObjects() ) );
connect( aPanel, SIGNAL( removeObjects() ), SLOT( onRemoveObjects() ) );
- connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onSplitZones() ) );
+ connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onNext( const int ) ) );
connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones() ) );
//connect( aPanel, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onSelected( SUIT_DataObject* ) ) );
connect( aPanel, SIGNAL( setMergeType( int, QString& ) ), SLOT( onSetMergeType( int, QString& ) ) );
SLOT( onCreateRegion( const QList<SUIT_DataObject*>& ) ) );
connect( aPanel, SIGNAL( clickedInZonesBrowser( SUIT_DataObject* ) ),
SLOT( onClickedInZonesBrowser( SUIT_DataObject* ) ) );
- connect( aPanel, SIGNAL( objectSelected( const QString & ) ),
- SLOT( onObjectSelected( const QString & ) ) );
+ connect( aPanel, SIGNAL( objectsSelected() ),
+ SLOT( onObjectsSelected() ) );
connect( aPanel, SIGNAL( boundarySelected( const QString & ) ),
SLOT( onBoundarySelected( const QString & ) ) );
}
}
-void HYDROGUI_CalculationOp::onObjectSelected ( const QString & theObjName )
+void HYDROGUI_CalculationOp::onObjectsSelected()
{
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+
+ QStringList aSelectedObjs = aPanel->getSelectedGeomObjects();
+ QMap<QString, bool> aSelectedObjsMap;
+ foreach( QString aName, aSelectedObjs )
+ aSelectedObjsMap[aName] = true;
+
+
// Select the appropriate geometry object shape in the viewer
selectionMgr()->clearSelected();
// Unhighlight all objects except selected
- HYDROGUI_Shape* aShape;
- HYDROGUI_Shape* aSelectedShape = 0;
+ HYDROGUI_Shape* aShape = 0, *aLastShape = 0;
Handle(HYDROData_Entity) anEntity;
HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
if ( aShape )
{
aName = anEntity->GetName();
- isSelected = ( aName == theObjName );
- if ( isSelected )
- {
- aSelectedShape = aShape;
- }
- if ( aShape->isHighlighted() != isSelected )
- {
- if ( !isSelected )
- {
- aShape->highlight( isSelected );
- aShape->update();
- }
- }
+ isSelected = aSelectedObjsMap.contains( aName );
+ aShape->highlight( isSelected, false );
+ aShape->update( false );
+ aLastShape = aShape;
}
}
}
- if ( aSelectedShape )
- {
- aSelectedShape->highlight( true );
- aSelectedShape->update();
- }
+ if( aLastShape )
+ aLastShape->update( true );
}
void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
}
}
-void HYDROGUI_CalculationOp::onSplitZones()
+void HYDROGUI_CalculationOp::onNext( const int theIndex )
{
- HYDROGUI_CalculationDlg* aPanel =
- ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
- if ( !aPanel )
- return;
-
- QApplication::setOverrideCursor( Qt::WaitCursor );
-
- QString aNewCaseName = aPanel->getObjectName();
- QString anOldCaseName = myEditedObject->GetName();
+ if( theIndex==1 )
+ {
+ setAvailableGroups();
+ }
+ else if( theIndex==2 )
+ {
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+ if ( !aPanel )
+ return;
- bool anIsToUpdateOb = myIsEdit && anOldCaseName != aNewCaseName;
+ QApplication::setOverrideCursor( Qt::WaitCursor );
- // At first we must to update the case name because of
- // automatic names generation for regions and zones
- myEditedObject->SetName( aNewCaseName );
+ QString aNewCaseName = aPanel->getObjectName();
+ QString anOldCaseName = myEditedObject->GetName();
- if ( myEditedObject->IsMustBeUpdated() )
- {
- myShowZones = true;
- myEditedObject->Update();
+ bool anIsToUpdateOb = myIsEdit && anOldCaseName != aNewCaseName;
+
+ // At first we must to update the case name because of
+ // automatic names generation for regions and zones
+ myEditedObject->SetName( aNewCaseName );
+
+ if ( myEditedObject->IsMustBeUpdated() )
+ {
+ myShowZones = true;
+ myEditedObject->Update();
- //aPanel->setEditedObject( myEditedObject );
- aPanel->refreshZonesBrowser();
+ //aPanel->setEditedObject( myEditedObject );
+ aPanel->refreshZonesBrowser();
- createPreview();
- }
- else
- {
- setZonesVisible( true );
- }
+ createPreview();
+ }
+ else
+ {
+ setZonesVisible( true );
+ }
- if ( anIsToUpdateOb )
- module()->getApp()->updateObjectBrowser( false );
+ if ( anIsToUpdateOb )
+ module()->getApp()->updateObjectBrowser( false );
- QApplication::restoreOverrideCursor();
+ QApplication::restoreOverrideCursor();
+ }
}
void HYDROGUI_CalculationOp::onHideZones()
}
}
+void HYDROGUI_CalculationOp::setAvailableGroups()
+{
+ HYDROGUI_CalculationDlg* aPanel =
+ ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+ HYDROData_SequenceOfObjects anObjs = myEditedObject->GetGeometryObjects();
+ for( int anIndex = 1, aLength = anObjs.Length(); anIndex <= aLength; anIndex++ )
+ {
+ Handle_HYDROData_Object anObj = Handle_HYDROData_Object::DownCast( anObjs.Value( anIndex ) );
+ //TODO: anObj->GetGroups();
+ }
+}
virtual void onApply();
virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg );
+ void setAvailableGroups();
+
protected slots:
/**
* Add geometry objects selected in the module browser to the calculation case.
/**
* Case objects must be splitted to zones if the case has been modified or new.
*/
- void onSplitZones();
+ void onNext( const int );
void onLastViewClosed( SUIT_ViewManager* );
/**
* The zone is selected in the browser on the second page of the wizard.
/**
* Geometry object is selected in the list on the first wizard page
*/
- void onObjectSelected ( const QString & theObjName );
+ void onObjectsSelected();
/**
* Boundary polyline is selected in the list on the first wizard page
*/
myContext->Erase( myShape, theIsUpdateViewer );
}
-void HYDROGUI_Shape::highlight( bool theIsHighlight )
+void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
{
if ( myIsHighlight == theIsHighlight )
return;
return;
colorShapeBorder( getActiveColor() );
- myContext->Display( myShape );
+ myContext->Display( myShape, isUpdateViewer );
}
bool HYDROGUI_Shape::isHighlighted() const
virtual void display( const bool theIsUpdateViewer = true );
virtual void erase( const bool theIsUpdateViewer = true );
- virtual void highlight( bool theIsHighlight );
+ virtual void highlight( bool theIsHighlight, bool isUpdateViewer );
virtual bool isHighlighted() const;
Handle(HYDROData_Entity) getObject() const { return myObject; }
<source>INCLUDED_OBJECTS</source>
<translation>Included objects</translation>
</message>
+ <message>
+ <source>AVAILABLE_GROUPS</source>
+ <translation>Available groups</translation>
+ </message>
+ <message>
+ <source>INCLUDED_GROUPS</source>
+ <translation>Included groups</translation>
+ </message>
<message>
<source>LIMITS</source>
<translation>Limits</translation>