#include "HYDROGUI_Zone.h"
#include "HYDROGUI_OrderedListWidget.h"
#include "HYDROGUI_PriorityWidget.h"
+#include "HYDROGUI_PriorityTableModel.h"
#include <HYDROData_Document.h>
#include <HYDROData_Entity.h>
setLandCoverMode( HYDROData_CalculationCase::AUTOMATIC );
// Reset the priority widget state
- QList<Handle(HYDROData_Object)> anObjects;
+ QList<Handle(HYDROData_Entity)> anObjects;
myPriorityWidget->setObjects( anObjects );
+ myLandCoverPriorityWidget->setObjects( anObjects );
}
QWizardPage* HYDROGUI_CalculationDlg::createObjectsPage() {
// Bottom of the page
myLandCoverPriorityWidget = new HYDROGUI_PriorityWidget( mainFrame() );
+ HYDROGUI_PriorityTableModel* aModel =
+ dynamic_cast<HYDROGUI_PriorityTableModel*>( myLandCoverPriorityWidget->getTable()->model() );
+ if ( aModel )
+ aModel->setColumnCount( 3 );
QGroupBox* aPriorityGroup = new QGroupBox( tr( "PRIORITY" ) );
QBoxLayout* aPriorityLayout = new QHBoxLayout;
Get included geometry objects.
@return the list of geometry objects
*/
-QList<Handle(HYDROData_Object)> HYDROGUI_CalculationDlg::getGeometryObjects()
+QList<Handle(HYDROData_Entity)> HYDROGUI_CalculationDlg::getGeometryObjects()
{
QList<Handle(HYDROData_Entity)> anEntities = myGeomObjects->getObjects();
- QList<Handle(HYDROData_Object)> anObjects;
+ QList<Handle(HYDROData_Entity)> anObjects;
foreach ( Handle(HYDROData_Entity) anEntity, anEntities ) {
Handle(HYDROData_Object) anObj = Handle(HYDROData_Object)::DownCast( anEntity );
Get included land covers.
@return the list of land covers
*/
-QList<Handle(HYDROData_LandCover)> HYDROGUI_CalculationDlg::getLandCovers()
+QList<Handle(HYDROData_Entity)> HYDROGUI_CalculationDlg::getLandCovers()
{
QList<Handle(HYDROData_Entity)> anEntities = myLandCovers->getObjects();
- QList<Handle(HYDROData_LandCover)> aLandCovers;
+ QList<Handle(HYDROData_Entity)> aLandCovers;
foreach ( Handle(HYDROData_Entity) anEntity, anEntities ) {
Handle(HYDROData_LandCover) aLandCover = Handle(HYDROData_LandCover)::DownCast( anEntity );
myPriorityWidget->setRules( theRules );
}
+/**
+ Get rules defined for land covers.
+ @return the list of rules
+ */
+HYDROData_ListOfRules HYDROGUI_CalculationDlg::getLandCoverRules() const
+{
+ return myLandCoverPriorityWidget->getRules();
+}
+
+/**
+ Set rules for land covers.
+ @param theRules the list of rules
+ */
+void HYDROGUI_CalculationDlg::setLandCoverRules( const HYDROData_ListOfRules& theRules ) const
+{
+ myLandCoverPriorityWidget->setRules( theRules );
+}
+
/**
Slot called when objects order is changed.
*/
myGeomObjects->undoLastMove();
}
-void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName )
+void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals )
{
- bool isBlocked = myStricklerTableName->blockSignals( true );
+ bool isBlocked;
+ if ( theBlockSignals )
+ isBlocked = myStricklerTableName->blockSignals( true );
+
myStricklerTableName->setCurrentIndex( myStricklerTableName->findText( theStricklerTableName ) );
- myStricklerTableName->blockSignals( isBlocked );
+
+ if ( theBlockSignals )
+ myStricklerTableName->blockSignals( isBlocked );
+ else
+ emit StricklerTableSelected( theStricklerTableName );
}
-void HYDROGUI_CalculationDlg::includeLandCovers( const QStringList& theLandCovers )
+void HYDROGUI_CalculationDlg::includeLandCovers( const QStringList& theLandCovers, bool theReset )
{
+ if ( theReset )
+ {
+ HYDROGUI_ListModel::Object2VisibleList anObject2VisibleList;
+ myLandCovers->setObjects(anObject2VisibleList);
+ }
+
HYDROGUI_ListModel::Object2VisibleList anObjectsToInclude;
QList<QListWidgetItem*> aFoundItems;
foreach ( const QString& anObjName, theLandCovers ) {
myLandCovers->addObject( HYDROGUI_ListModel::Object2Visible( anObject, true ) );
}
- // TODO: adapt HYDROGUI_PriorityWidget to process land covers
- //myLandCoverPriorityWidget->setObjects( getLandCovers() );
+ myLandCoverPriorityWidget->setObjects( getLandCovers() );
}
void HYDROGUI_CalculationDlg::excludeLandCovers( const QStringList& theLandCovers )
myLandCovers->removeObjectByName( anObjName );
}
- // TODO: adapt HYDROGUI_PriorityWidget to process land covers
- //myLandCoverPriorityWidget->setObjects( getLandCovers() );
+ myLandCoverPriorityWidget->setObjects( getLandCovers() );
}
/**
{
bool isConfirmed = true;
emit orderLandCoverChanged( isConfirmed );
- // TODO: adapt HYDROGUI_PriorityWidget to process land covers
- /*if( isConfirmed )
+ if( isConfirmed )
myLandCoverPriorityWidget->setObjects( getLandCovers() );
- else*/
+ else
myLandCovers->undoLastMove();
}