From: mkr Date: Thu, 18 Jun 2015 09:32:38 +0000 (+0300) Subject: refs #580: modifications in data model and GUI to work with land cover regions and... X-Git-Tag: v1.4.2~53^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a1dd3f29ff9b985b0aa2366a2afd5724286cb6e;p=modules%2Fhydro.git refs #580: modifications in data model and GUI to work with land cover regions and zones. --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index bfed4f10..df5e196a 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -85,33 +85,14 @@ void HYDROData_CalculationCase::SetName( const QString& theName ) QString anOldCaseName = GetName(); if ( anOldCaseName != theName ) { - HYDROData_SequenceOfObjects aRegions = GetRegions(); - - HYDROData_SequenceOfObjects::Iterator anIter( aRegions ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(HYDROData_Region) aRegion = - Handle(HYDROData_Region)::DownCast( anIter.Value() ); - if ( aRegion.IsNull() ) - continue; - - HYDROData_Tool::UpdateChildObjectName( anOldCaseName, theName, aRegion ); - - HYDROData_SequenceOfObjects aZones = aRegion->GetZones(); - HYDROData_SequenceOfObjects::Iterator anIter( aZones ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(HYDROData_Zone) aRegZone = - Handle(HYDROData_Zone)::DownCast( anIter.Value() ); - if ( aRegZone.IsNull() ) - continue; - - HYDROData_Tool::UpdateChildObjectName( anOldCaseName, theName, aRegZone ); - } - } + // Update names of regions and its zones + UpdateRegionsNames( GetRegions( false ), anOldCaseName, theName ); + // Update names of land cover regions and its zones + UpdateRegionsNames( GetRegions( true ), anOldCaseName, theName ); HYDROData_SequenceOfObjects aGroups = GetSplittedGroups(); + HYDROData_SequenceOfObjects::Iterator anIter; anIter.Init( aGroups ); for ( ; anIter.More(); anIter.Next() ) { @@ -183,20 +164,11 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre if( aMode==MANUAL ) { - // Now we restore the regions and zones order - HYDROData_SequenceOfObjects aRegions = GetRegions(); - anIter.Init( aRegions ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(HYDROData_Region) aRegion = - Handle(HYDROData_Region)::DownCast( anIter.Value() ); - if ( aRegion.IsNull() ) - continue; - - theTreatedObjects.insert( aRegion->GetName(), aRegion ); - QStringList aRegDump = aRegion->DumpToPython( theTreatedObjects ); - aResList << aRegDump; - } + // Now we restore the + // - regions and zones order + DumpRegionsToPython( aResList, theTreatedObjects, GetRegions( false ) ); + // - land cover regions and zones order + DumpRegionsToPython( aResList, theTreatedObjects, GetRegions( true ) ); } // Export calculation case @@ -268,9 +240,14 @@ HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() if ( !aBoundaryPolyline.IsNull() ) aResSeq.Append( aBoundaryPolyline ); - HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions(); + // Regions + HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions( false ); aResSeq.Append( aSeqOfRegions ); + // Land cover regions + HYDROData_SequenceOfObjects aSeqOfLandCoverRegions = GetRegions( true ); + aResSeq.Append( aSeqOfLandCoverRegions ); + return aResSeq; } @@ -280,13 +257,15 @@ void HYDROData_CalculationCase::Update() SetWarning(); // At first we remove previously created objects - RemoveRegions(); + RemoveRegions( false ); + RemoveRegions( true ); RemoveSplittedGroups(); Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); if ( aDocument.IsNull() ) return; + // Split to zones Handle(HYDROData_PolylineXY) aBoundaryPolyline = GetBoundaryPolyline(); HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects(); if ( aGeomObjects.IsEmpty() ) @@ -298,7 +277,7 @@ void HYDROData_CalculationCase::Update() HYDROData_SplitToZonesTool::Split( aGeomObjects, aGeomGroups, aBoundaryPolyline ); if ( aSplitObjects.isEmpty() ) return; - + HYDROData_SplitToZonesTool::SplitDataList aZonesList, anEdgesList; HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitObjects ); @@ -311,20 +290,49 @@ void HYDROData_CalculationCase::Update() anEdgesList.append( aSplitData ); } + // TODO: Split to land cover zones + /*HYDROData_SequenceOfObjects aLandCovers = GetLandCovers(); + if ( aLandCovers.IsEmpty() ) + return; + + HYDROData_SplitToZonesTool::SplitDataList aSplitLandCoverObjects = + HYDROData_SplitToZonesTool::Split( aLandCovers, ... ); + if ( aSplitLandCoverObjects.isEmpty() ) + return; + + HYDROData_SplitToZonesTool::SplitDataList aLandCoverZonesList, aLandCoverEdgesList; + + HYDROData_SplitToZonesTool::SplitDataListIterator anIter( aSplitLandCoverObjects ); + while( anIter.hasNext() ) + { + const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next(); + if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Zone ) + aLandCoverZonesList.append( aSplitData ); + else if ( aSplitData.Type == HYDROData_SplitToZonesTool::SplitData::Data_Edge ) + aLandCoverEdgesList.append( aSplitData ); + }*/ + switch( GetAssignmentMode() ) { case MANUAL: - CreateRegionsDef( aDocument, aZonesList ); + CreateRegionsDef( aDocument, aZonesList, false ); + // TODO: Create land cover regions in manual mode + //CreateRegionsDef( aDocument, aLandCoverZonesList, true ); break; case AUTOMATIC: - CreateRegionsAuto( aDocument, aZonesList ); + CreateRegionsAuto( aDocument, aZonesList, false ); + // TODO: Create land cover regions in automatic mode + //CreateRegionsAuto( aDocument, aLandCoverZonesList, true ); break; } CreateEdgeGroupsDef( aDocument, anEdgesList ); + // TODO: Process land cover edges + //CreateEdgeGroupsDef( aDocument, aLandCoverEdgesList ); } void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones ) + const HYDROData_SplitToZonesTool::SplitDataList& theZones, + const bool theLandCover ) { // Create result regions for case, by default one zone for one region QString aRegsPref = CALCULATION_REGIONS_PREF; @@ -335,7 +343,7 @@ void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Documen { const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next(); // Create new region - Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegsPref ); + Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegsPref, theLandCover ); // Add the zone for region Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( theDoc, aZonesPref, aSplitData.Face(), aSplitData.ObjectNames ); @@ -343,7 +351,8 @@ void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Documen } void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones ) + const HYDROData_SplitToZonesTool::SplitDataList& theZones, + const bool theLandCover ) { QMap aRegionsMap; //object name to region QMap aRegionNameToObjNameMap; @@ -359,7 +368,7 @@ void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Docume continue; QString anObjName = anObj->GetName(); QString aRegName = anObjName + "_reg"; - Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegName, false ); + Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegName, theLandCover, false ); aRegionsMap.insert( anObjName, aRegion ); aRegionNameToObjNameMap.insert( aRegName, anObjName ); } @@ -626,10 +635,11 @@ void HYDROData_CalculationCase::RemoveLandCovers() SetToUpdate( true ); } -Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone ) +Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone, + const bool theLandCover ) { Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); - Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF ); + Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF, theLandCover ); if ( aNewRegion.IsNull() ) return aNewRegion; @@ -638,7 +648,8 @@ Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(H return aNewRegion; } -bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRegion ) +bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRegion, + const bool theLandCover ) { Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); @@ -653,7 +664,7 @@ bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRe Handle(HYDROData_CalculationCase)::DownCast( theRegion->GetFatherObject() ); if ( !aFatherCalc.IsNull() && aFatherCalc->Label() != myLab ) { - Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF ); + Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF, theLandCover ); theRegion->CopyTo( aNewRegion ); aFatherCalc->RemoveRegion( theRegion ); @@ -668,9 +679,9 @@ bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRe return true; } -HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetRegions() const +HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetRegions( const bool theLandCover ) const { - return GetReferenceObjects( DataTag_Region ); + return GetReferenceObjects( theLandCover ? DataTag_LandCoverRegion : DataTag_Region ); } void HYDROData_CalculationCase::UpdateRegionsOrder() @@ -679,7 +690,8 @@ void HYDROData_CalculationCase::UpdateRegionsOrder() if ( aDocument.IsNull() ) return; - HYDROData_SequenceOfObjects aRegions = GetRegions(); + HYDROData_SequenceOfObjects aRegions = GetRegions( false ); + aRegions.Append( GetRegions( true ) ); HYDROData_SequenceOfObjects::Iterator anIter( aRegions ); for ( ; anIter.More(); anIter.Next() ) @@ -721,9 +733,9 @@ void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& th theRegion->Remove(); } -void HYDROData_CalculationCase::RemoveRegions() +void HYDROData_CalculationCase::RemoveRegions( const bool theLandCover ) { - myLab.FindChild( DataTag_ChildRegion ).ForgetAllAttributes(); + myLab.FindChild( theLandCover ? DataTag_ChildLandCoverRegion : DataTag_ChildRegion ).ForgetAllAttributes(); } HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetSplittedGroups() const @@ -738,7 +750,7 @@ void HYDROData_CalculationCase::RemoveSplittedGroups() double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) const { - Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint ); + Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, false ); return GetAltitudeForPoint( thePoint, aZone ); } @@ -747,7 +759,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& { double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude(); - Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint ); + Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, false ); if ( !aZone.IsNull() ) { Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() ); @@ -878,22 +890,24 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( return aResSeq; } -Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const +Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint, + const bool theLandCover ) const { Handle(HYDROData_Region) aResRegion; - Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint ); + Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, theLandCover ); if ( !aZone.IsNull() ) aResRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() ); return aResRegion; } -Handle(HYDROData_Zone) HYDROData_CalculationCase::GetZoneFromPoint( const gp_XY& thePoint ) const +Handle(HYDROData_Zone) HYDROData_CalculationCase::GetZoneFromPoint( const gp_XY& thePoint, + const bool theLandCover ) const { Handle(HYDROData_Zone) aResZone; - HYDROData_SequenceOfObjects aRegions = GetRegions(); + HYDROData_SequenceOfObjects aRegions = GetRegions( theLandCover ); HYDROData_SequenceOfObjects::Iterator anIter( aRegions ); for ( ; anIter.More() && aResZone.IsNull(); anIter.Next() ) @@ -954,14 +968,15 @@ HYDROData_CalculationCase::PointClassification HYDROData_CalculationCase::GetPoi Handle(HYDROData_Region) HYDROData_CalculationCase::addNewRegion( const Handle(HYDROData_Document)& theDoc, const QString& thePrefixOrName, + const bool theLandCover, bool isPrefix ) { - TDF_Label aNewLab = myLab.FindChild( DataTag_ChildRegion ).NewChild(); + TDF_Label aNewLab = myLab.FindChild( theLandCover ? DataTag_ChildLandCoverRegion : DataTag_ChildRegion ).NewChild(); int aTag = aNewLab.Tag(); Handle(HYDROData_Region) aNewRegion = Handle(HYDROData_Region)::DownCast( HYDROData_Iterator::CreateObject( aNewLab, KIND_REGION ) ); - AddRegion( aNewRegion ); + AddRegion( aNewRegion, theLandCover ); QString aRegionName = isPrefix ? HYDROData_Tool::GenerateObjectName( theDoc, thePrefixOrName ) : thePrefixOrName; aNewRegion->SetName( aRegionName ); @@ -1021,7 +1036,9 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, // Get faces TopTools_ListOfShape aFaces; - HYDROData_SequenceOfObjects aCaseRegions = GetRegions(); + HYDROData_SequenceOfObjects aCaseRegions = GetRegions( false ); + // TODO: process land cover faces + //aCaseRegions.Append( GetRegions( true ) ); HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions ); for ( ; aRegionIter.More(); aRegionIter.Next() ) { @@ -1306,6 +1323,53 @@ void HYDROData_CalculationCase::SetWarning( HYDROData_WarningType theType, const myLastWarning.Data = theData; } +void HYDROData_CalculationCase::UpdateRegionsNames( const HYDROData_SequenceOfObjects& theRegions, + const QString& theOldCaseName, + const QString& theName ) +{ + HYDROData_SequenceOfObjects::Iterator anIter( theRegions ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Region) aRegion = + Handle(HYDROData_Region)::DownCast( anIter.Value() ); + if ( aRegion.IsNull() ) + continue; + + HYDROData_Tool::UpdateChildObjectName( theOldCaseName, theName, aRegion ); + + HYDROData_SequenceOfObjects aZones = aRegion->GetZones(); + HYDROData_SequenceOfObjects::Iterator anIter( aZones ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Zone) aRegZone = + Handle(HYDROData_Zone)::DownCast( anIter.Value() ); + if ( aRegZone.IsNull() ) + continue; + + HYDROData_Tool::UpdateChildObjectName( theOldCaseName, theName, aRegZone ); + } + } +} + +void HYDROData_CalculationCase::DumpRegionsToPython( QStringList& theResList, + MapOfTreatedObjects& theTreatedObjects, + const HYDROData_SequenceOfObjects& theRegions ) const +{ + HYDROData_SequenceOfObjects::Iterator anIter; + anIter.Init( theRegions ); + for ( ; anIter.More(); anIter.Next() ) + { + Handle(HYDROData_Region) aRegion = + Handle(HYDROData_Region)::DownCast( anIter.Value() ); + if ( aRegion.IsNull() ) + continue; + + theTreatedObjects.insert( aRegion->GetName(), aRegion ); + QStringList aRegDump = aRegion->DumpToPython( theTreatedObjects ); + theResList << aRegDump; + } +} + bool HYDROData_CalculationCase::GetRule( int theIndex, Handle(HYDROData_Entity)& theObject1, HYDROData_PriorityType& thePriority, diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index b40503ba..6c13eacb 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -88,7 +88,9 @@ public: DataTag_StricklerTable, ///< reference Strickler table DataTag_LandCover, ///< reference land covers DataTag_CustomLandCoverRules, ///< custom rules for land covers priority - DataTag_AssignmentLandCoverMode ///< assignment mode of land covers priority + DataTag_AssignmentLandCoverMode, ///< assignment mode of land covers priority + DataTag_ChildLandCoverRegion, ///< child land cover regions + DataTag_LandCoverRegion ///< reference land cover regions }; public: @@ -104,7 +106,7 @@ public: * Updates the name of this object. * Reimplemented to update the names of regions, zones and splitted groups. */ - HYDRODATA_EXPORT virtual void SetName( const QString& theName ); + HYDRODATA_EXPORT virtual void SetName( const QString& theName ); /** * Dump Calculation object to Python script representation. @@ -226,19 +228,21 @@ public: * The label of theZone is changed during this operation * because of new region becomes the new parent for this zone. */ - HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone ); + HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone, + const bool theLandCover ); /** * Add new one reference region for calculation case. * The label of theRegion is changed in case if old parent is not this calculation. */ - HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion ); + HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion, + const bool theLandCover ); /** * Returns all reference regions of calculation case. */ - HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const; + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions( const bool theLandCover ) const; /** * Updates names of regions to correct order. @@ -253,9 +257,8 @@ public: /** * Removes all reference regions from calculation case. */ - HYDRODATA_EXPORT virtual void RemoveRegions(); + HYDRODATA_EXPORT virtual void RemoveRegions( const bool theLandCover ); - /** * Returns all reference geometry groups of calculation case. */ @@ -334,16 +337,22 @@ public: /** * Returns region to which the point is belongs. * \param thePoint the point to examine + * \param theLandCover the flag indicating, + * if it is needed to search land cover region * \return result region */ - HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegionFromPoint( const gp_XY& thePoint ) const; + HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegionFromPoint( const gp_XY& thePoint, + const bool theLandCover ) const; /** * Returns zone to which the point is belongs. * \param thePoint the point to examine + * \param theLandCover the flag indicating, + * if it is needed to search land cover zone * \return result zone */ - HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const; + HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint, + const bool theLandCover ) const; /** * Returns classification of point for given zone. @@ -387,6 +396,7 @@ private: */ Handle(HYDROData_Region) addNewRegion( const Handle(HYDROData_Document)& theDoc, const QString& thePrefixOrName, + const bool theLandCover, bool isPrefix = true ); /** @@ -423,9 +433,11 @@ private: QString& theGeomObjEntry ) const; void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones ); + const HYDROData_SplitToZonesTool::SplitDataList& theZones, + const bool theLandCover ); void CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones ); + const HYDROData_SplitToZonesTool::SplitDataList& theZones, + const bool theLandCover ); void CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc, const HYDROData_SplitToZonesTool::SplitDataList& theEdges ); @@ -434,6 +446,14 @@ private: void SetWarning( HYDROData_WarningType theType = WARN_OK, const QString& theData = "" ); + void UpdateRegionsNames( const HYDROData_SequenceOfObjects& theRegions, + const QString& theOldCaseName, + const QString& theName ); + + void DumpRegionsToPython( QStringList& theResList, + MapOfTreatedObjects& theTreatedObjects, + const HYDROData_SequenceOfObjects& theRegions ) const; + protected: friend class HYDROData_Iterator; diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index b796efb1..c7274371 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -73,7 +73,7 @@ HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, co addPage( createGroupsPage() ); addPage( createLandCoversPage() ); addPage( createZonesPage() ); - addPage( createLandCoversPartitionPage() ); + addPage( createLandCoverZonesPage() ); } HYDROGUI_CalculationDlg::~HYDROGUI_CalculationDlg() @@ -484,7 +484,7 @@ QWizardPage* HYDROGUI_CalculationDlg::createZonesPage() { return aPage; } -QWizardPage* HYDROGUI_CalculationDlg::createLandCoversPartitionPage() { +QWizardPage* HYDROGUI_CalculationDlg::createLandCoverZonesPage() { QWizardPage* aPage = new QWizardPage( mainFrame() ); QFrame* aFrame = new QFrame( aPage ); @@ -497,10 +497,26 @@ QWizardPage* HYDROGUI_CalculationDlg::createLandCoversPartitionPage() { aLayout->addWidget( myLandCoverBrowser, 0, 0, 1, 2 ); + myStricklerTypeLabel = new QLabel( tr( "STRICKLER_TYPE" ), aFrame ); + myStricklerTypeChoice = new QComboBox( aFrame ); + + myStricklerTypeLabel->setVisible( false ); + myStricklerTypeChoice->setVisible( false ); + + aLayout->addWidget( myBathymetryLabel, 1, 0 ); + aLayout->addWidget( myBathymetryChoice, 1, 1 ); + aPage->setLayout( aLayout ); // Connections - //... + connect( myLandCoverBrowser, SIGNAL( dataChanged() ), SLOT( onDataLandCoverChanged() ) ); + connect( myLandCoverBrowser, SIGNAL( clicked( SUIT_DataObject* ) ), SIGNAL( clickedInZonesBrowser( SUIT_DataObject* ) ) ); + connect( myLandCoverBrowser, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onLandCoverZoneSelected( SUIT_DataObject* ) ) ); + connect( myStricklerTypeChoice, SIGNAL( activated( int ) ), SLOT( onMergeStricklerTypeSelected( int ) ) ); + connect( myLandCoverBrowser, + SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ), + SLOT( onLandCoverZonesDropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ) ); + connect( myLandCoverBrowser, SIGNAL( newRegion() ), this, SLOT( OnNewLandCoverRegion() ) ); return aPage; } @@ -580,6 +596,11 @@ void HYDROGUI_CalculationDlg::OnNewRegion() emit createRegion( myBrowser->getSelected() ); } +void HYDROGUI_CalculationDlg::OnNewLandCoverRegion() +{ + emit createLandCoverRegion( myLandCoverBrowser->getSelected() ); +} + void HYDROGUI_CalculationDlg::onMergeTypeSelected( int theIndex ) { int aType = myBathymetryChoice->itemData( theIndex ).toInt(); @@ -635,6 +656,22 @@ void HYDROGUI_CalculationDlg::onSelected( SUIT_DataObject* theObject ) myBathymetryLabel->setVisible( doShow ); } +void HYDROGUI_CalculationDlg::onLandCoverZoneSelected( SUIT_DataObject* theObject ) +{ + // TODO: implement this function +} + +void HYDROGUI_CalculationDlg::onMergeStricklerTypeSelected( int theIndex ) +{ + // TODO: implement this function +} + +void HYDROGUI_CalculationDlg::onLandCoverZonesDropped( const QList& theList, + SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction ) +{ + // TODO: implement this function +} + void HYDROGUI_CalculationDlg::setObjectName( const QString& theName ) { myObjectName->setText( theName ); @@ -1083,6 +1120,24 @@ void HYDROGUI_CalculationDlg::excludeLandCovers( const QStringList& theLandCover myLandCoverPriorityWidget->setObjects( getLandCovers() ); } +void HYDROGUI_CalculationDlg::refreshLandCoverZonesBrowser() +{ + SUIT_DataObject* aRoot = myLandCoverBrowser->root(); + module()->getDataModel()->updateObjectTree( myEditedObject ); + module()->getDataModel()->buildCaseTree( aRoot, myEditedObject ); + myLandCoverBrowser->updateTree( aRoot ); +} + +/** + Slot called when zones created on land covers are changed. + */ +void HYDROGUI_CalculationDlg::onDataLandCoverChanged() +{ + SUIT_DataObject* aRoot = myLandCoverBrowser->root(); + module()->getDataModel()->buildCaseTree( aRoot, myEditedObject ); + myLandCoverBrowser->updateTree( aRoot ); +} + /** Slot called when land covers order is changed. */ diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.h b/src/HYDROGUI/HYDROGUI_CalculationDlg.h index f4ee385f..da597e86 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.h +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.h @@ -103,6 +103,8 @@ public slots: void setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals = true ); void includeLandCovers( const QStringList& theLandCovers, bool theReset ); void excludeLandCovers( const QStringList& theLandCovers ); + void refreshLandCoverZonesBrowser(); + void onDataLandCoverChanged(); void onOrderLandCoverChanged(); /** @@ -119,6 +121,20 @@ public slots: void onZonesDropped( const QList& theList, SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction ); + /** + * Process items selection: hide/show Strickler type merge type selector. + */ + void onLandCoverZoneSelected( SUIT_DataObject* theObject ); + /** + * Process merge type selection: set the selected Strickler type merge type for the currently selected zone. + */ + void onMergeStricklerTypeSelected( int theIndex ); + /** + * Process land cover zones moving. Create a new region with dropped zones or add to existing one. + */ + void onLandCoverZonesDropped( const QList& theList, + SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction ); + signals: void changeMode( int theMode ); @@ -143,6 +159,8 @@ signals: void removeLandCovers(); void landCoversSelected(); void orderLandCoverChanged( bool& isConfirmed ); + + void createLandCoverRegion( const QList& theLandCoverZonesList ); void StricklerTableSelected( const QString & theObjName ); @@ -152,6 +170,7 @@ protected: protected slots: void OnNewRegion(); + void OnNewLandCoverRegion(); private: QList getGeometryObjects(); @@ -161,7 +180,7 @@ private: QWizardPage* createGroupsPage(); QWizardPage* createLandCoversPage(); QWizardPage* createZonesPage(); - QWizardPage* createLandCoversPartitionPage(); + QWizardPage* createLandCoverZonesPage(); QSplitter* mySplitter; QSplitter* myLandCoverSplitter; @@ -195,6 +214,8 @@ private: HYDROGUI_Zone* myCurrentZone; HYDROGUI_DataBrowser* myLandCoverBrowser; + QComboBox* myStricklerTypeChoice; + QLabel* myStricklerTypeLabel; }; #endif diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx index f8311d5a..94ea5dbb 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.cxx @@ -163,7 +163,7 @@ void HYDROGUI_CalculationOp::startOperation() aPanel->setObjectName( anObjectName ); aPanel->setEditedObject( myEditedObject ); - createPreview(); + createPreview( false ); } void HYDROGUI_CalculationOp::getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq, @@ -220,7 +220,7 @@ HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const connect( aPanel, SIGNAL( orderLandCoverChanged( bool& ) ), SLOT( onOrderLandCoverChanged( bool& ) ) ); connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onNext( const int ) ) ); - connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones() ) ); + connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones( const int ) ) ); //connect( aPanel, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onSelected( SUIT_DataObject* ) ) ); connect( aPanel, SIGNAL( setMergeType( int, QString& ) ), SLOT( onSetMergeType( int, QString& ) ) ); connect( aPanel, SIGNAL( moveZones( SUIT_DataObject*, const QList& ) ), @@ -233,6 +233,8 @@ HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const SLOT( onObjectsSelected() ) ); connect( aPanel, SIGNAL( landCoversSelected() ), SLOT( onLandCoversSelected() ) ); + connect( aPanel, SIGNAL( createLandCoverRegion( const QList& ) ), + SLOT( onCreateLandCoverRegion( const QList& ) ) ); connect( aPanel, SIGNAL( boundarySelected( const QString & ) ), SLOT( onBoundarySelected( const QString & ) ) ); connect( aPanel, SIGNAL( StricklerTableSelected( const QString & ) ), @@ -483,34 +485,36 @@ void HYDROGUI_CalculationOp::onMoveZones( SUIT_DataObject* theRegionItem, const { aPanel->refreshZonesBrowser(); } - createPreview(); + createPreview( false ); } } } void HYDROGUI_CalculationOp::onCreateRegion( const QList& theZonesList ) { - QList aZonesList; - HYDROGUI_Zone* aZone; - // Get a list of dropped zones - for ( int i = 0; i < theZonesList.length(); i++ ) + if ( createRegion( theZonesList, false ) ) { - aZone = dynamic_cast( theZonesList.at( i ) ); - if ( aZone ) + HYDROGUI_CalculationDlg* aPanel = + ::qobject_cast( inputPanel() ); + if ( aPanel ) { - aZonesList.append( aZone ); + aPanel->refreshZonesBrowser(); } + createPreview( false ); } - if ( aZonesList.length() > 0 ) +} + +void HYDROGUI_CalculationOp::onCreateLandCoverRegion( const QList& theZonesList ) +{ + if ( createRegion( theZonesList, true ) ) { - module()->getDataModel()->createNewRegion( myEditedObject, aZonesList ); HYDROGUI_CalculationDlg* aPanel = ::qobject_cast( inputPanel() ); if ( aPanel ) { - aPanel->refreshZonesBrowser(); + aPanel->refreshLandCoverZonesBrowser(); } - createPreview(); + createPreview( true ); } } @@ -561,7 +565,7 @@ void HYDROGUI_CalculationOp::onAddObjects() if ( !anAddedList.isEmpty() ) { aPanel->includeGeomObjects( anAddedList ); - createPreview(); + createPreview( false ); } } @@ -599,7 +603,7 @@ bool HYDROGUI_CalculationOp::confirmRegionsChange() const if ( !isConfirmed ) { // If not modified check if the case has already defined regions with zones - HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions(); + HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions( false ); if ( aSeq.Length() > 0 ) { // If there are already defined zones then ask a user to confirm zones recalculation @@ -624,7 +628,7 @@ bool HYDROGUI_CalculationOp::confirmOrderChange() const if ( !isConfirmed ) { // If not modified check if the case has already defined regions with zones - HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions(); + HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions( false ); if ( aSeq.Length() > 0 ) { // If there are already defined zones then ask a user to confirm zones recalculation @@ -649,7 +653,7 @@ bool HYDROGUI_CalculationOp::confirmModeChange() const if ( !isConfirmed ) { // If not modified check if the case has already defined regions with zones - HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions(); + HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions( false ); if ( aSeq.Length() > 0 ) { // If there are already defined zones then ask a user to confirm zones recalculation @@ -973,13 +977,13 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) myShowZones = true; myEditedObject->Update(); - AssignDefaultZonesColors(); + AssignDefaultZonesColors( false ); //aPanel->setEditedObject( myEditedObject ); aPanel->refreshZonesBrowser(); closePreview(); - createPreview(); + createPreview( false ); anIsToUpdateOb = true; @@ -987,21 +991,14 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) } else { - setZonesVisible( true ); + // Show zones + setZonesVisible( true, false ); if ( isNameChanged ) { module()->getDataModel()->updateObjectTree( myEditedObject ); } } - // Move this code to processing od the last panel (see below) - if ( anIsToUpdateOb ) { - SUIT_DataBrowser* anObjBrowser = ((LightApp_Application*)module()->application())->objectBrowser(); - if ( anObjBrowser ) { - anObjBrowser->updateTree( module()->getDataModel()->getDataObject( myEditedObject ), false ); - } - } - QApplication::restoreOverrideCursor(); } else if( theIndex==4 ) @@ -1045,19 +1042,60 @@ void HYDROGUI_CalculationOp::onNext( const int theIndex ) } aPanel->setEditLandCoversEnabled( aMode == HYDROData_CalculationCase::MANUAL ); + bool anIsToUpdateOb = false; + if ( myEditedObject->IsMustBeUpdated() ) + { + myShowZones = true; + myEditedObject->Update(); + + AssignDefaultZonesColors( true ); + + aPanel->refreshLandCoverZonesBrowser(); + + closePreview(); + createPreview( true ); + + anIsToUpdateOb = true; + + myEditedObject->SetToUpdate( true ); + } + else + { + // Hide zones + setZonesVisible( false, false ); + // Show land cover zones + setZonesVisible( true, true ); + } + + if ( anIsToUpdateOb ) { + SUIT_DataBrowser* anObjBrowser = ((LightApp_Application*)module()->application())->objectBrowser(); + if ( anObjBrowser ) { + anObjBrowser->updateTree( module()->getDataModel()->getDataObject( myEditedObject ), false ); + } + } + QApplication::restoreOverrideCursor(); } } -void HYDROGUI_CalculationOp::onHideZones() +void HYDROGUI_CalculationOp::onHideZones( const int theIndex ) { - setZonesVisible( false ); + if( theIndex==3 ) + { + // Hide zones + setZonesVisible( false, false ); + } + else if( theIndex==4 ) + { + // Hide land cover zones + setZonesVisible( false, true ); + } } -void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible ) +void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible, const bool theLandCover ) { myShowZones = theIsVisible; - HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions(); + HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions( theLandCover ); HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions ); HYDROData_SequenceOfObjects aZones; Handle(HYDROData_Region) aRegion; @@ -1088,9 +1126,9 @@ void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible ) } } -void HYDROGUI_CalculationOp::AssignDefaultZonesColors() +void HYDROGUI_CalculationOp::AssignDefaultZonesColors( const bool theLandCover ) { - HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions(); + HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions( theLandCover ); HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions ); HYDROData_SequenceOfObjects aZones; Handle(HYDROData_Region) aRegion; @@ -1192,16 +1230,45 @@ void HYDROGUI_CalculationOp::setRules( HYDROData_CalculationCase::DataTag theDat aPanel->setLandCoverRules( aRules ); } -void HYDROGUI_CalculationOp::createPreview() +bool HYDROGUI_CalculationOp::createRegion( const QList& theZonesList, + const bool theLandCover ) +{ + bool aRetValue = false; + + QList aZonesList; + HYDROGUI_Zone* aZone; + // Get a list of dropped zones + for ( int i = 0; i < theZonesList.length(); i++ ) + { + aZone = dynamic_cast( theZonesList.at( i ) ); + if ( aZone ) + { + aZonesList.append( aZone ); + } + } + if ( aZonesList.length() > 0 ) + { + module()->getDataModel()->createNewRegion( myEditedObject, aZonesList, theLandCover ); + aRetValue = true; + } + + return aRetValue; +} + +void HYDROGUI_CalculationOp::createPreview( const bool theLandCover ) { LightApp_Application* anApp = module()->getApp(); - HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects(); + HYDROData_SequenceOfObjects aSeq; + if ( theLandCover ) + aSeq = myEditedObject->GetLandCovers(); + else + aSeq = myEditedObject->GetGeometryObjects(); Handle(HYDROData_Entity) anEntity; if ( myShowZones ) { // Gather zones for displaying - HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions(); + HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions( theLandCover ); HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions ); HYDROData_SequenceOfObjects aZones; Handle(HYDROData_Region) aRegion; @@ -1469,8 +1536,7 @@ void HYDROGUI_CalculationOp::onAddLandCovers() if ( !anAddedList.isEmpty() ) { aPanel->includeLandCovers( anAddedList, false ); - // TODO: create preview of included land covers - //createPreview(); + createPreview( true ); } } diff --git a/src/HYDROGUI/HYDROGUI_CalculationOp.h b/src/HYDROGUI/HYDROGUI_CalculationOp.h index 4966ee3c..2e0c0fae 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_CalculationOp.h @@ -108,6 +108,10 @@ protected slots: * Selected zones are moved to the new region to be created. */ void onCreateRegion( const QList& theZonesList ); + /** + * Selected land cover zones are moved to the new region to be created. + */ + void onCreateLandCoverRegion( const QList& theZonesList ); /** * Case objects must be splitted to zones if the case has been modified or new. */ @@ -120,7 +124,7 @@ protected slots: /** * Hide zones in the viewer. */ - void onHideZones(); + void onHideZones( const int ); /** * Geometry object is selected in the list on the first wizard page */ @@ -142,17 +146,17 @@ protected slots: void onOrderLandCoverChanged( bool& isConfirmed ); private: - void createPreview(); + void createPreview( const bool theLandCover); void closePreview(); void setObjectVisibility( Handle(HYDROData_Entity) theEntity, const bool theIsVisible ); - void setZonesVisible( bool theIsVisible ); + void setZonesVisible( bool theIsVisible, const bool theLandCover ); void getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq, QStringList& theNames, QStringList& theEntries ) const; /** * Internal method that used to assign unique default colors for zones */ - void AssignDefaultZonesColors(); + void AssignDefaultZonesColors( const bool theLandCover ); /** * Internal method that used to generate default color for zone * @param theIndex the index of color to be generated @@ -171,6 +175,9 @@ private: void setRules( HYDROData_CalculationCase::DataTag theDataTag ); + bool createRegion( const QList& theZonesList, + const bool theLandCover ); + bool confirmRegionsChange() const; bool confirmModeChange() const; bool confirmOrderChange() const; diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 06a0ab41..623920a0 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -985,7 +985,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, LightApp_DataObject* aCaseRegionsSect = createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() ); - HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions(); + HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions( false ); HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions ); for ( ; anIter.More(); anIter.Next() ) { @@ -995,6 +995,10 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, createRegion( aCaseRegionsSect, aCaseRegion, "", true, theIsInOperation ); } + // TODO: Build object tree for land cover regions + //HYDROData_SequenceOfObjects aCaseLandCoverRegions = aCaseObj->GetRegions( true ); + //... + #ifdef DEB_GROUPS HYDROData_SequenceOfObjects aCalcGroups = aCaseObj->GetGeometryGroups(); buildObjectPartition( aGuiObj, aCalcGroups, tr( "OBJECT_GROUPS" ), false ); @@ -1083,7 +1087,7 @@ void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDRO new HYDROGUI_DropTargetObject( theParent, tr( "NEW_REGION" ), "", true ); - HYDROData_SequenceOfObjects aCaseRegions = theCase->GetRegions(); + HYDROData_SequenceOfObjects aCaseRegions = theCase->GetRegions( false ); HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions ); for ( ; anIter.More(); anIter.Next() ) { @@ -1092,6 +1096,10 @@ void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDRO if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() ) createRegion( theParent, aCaseRegion, "", true, true ); } + + // TODO: Create land cover regions + //HYDROData_SequenceOfObjects aCaseLandCoverRegions = theCase->GetRegions( true ); + //... } } @@ -1154,7 +1162,8 @@ SUIT_DataObject* HYDROGUI_DataModel::findChildByName( const SUIT_DataObject* the } bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase, - const QList& theZonesList ) + const QList& theZonesList, + const bool theLandCover ) { bool isOk = !theCase.IsNull(); if ( isOk ) @@ -1168,7 +1177,7 @@ bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theC { if ( aRegion.IsNull() ) { - aRegion = theCase->AddNewRegion( aZone ); + aRegion = theCase->AddNewRegion( aZone, theLandCover ); isOk = !aRegion.IsNull(); } else diff --git a/src/HYDROGUI/HYDROGUI_DataModel.h b/src/HYDROGUI/HYDROGUI_DataModel.h index f8b4a701..6edb11f6 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.h +++ b/src/HYDROGUI/HYDROGUI_DataModel.h @@ -144,7 +144,9 @@ public: /** * Create a new region in the given calculation case containing given zones. */ - bool createNewRegion( Handle(HYDROData_CalculationCase) theCase, const QList& theZonesList ); + bool createNewRegion( Handle(HYDROData_CalculationCase) theCase, + const QList& theZonesList, + const bool theLandCover ); /** * Correct an internal model object according to the current document mode diff --git a/src/HYDROPy/HYDROData_CalculationCase.sip b/src/HYDROPy/HYDROData_CalculationCase.sip index 7a2eeeaf..0579fb9a 100644 --- a/src/HYDROPy/HYDROData_CalculationCase.sip +++ b/src/HYDROPy/HYDROData_CalculationCase.sip @@ -78,7 +78,9 @@ public: DataTag_StricklerTable, ///< reference Strickler table DataTag_LandCover, ///< reference land covers DataTag_CustomLandCoverRules, ///< custom rules for land covers priority - DataTag_AssignmentLandCoverMode ///< assignment mode of land covers priority + DataTag_AssignmentLandCoverMode, ///< assignment mode of land covers priority + DataTag_ChildLandCoverRegion, ///< child land cover regions + DataTag_LandCoverRegion ///< reference land cover regions }; public: @@ -220,7 +222,7 @@ public: * The label of theZone is changed during this operation * because of new region becomes the new parent for this zone. */ - HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )]; + HYDROData_Region AddNewRegion( HYDROData_Zone theZone, const bool theLandCover ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone&, const bool )]; %MethodCode Handle(HYDROData_Zone) aRef = Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) ); @@ -229,8 +231,8 @@ public: if ( !aRef.IsNull() ) { Py_BEGIN_ALLOW_THREADS - aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) : - sipCpp->AddNewRegion( aRef ); + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef, a1 ) : + sipCpp->AddNewRegion( aRef, a1 ); Py_END_ALLOW_THREADS } @@ -241,15 +243,15 @@ public: * Add new one reference region for calculation case. * The label of theRegion is changed in case if old parent is not this calculation. */ - bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )]; + bool AddRegion( HYDROData_Region theRegion, const bool theLandCover ) [bool ( const Handle_HYDROData_Region&, const bool )]; %MethodCode Handle(HYDROData_Region) aRef = Handle(HYDROData_Region)::DownCast( createHandle( a0 ) ); if ( !aRef.IsNull() ) { Py_BEGIN_ALLOW_THREADS - sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ): - sipCpp->AddRegion( aRef ); + sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef, a1 ): + sipCpp->AddRegion( aRef, a1 ); Py_END_ALLOW_THREADS } %End @@ -257,7 +259,7 @@ public: /** * Returns all reference regions of calculation case. */ - HYDROData_SequenceOfObjects GetRegions() const; + HYDROData_SequenceOfObjects GetRegions( const bool theLandCover ) const; /** * Updates names of regions to correct order. @@ -286,7 +288,7 @@ public: /** * Removes all reference regions from calculation case. */ - void RemoveRegions(); + void RemoveRegions( const bool theLandCover ); /** @@ -444,16 +446,17 @@ public: * \return result region */ HYDROData_Region GetRegionFromPoint( const double theCoordX, - const double theCoordY ) const - [Handle_HYDROData_Region ( const gp_XY& )]; + const double theCoordY, + const bool theLandCover ) const + [Handle_HYDROData_Region ( const gp_XY&, const bool )]; %MethodCode Handle(HYDROData_Region) aRes; gp_XY aPnt( a0, a1 ); Py_BEGIN_ALLOW_THREADS - aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) : - sipCpp->GetRegionFromPoint( aPnt ); + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt, a2 ) : + sipCpp->GetRegionFromPoint( aPnt, a2 ); Py_END_ALLOW_THREADS sipRes = (HYDROData_Region*)createPointer( aRes ); @@ -465,16 +468,17 @@ public: * \return result zone */ HYDROData_Zone GetZoneFromPoint( const double theCoordX, - const double theCoordY ) const - [Handle_HYDROData_Zone ( const gp_XY& )]; + const double theCoordY, + const bool theLandCover ) const + [Handle_HYDROData_Zone ( const gp_XY&, const bool )]; %MethodCode Handle(HYDROData_Zone) aRes; gp_XY aPnt( a0, a1 ); Py_BEGIN_ALLOW_THREADS - aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) : - sipCpp->GetZoneFromPoint( aPnt ); + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt, a2 ) : + sipCpp->GetZoneFromPoint( aPnt, a2 ); Py_END_ALLOW_THREADS sipRes = (HYDROData_Zone*)createPointer( aRes );