#endif
#define CALCULATION_REGIONS_PREF GetName() + "_Reg"
#define CALCULATION_ZONES_PREF GetName() + "_Zone"
+#define CALCULATION_LANDCOVER_ZONES_PREF GetName() + "_LandCoverZone"
#define CALCULATION_GROUPS_PREF GetName() + "_"
//#define DEB_CLASS2D 1
#ifdef DEB_CLASS2D
{
// Create result regions for case, by default one zone for one region
QString aRegsPref = CALCULATION_REGIONS_PREF;
- QString aZonesPref = CALCULATION_ZONES_PREF;
+ QString aZonesPref = theLandCover ? CALCULATION_LANDCOVER_ZONES_PREF : CALCULATION_ZONES_PREF;
HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theZones );
while( anIter.hasNext() )
{
QMap<QString, Handle(HYDROData_Region)> aRegionsMap; //object name to region
QMap<QString, QString> aRegionNameToObjNameMap;
- QString aZonesPref = CALCULATION_ZONES_PREF;
+ QString aZonesPref = theLandCover ? CALCULATION_LANDCOVER_ZONES_PREF : CALCULATION_ZONES_PREF;
HYDROData_PriorityQueue aPr( this, theLandCover ? DataTag_CustomLandCoverRules : DataTag_CustomRules );
// 1. First we create a default region for each object included into the calculation case
QGridLayout* aLayout = new QGridLayout( aPage );
- myLandCoverBrowser = new HYDROGUI_DataBrowser( module(), NULL, aPage );
+ myLandCoverBrowser = new HYDROGUI_DataBrowser( module(), NULL, aPage, true );
myLandCoverBrowser->setAutoOpenLevel( 3 );
aLayout->setMargin( 5 );
aLayout->setSpacing( 5 );
myStricklerTypeLabel->setVisible( false );
myStricklerTypeChoice->setVisible( false );
- aLayout->addWidget( myBathymetryLabel, 1, 0 );
- aLayout->addWidget( myBathymetryChoice, 1, 1 );
+ aLayout->addWidget( myStricklerTypeLabel, 1, 0 );
+ aLayout->addWidget( myStricklerTypeChoice, 1, 1 );
aPage->setLayout( aLayout );
myCurrentZone = aZone;
myStricklerTypeChoice->clear();
myStricklerTypeChoice->addItem( tr("MERGE_UNKNOWN"), HYDROData_Zone::Merge_UNKNOWN );
- /*QStringList aList = aZone->getStricklerTypes();
+ QStringList aList = aZone->getObjects();
for ( int i = 0; i < aList.length(); i++ )
{
myStricklerTypeChoice->addItem( aList.at( i ), HYDROData_Zone::Merge_Object );
default:
aCurIndex = 0; // Select unknown by default
}
- myStricklerTypeChoice->setCurrentIndex( aCurIndex );*/
+ myStricklerTypeChoice->setCurrentIndex( aCurIndex );
myStricklerTypeChoice->blockSignals( prevBlock );
}
myStricklerTypeChoice->setVisible( doShow );
myStricklerTypeChoice->setEnabled( getLandCoverMode() == HYDROData_CalculationCase::MANUAL );
- myStricklerTypeChoice->setVisible( doShow );
+ myStricklerTypeLabel->setVisible( doShow );
}
void HYDROGUI_CalculationDlg::onMergeStricklerTypeSelected( int theIndex )
void HYDROGUI_CalculationDlg::onLandCoverZonesDropped( const QList<SUIT_DataObject*>& theList,
SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction )
{
- // TODO: implement this function
+ QList<SUIT_DataObject*> aZonesList;
+ HYDROGUI_Zone* aZone;
+ // Get a list of dropped land cover zones
+ for ( int i = 0; i < theList.length(); i++ )
+ {
+ aZone = dynamic_cast<HYDROGUI_Zone*>( theList.at( i ) );
+ if ( aZone )
+ {
+ aZonesList.append( aZone );
+ }
+ }
+ if ( aZonesList.length() > 0 )
+ {
+ // Get the target region
+ HYDROGUI_NamedObject* aRegionsRoot = dynamic_cast<HYDROGUI_NamedObject*>(theTargetParent);
+ if ( aRegionsRoot )
+ {
+ // Create a new region
+ emit createLandCoverRegion( aZonesList );
+ }
+ else
+ {
+ HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theTargetParent);
+ if ( aRegion )
+ {
+ emit moveZones( theTargetParent, aZonesList, true );
+ }
+ }
+ }
}
void HYDROGUI_CalculationDlg::setObjectName( const QString& theName )
myEditedObject->SetAssignmentLandCoverMode( (HYDROData_CalculationCase::AssignmentMode)aPanel->getLandCoverMode() );
}
}
+
+ closePreview( false );
+ createPreview( true );
}
else if( theIndex==3 )
{
//aPanel->setEditedObject( myEditedObject );
aPanel->refreshZonesBrowser();
- closePreview();
+ closePreview( false );
createPreview( false );
anIsToUpdateOb = true;
aPanel->setEditLandCoverZonesEnabled( aMode == HYDROData_CalculationCase::MANUAL );
bool anIsToUpdateOb = false;
- if ( myEditedObject->IsMustBeUpdated() )
+ bool anIsToUpdate = myEditedObject->IsMustBeUpdated();
+ if ( anIsToUpdate )
{
myShowZones = true;
myEditedObject->Update();
AssignDefaultZonesColors( true );
aPanel->refreshLandCoverZonesBrowser();
-
- closePreview();
- createPreview( true );
anIsToUpdateOb = true;
-
- myEditedObject->SetToUpdate( true );
}
- else
+
+ closePreview( false );
+ createPreview( true );
+
+ if ( !anIsToUpdate )
{
// Hide zones
setZonesVisible( false, false );
void HYDROGUI_CalculationOp::onHideZones( const int theIndex )
{
- if( theIndex==3 )
+ if( theIndex==1 )
+ {
+ closePreview( false );
+ createPreview( false );
+ }
+ if( theIndex==2 )
{
+ closePreview( false );
+ createPreview( true );
+
// Hide zones
setZonesVisible( false, false );
+ // Hide land covers
+ setZonesVisible( false, true );
}
- else if( theIndex==4 )
+ else if( theIndex==3 )
{
+ AssignDefaultZonesColors( false );
+
+ closePreview( false );
+ createPreview( false );
+
// Hide land cover zones
setZonesVisible( false, true );
+ // Show zones
+ setZonesVisible( true, false );
}
}
closePreview();
}
-void HYDROGUI_CalculationOp::closePreview()
+void HYDROGUI_CalculationOp::closePreview( bool theRemoveViewManager )
{
SUIT_DataBrowser* aOb = ((LightApp_Application*)module()->application())->objectBrowser();
QList<QShortcut*> aShortcuts = aOb->findChildren<QShortcut*>();
}
}
- disconnect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
- this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
+ if ( theRemoveViewManager )
+ {
+ disconnect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
+ this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
- module()->getApp()->removeViewManager( myPreviewViewManager ); // myPreviewViewManager is deleted here
- myPreviewViewManager = NULL;
+ module()->getApp()->removeViewManager( myPreviewViewManager ); // myPreviewViewManager is deleted here
+ myPreviewViewManager = NULL;
+ }
}
- if( myActiveViewManager )
+ if( myActiveViewManager && theRemoveViewManager )
{
HYDROGUI_Tool::SetActiveViewManager( module(), myActiveViewManager );
myActiveViewManager = NULL;
private:
void createPreview( const bool theLandCover);
- void closePreview();
+ void closePreview( bool theRemoveViewManager = true );
void setObjectVisibility( Handle(HYDROData_Entity) theEntity, const bool theIsVisible );
void setZonesVisible( bool theIsVisible, const bool theLandCover );
void getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq,
}
-HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_DataObject* theRoot, QWidget* theParent )
+HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule,
+ SUIT_DataObject* theRoot,
+ QWidget* theParent,
+ bool theLandCover/* = false*/)
: SUIT_DataBrowser( theRoot, theParent ), myModule( theModule )
{
SUIT_ResourceMgr* resMgr = theModule->getApp()->resourceMgr();
QString EntryCol = QObject::tr( "ENTRY_COLUMN" );
QString RefObjCol = tr( "REF_OBJECT_COLUMN" );
- QString AltitudeCol = tr( "ALTITUDE_COLUMN" );
+ QString AltitudeCol;
+ if ( theLandCover )
+ AltitudeCol = tr( "STRICKLER_TABLE_COLUMN" );
+ else
+ AltitudeCol = tr( "ALTITUDE_COLUMN" );
SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( model() );
//RKV: treeModel->setSearcher( theModule->getApp() );
Q_OBJECT
public:
- HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_DataObject*, QWidget* = 0 );
+ HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_DataObject*,
+ QWidget* = 0, bool theLandCover = false );
~HYDROGUI_DataBrowser();
HYDROGUI_Module* module() const;
<source>INCLUDED_LAND_COVERS</source>
<translation>Included land covers</translation>
</message>
+ <message>
+ <source>STRICKLER_TYPE</source>
+ <translation>Strickler type from land cover</translation>
+ </message>
</context>
<context>
<source>ALTITUDE_COLUMN</source>
<translation>Altitude.Object</translation>
</message>
+ <message>
+ <source>STRICKLER_TABLE_COLUMN</source>
+ <translation>Strickler table</translation>
+ </message>
<message>
<source>ZONE_TO_NEW_REGION</source>
<translation>Create a new region</translation>