HYDROGUI_ListModel::Object2VisibleList anObject2VisibleList;
myGeomObjects->setObjects(anObject2VisibleList);
myPolylineName->clear();
+ myLandCoverMapName->clear();
myStricklerTableName->clear();
myAvailableGeomObjects->clear();
// Top of the page
QWidget* aTopContainer = new QWidget;
- // TODO: add combo-box to choose land cover map object
+ // Combo-box to choose land cover map object
+ QLabel* aLandCoverMapLabel = new QLabel( tr( "LAND_COVER_MAP" ), aPage );
+ myLandCoverMapName = new QComboBox( aPage );
+ myLandCoverMapName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ connect( myLandCoverMapName, SIGNAL( activated( const QString & ) ),
+ SIGNAL( landCoverMapSelected( const QString & ) ) );
// Combo-box to choose Strickler table name
QLabel* aStricklerTableLabel = new QLabel( tr( "STRICKLER_TABLE" ), aPage );
myStricklerTableName = new QComboBox( aPage );
SIGNAL( StricklerTableSelected( const QString & ) ) );
// Fill the top layout of the page
- QGridLayout* aTopLayout = new QGridLayout;
+ QGridLayout* aGridLayout = new QGridLayout;
+ aGridLayout->setMargin( 5 );
+ aGridLayout->setSpacing( 5 );
+ aGridLayout->setVerticalSpacing( 10 );
+ aGridLayout->addWidget( aLandCoverMapLabel, 0, 0 );
+ aGridLayout->addWidget( myLandCoverMapName, 0, 1 );
+ aGridLayout->addWidget( aStricklerTableLabel, 1, 0 );
+ aGridLayout->addWidget( myStricklerTableName, 1, 1 );
+
+ QVBoxLayout* aTopLayout = new QVBoxLayout;
aTopLayout->setMargin( 5 );
aTopLayout->setSpacing( 5 );
- aTopLayout->setVerticalSpacing( 10 );
- // TODO: add land cover map combo-box to the layout
- aTopLayout->addWidget( aStricklerTableLabel, 0, 0, Qt::AlignHCenter );
- aTopLayout->addWidget( myStricklerTableName, 0, 1 );
+ aTopLayout->addLayout( aGridLayout );
+ aTopLayout->addStretch( 1 );
aTopContainer->setLayout( aTopLayout );
- // Page layout
- QVBoxLayout* aPageLayout = new QVBoxLayout;
- aPageLayout->setMargin( 5 );
- aPageLayout->setSpacing( 5 );
-
- aPage->setLayout( aPageLayout );
-
- // Connections
- // TODO
+ aPage->setLayout( aTopLayout );
return aPage;
}
}
}
+void HYDROGUI_CalculationDlg::setLandCoverMapsNames( const QStringList& theObjects, const QStringList& theObjectsEntries )
+{
+ myLandCoverMapName->clear();
+
+ for ( int i = 0, n = theObjects.length(); i < n; ++i )
+ {
+ myLandCoverMapName->addItem( theObjects.at( i ), theObjectsEntries.at( i ) );
+ }
+}
+
void HYDROGUI_CalculationDlg::setStricklerTableNames( const QStringList& theObjects, const QStringList& theObjectsEntries )
{
myStricklerTableName->clear();
myBrowser->adjustColumnsWidth();
myBrowser->setAutoUpdate( true );
myBrowser->setUpdateModified( true );
-
- /*TODO
- // Build the calculation case subtree for Land Cover regions
- module()->getDataModel()->buildCaseTree( myLandCoverBrowser->root(), myEditedObject, true );
-
- myLandCoverBrowser->updateTree();
- myLandCoverBrowser->openLevels();
- myLandCoverBrowser->adjustColumnsWidth();
- myLandCoverBrowser->setAutoUpdate( true );
- myLandCoverBrowser->setUpdateModified( true );
- */
}
HYDROGUI_Zone* HYDROGUI_CalculationDlg::getCurrentZone() const
return anObjects;
}
-/**
- Get chosen land cover map.
- @return the land cover map object
- */
-Handle(HYDROData_LandCoverMap) HYDROGUI_CalculationDlg::getLandCoverMap()
-{
- /* TODO
- QList<Handle(HYDROData_Entity)> anEntities = myLandCovers->getObjects();
- QList<Handle(HYDROData_Entity)> aLandCovers;
-
- foreach ( Handle(HYDROData_Entity) anEntity, anEntities ) {
- Handle(HYDROData_LandCover) aLandCover = Handle(HYDROData_LandCover)::DownCast( anEntity );
- if ( aLandCover.IsNull() ) {
- continue;
- }
-
- aLandCovers << aLandCover;
- }
-
- return aLandCovers;
- */
- Handle(HYDROData_LandCoverMap) aLandCoverMap = NULL;
- return aLandCoverMap;
-}
-
/**
Get rules.
@return the list of rules
myPriorityWidget->undoLastChange();
}
-// TODO: setLandCoverMap(...)
void HYDROGUI_CalculationDlg::setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals )
{
bool isBlocked;
else
emit StricklerTableSelected( theStricklerTableName );
}
+
+void HYDROGUI_CalculationDlg::setLandCoverMap( const QString& theLandCoverMapName, bool theBlockSignals )
+{
+ bool isBlocked;
+ if ( theBlockSignals )
+ isBlocked = myLandCoverMapName->blockSignals( true );
+
+ myLandCoverMapName->setCurrentIndex( myLandCoverMapName->findText( theLandCoverMapName ) );
+
+ if ( theBlockSignals )
+ myLandCoverMapName->blockSignals( isBlocked );
+ else
+ emit landCoverMapSelected( theLandCoverMapName );
+}
void setAllGeomObjects( const QStringList& theObjects, const QStringList& theObjectsEntries );
QStringList getAllGeomObjects() const;
void setPolylineNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
- // TODO: setLandCoverMapsNames(...)
+ void setLandCoverMapsNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
void setStricklerTableNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
QStringList getSelectedGeomObjects() const;
QStringList getSelectedAvailableGeomObjects() const;
void onRuleChanged();
void setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals = true );
+ void setLandCoverMap( const QString& theLandCoverMapName, bool theBlockSignals = true );
/**
* Process items selection: hide/show bathymetry merge type selector.
void moveZones( SUIT_DataObject* theRegion, const QList<SUIT_DataObject*>& theZonesList );
void clickedInZonesBrowser( SUIT_DataObject* );
- void landCoverMapSelected();
+ void landCoverMapSelected( const QString & theObjName );
void StricklerTableSelected( const QString & theObjName );
private:
QList<Handle(HYDROData_Entity)> getGeometryObjects();
- Handle(HYDROData_LandCoverMap) getLandCoverMap();
-
QWizardPage* createObjectsPage();
QWizardPage* createGroupsPage();
QWizardPage* createLandCoverMapPage();
HYDROGUI_NameValidator* myValidator;
QComboBox* myPolylineName;
- // TODO: myLandCoverMapName
+ QComboBox* myLandCoverMapName;
QComboBox* myStricklerTableName;
QButtonGroup* myModeButtons;
SLOT( onClickedInZonesBrowser( SUIT_DataObject* ) ) );
connect( aPanel, SIGNAL( objectsSelected() ),
SLOT( onObjectsSelected() ) );
- connect( aPanel, SIGNAL( landCoversSelected() ),
- SLOT( onLandCoversSelected() ) );
- connect( aPanel, SIGNAL( createLandCoverRegion( const QList<SUIT_DataObject*>& ) ),
- SLOT( onCreateLandCoverRegion( const QList<SUIT_DataObject*>& ) ) );
+ connect( aPanel, SIGNAL( landCoverMapSelected( const QString & ) ),
+ SLOT( onLandCoverMapSelected( const QString & ) ) );
connect( aPanel, SIGNAL( boundarySelected( const QString & ) ),
SLOT( onBoundarySelected( const QString & ) ) );
connect( aPanel, SIGNAL( StricklerTableSelected( const QString & ) ),
{
bool anIsToUpdateViewer = false;
- /* TODO
- // Remove old presentations of land covers from the operation viewer
- Handle(HYDROData_Entity) anEntity;
- Handle(HYDROData_LandCover) aLandCover;
- HYDROData_SequenceOfObjects aLandCovers;
- HYDROData_SequenceOfObjects aSeq = myEditedObject->GetLandCovers();
- HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
- for ( ; anIter.More(); anIter.Next() )
+ // Remove old presentation of land cover map from the operation viewer
+ Handle(HYDROData_LandCoverMap) aLandCoverMap = myEditedObject->GetLandCoverMap();
+ if ( !aLandCoverMap.IsNull() )
{
- anEntity = anIter.Value();
- if ( !anEntity.IsNull() )
- {
- aLandCover = Handle(HYDROData_LandCover)::DownCast( anEntity );
- if ( !aLandCover.IsNull() )
- {
- aLandCovers.Append( aLandCover );
- setObjectVisibility( aLandCover, false );
- anIsToUpdateViewer = true;
- }
- }
+ setObjectVisibility( aLandCoverMap, false );
+ anIsToUpdateViewer = true;
}
// Set the selected Strickler table to the calculation case
Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
if ( !aCtx.IsNull() )
{
- HYDROData_SequenceOfObjects::Iterator anIter( aLandCovers );
- for ( ; anIter.More(); anIter.Next() )
+ if ( !aLandCoverMap.IsNull() )
{
- anEntity = anIter.Value();
- if ( !anEntity.IsNull() )
- {
- aLandCover = Handle(HYDROData_LandCover)::DownCast( anEntity );
- if ( !aLandCover.IsNull() )
- {
- setObjectVisibility( aLandCover, true );
- anIsToUpdateViewer = true;
- }
- }
+ setObjectVisibility( aLandCoverMap, true );
+ anIsToUpdateViewer = true;
}
}
}
module()->update( UF_OCCViewer );
}
}
- */
}
void HYDROGUI_CalculationOp::onObjectsSelected()
aLastShape->update( true, false );
}
-void HYDROGUI_CalculationOp::onLandCoverMapSelected()
+void HYDROGUI_CalculationOp::onLandCoverMapSelected( const QString & theObjName )
{
- HYDROGUI_CalculationDlg* aPanel =
- ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
-
- /* TODO: highlight the selected land cover map in the 3d viewer (synchronize slection in the dialog with a preview in the viewer)
- QStringList aSelectedObjs = aPanel->getSelectedLandCovers();
- QMap<QString, bool> aSelectedObjsMap;
- foreach( QString aName, aSelectedObjs )
- aSelectedObjsMap[aName] = true;
- */
-
-
- // Select the appropriate land cover shape in the viewer
- selectionMgr()->clearSelected();
-
- // Unhighlight all land covers except selected
- HYDROGUI_Shape* aShape = 0, *aLastShape = 0;
- Handle(HYDROData_Entity) anEntity;
- /* TODO: highlight the selected land cover map in the 3d viewer (synchronize slection in the dialog with a preview in the viewer)
- HYDROData_SequenceOfObjects aSeq = myEditedObject->GetLandCovers();
- HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
- bool isSelected;
- QString aName;
- for ( ; anIter.More(); anIter.Next() )
+ bool anIsToUpdateViewer = false;
+
+ // Remove old presentation of land cover map from the operation viewer
+ Handle(HYDROData_LandCoverMap) aPrevLandCoverMap = myEditedObject->GetLandCoverMap();
+ if ( !aPrevLandCoverMap.IsNull() )
{
- anEntity = anIter.Value();
- if ( !anEntity.IsNull() )
- {
- aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anEntity );
- if ( aShape )
- {
- aName = anEntity->GetName();
- isSelected = aSelectedObjsMap.contains( aName );
- aShape->highlight( isSelected, false );
- aShape->update( false, false );
- aLastShape = aShape;
- }
- }
+ setObjectVisibility( aPrevLandCoverMap, false );
+ anIsToUpdateViewer = true;
}
- */
- // TODO
- //createPreview( true );
+ // Select the appropriate land cover map shape in the viewer
+ selectionMgr()->clearSelected();
- if( aLastShape )
- aLastShape->update( true, false );
+ // Set the selected land cover map to the calculation case
+ Handle(HYDROData_LandCoverMap) aNewLandCoverMap = Handle(HYDROData_LandCoverMap)::DownCast(
+ HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_LAND_COVER_MAP ) );
+ myEditedObject->SetLandCoverMap( aNewLandCoverMap );
+
+ createPreview( true );
}
void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
QStringList aList;
QStringList anEntryList;
- HYDROData_SequenceOfObjects aSeq;
- /* TODO: get all land cover map objects to fill in combo-box
+ // Get all land cover map objects to fill in combo-box
+ Handle(HYDROData_LandCoverMap) aLandCoverMapObj;
+ QString aLandCoverMapName;
+
+ aList.clear();
+ anEntryList.clear();
+ HYDROData_Iterator anIter( doc(), KIND_LAND_COVER_MAP );
+ for ( ; anIter.More(); anIter.Next() )
+ {
+ aLandCoverMapObj = Handle(HYDROData_LandCoverMap)::DownCast( anIter.Current() );
+
+ if ( !aLandCoverMapObj.IsNull() )
+ {
+ aLandCoverMapName = aLandCoverMapObj->GetName();
+ if ( !aLandCoverMapName.isEmpty() )
+ {
+ aList.append( aLandCoverMapName );
+ anEntryList.append( HYDROGUI_DataObject::dataObjectEntry( aLandCoverMapObj ) );
+ }
+ }
+ }
+ aPanel->setLandCoverMapsNames( aList, anEntryList );
+ aLandCoverMapObj = myEditedObject->GetLandCoverMap();
+ if ( !aList.isEmpty() )
+ {
+ if ( aLandCoverMapObj.IsNull() )
+ aPanel->setLandCoverMap( aList.at( 0 ), false );
+ else if ( myIsEdit )
+ aPanel->setLandCoverMap( aList.at( 0 ), true );
+ else
+ aPanel->setLandCoverMap( aList.at( aList.indexOf( aLandCoverMapObj->GetName() ) ), true );
+ }
+
+ // Get all Strickler table objects to fill in combo-box
Handle(HYDROData_StricklerTable) aStricklerTableObj;
QString aStricklerTableName;
- // Get all Strickler table objects to fill in combo-box
aList.clear();
anEntryList.clear();
- HYDROData_Iterator anIter( doc(), KIND_STRICKLER_TABLE );
+ anIter = HYDROData_Iterator( doc(), KIND_STRICKLER_TABLE );
for ( ; anIter.More(); anIter.Next() )
{
aStricklerTableObj = Handle(HYDROData_StricklerTable)::DownCast( anIter.Current() );
aStricklerTableName = aStricklerTableObj->GetName();
aPanel->setStricklerTable( aStricklerTableName );
}
+
+ // Select the certain land cover map object in combo-box
+ if ( aLandCoverMapObj.IsNull() )
+ {
+ aPanel->setLandCoverMap( QString() );
+ }
+ else
+ {
+ aLandCoverMapName = aLandCoverMapObj->GetName();
+ aPanel->setLandCoverMap( aLandCoverMapName );
+ }
}
}
- */
closePreview( false );
createPreview( true );
/**
* Land cover map is selected in the list on the third wizard page
*/
- void onLandCoverMapSelected();
+ void onLandCoverMapSelected( const QString & theObjName );
/**
* Boundary polyline is selected in the list on the first wizard page
*/
createObject( aCaseNOSect, aNObject, aGuiObj->entry(), false );
}
}
+
+ LightApp_DataObject* aLandCoverMapSect =
+ createObject( aGuiObj, tr( "CASE_LAND_COVER_MAP" ), aGuiObj->entry() );
+
+ Handle(HYDROData_LandCoverMap) aLandCoverMap = aCaseObj->GetLandCoverMap();
+ if ( !aLandCoverMap.IsNull() && !aLandCoverMap->IsRemoved() )
+ createObject( aLandCoverMapSect, aLandCoverMap, aGuiObj->entry(), false );
+
LightApp_DataObject* aCaseRegionsSect =
createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() );
<translation>REGIONS</translation>
</message>
<message>
- <source>CASE_LAND_COVER_REGIONS</source>
- <translation>LAND COVER REGIONS</translation>
+ <source>CASE_LAND_COVER_MAP</source>
+ <translation>LAND COVER MAP</translation>
</message>
<message>
<source>CASE_SPLITTED_GROUPS</source>
<translation>Strickler table</translation>
</message>
<message>
- <source>CALCULATION_REFERENCE_LAND_COVERS</source>
- <translation>Land covers</translation>
- </message>
- <message>
- <source>INCLUDED_LAND_COVERS</source>
- <translation>Included land covers</translation>
+ <source>LAND_COVER_MAP</source>
+ <translation>Land cover map</translation>
</message>
<message>
<source>STRICKLER_TYPE</source>