From: asl Date: Wed, 14 Oct 2015 13:38:52 +0000 (+0300) Subject: land cover object is removed from the data model X-Git-Tag: v1.5~78^2~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2b03abaf3d543206a0dd3eca896c05e22490c74e;p=modules%2Fhydro.git land cover object is removed from the data model --- diff --git a/src/HYDROData/CMakeLists.txt b/src/HYDROData/CMakeLists.txt index b8a25442..177a4661 100644 --- a/src/HYDROData/CMakeLists.txt +++ b/src/HYDROData/CMakeLists.txt @@ -43,7 +43,6 @@ set(PROJECT_HEADERS HYDROData_Stream.h HYDROData_StreamAltitude.h HYDROData_StricklerTable.h - HYDROData_LandCover.h HYDROData_Tool.h HYDROData_TopoCurve.h HYDROData_Transform.h @@ -101,7 +100,6 @@ set(PROJECT_SOURCES HYDROData_Stream.cxx HYDROData_StreamAltitude.cxx HYDROData_StricklerTable.cxx - HYDROData_LandCover.cxx HYDROData_Tool.cxx HYDROData_TopoCurve.cxx HYDROData_Transform.cxx diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 2cf4fc27..6c423905 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -29,7 +29,6 @@ #include "HYDROData_NaturalObject.h" #include "HYDROData_PolylineXY.h" #include "HYDROData_StricklerTable.h" -#include "HYDROData_LandCover.h" #include "HYDROData_SplittedShapesGroup.h" #include "HYDROData_Region.h" #include "HYDROData_Tool.h" @@ -65,7 +64,6 @@ #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 @@ -96,9 +94,7 @@ void HYDROData_CalculationCase::SetName( const QString& theName ) if ( anOldCaseName != theName ) { // 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 ); + UpdateRegionsNames( GetRegions(), anOldCaseName, theName ); HYDROData_SequenceOfObjects aGroups = GetSplittedGroups(); @@ -129,10 +125,6 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre QString aModeStr = aMode==MANUAL ? "HYDROData_CalculationCase.MANUAL" : "HYDROData_CalculationCase.AUTOMATIC"; aResList << QString( "%0.SetAssignmentMode( %1 )" ).arg( aCalculName ).arg( aModeStr ); - AssignmentMode aModeLC = GetAssignmentLandCoverMode(); - QString aModeLCStr = aModeLC==MANUAL ? "HYDROData_CalculationCase.MANUAL" : "HYDROData_CalculationCase.AUTOMATIC"; - aResList << QString( "%0.SetAssignmentLandCoverMode( %1 )" ).arg( aCalculName ).arg( aModeLCStr ); - HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects(); HYDROData_SequenceOfObjects::Iterator anIter( aGeomObjects ); for ( ; anIter.More(); anIter.Next() ) @@ -171,8 +163,6 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre if( aMode==AUTOMATIC ) DumpRulesToPython( aCalculName, aResList ); - if( aModeLC==AUTOMATIC ) - DumpLandCoverRulesToPython( aCalculName, aResList ); aResList << QString( "" ); aResList << "# Start the algorithm of the partition and assignment"; @@ -182,14 +172,7 @@ QStringList HYDROData_CalculationCase::DumpToPython( MapOfTreatedObjects& theTre { // Now we restore the // - regions and zones order - DumpRegionsToPython( aResList, theTreatedObjects, GetRegions( false ) ); - } - - if( aModeLC==MANUAL ) - { - // Now we restore the - // - land cover regions and zones order - DumpRegionsToPython( aResList, theTreatedObjects, GetRegions( true ) ); + DumpRegionsToPython( aResList, theTreatedObjects, GetRegions() ); } // Export calculation case @@ -262,13 +245,9 @@ HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetAllReferenceObjects() aResSeq.Append( aBoundaryPolyline ); // Regions - HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions( false ); + HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions(); aResSeq.Append( aSeqOfRegions ); - // Land cover regions - HYDROData_SequenceOfObjects aSeqOfLandCoverRegions = GetRegions( true ); - aResSeq.Append( aSeqOfLandCoverRegions ); - return aResSeq; } @@ -278,8 +257,7 @@ void HYDROData_CalculationCase::Update() SetWarning(); // At first we remove previously created objects - RemoveRegions( false ); - RemoveRegions( true ); + RemoveRegions(); RemoveSplittedGroups(); Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); @@ -308,40 +286,13 @@ void HYDROData_CalculationCase::Update() } } - // Split to land cover zones - HYDROData_SplitToZonesTool::SplitDataList aLandCoverZonesList; - - HYDROData_SequenceOfObjects aLandCovers = GetLandCovers(); - if ( !aLandCovers.IsEmpty() ) { - HYDROData_SplitToZonesTool::SplitDataList aSplitLandCoverObjects = - HYDROData_SplitToZonesTool::Split( aLandCovers ); - if ( !aSplitLandCoverObjects.isEmpty() ) { - 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 ); - } - } - } - switch( GetAssignmentMode() ) { case MANUAL: - CreateRegionsDef( aDocument, aZonesList, false ); + CreateRegionsDef( aDocument, aZonesList ); break; case AUTOMATIC: - CreateRegionsAuto( aDocument, aZonesList, false ); - break; - } - - switch( GetAssignmentLandCoverMode() ) - { - case MANUAL: - CreateRegionsDef( aDocument, aLandCoverZonesList, true ); - break; - case AUTOMATIC: - CreateRegionsAuto( aDocument, aLandCoverZonesList, true ); + CreateRegionsAuto( aDocument, aZonesList ); break; } @@ -349,19 +300,18 @@ void HYDROData_CalculationCase::Update() } void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones, - const bool theLandCover ) + const HYDROData_SplitToZonesTool::SplitDataList& theZones ) { // Create result regions for case, by default one zone for one region QString aRegsPref = CALCULATION_REGIONS_PREF; - QString aZonesPref = theLandCover ? CALCULATION_LANDCOVER_ZONES_PREF : CALCULATION_ZONES_PREF; + QString aZonesPref = CALCULATION_ZONES_PREF; HYDROData_SplitToZonesTool::SplitDataListIterator anIter( theZones ); while( anIter.hasNext() ) { const HYDROData_SplitToZonesTool::SplitData& aSplitData = anIter.next(); // Create new region - Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegsPref, theLandCover ); + Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegsPref ); // Add the zone for region Handle(HYDROData_Zone) aRegionZone = aRegion->addNewZone( theDoc, aZonesPref, aSplitData.Face(), aSplitData.ObjectNames ); @@ -369,16 +319,15 @@ void HYDROData_CalculationCase::CreateRegionsDef( const Handle(HYDROData_Documen } void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones, - const bool theLandCover ) + const HYDROData_SplitToZonesTool::SplitDataList& theZones ) { QMap aRegionsMap; //object name to region QMap aRegionNameToObjNameMap; - QString aZonesPref = theLandCover ? CALCULATION_LANDCOVER_ZONES_PREF : CALCULATION_ZONES_PREF; - HYDROData_PriorityQueue aPr( this, theLandCover ? DataTag_CustomLandCoverRules : DataTag_CustomRules ); + QString aZonesPref = CALCULATION_ZONES_PREF; + HYDROData_PriorityQueue aPr( this, DataTag_CustomRules ); // 1. First we create a default region for each object included into the calculation case - HYDROData_SequenceOfObjects anObjects = theLandCover ? GetLandCovers() : GetGeometryObjects(); + HYDROData_SequenceOfObjects anObjects = GetGeometryObjects(); for( int i = anObjects.Lower(), n = anObjects.Upper(); i<=n; i++ ) { Handle(HYDROData_Entity) anObj = anObjects.Value( i ); @@ -386,7 +335,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, theLandCover, false ); + Handle(HYDROData_Region) aRegion = addNewRegion( theDoc, aRegName, false ); aRegionsMap.insert( anObjName, aRegion ); aRegionNameToObjNameMap.insert( aRegName, anObjName ); } @@ -412,11 +361,9 @@ void HYDROData_CalculationCase::CreateRegionsAuto( const Handle(HYDROData_Docume } Handle(HYDROData_Entity) aMergeEntity = aRegObj; - if ( !theLandCover ) { - Handle(HYDROData_Object) aMergeObject = Handle(HYDROData_Object)::DownCast( aMergeEntity ); - if ( !aMergeObject.IsNull() ) { - aMergeEntity = aMergeObject->GetAltitudeObject(); - } + Handle(HYDROData_Object) aMergeObject = Handle(HYDROData_Object)::DownCast( aMergeEntity ); + if ( !aMergeObject.IsNull() ) { + aMergeEntity = aMergeObject->GetAltitudeObject(); } switch( aMergeType ) @@ -623,48 +570,10 @@ void HYDROData_CalculationCase::RemoveStricklerTable() SetToUpdate( !aPrevStricklerTable.IsNull() || IsMustBeUpdated() ); } -bool HYDROData_CalculationCase::AddLandCover( const Handle(HYDROData_LandCover)& theLandCover ) -{ - if ( HasReference( theLandCover, DataTag_LandCover ) ) - return false; // Land cover is already in reference list - - AddReferenceObject( theLandCover, DataTag_LandCover ); - - // Indicate model of the need to update land covers partition - SetToUpdate( true ); - - return true; -} - -HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetLandCovers() const -{ - return GetReferenceObjects( DataTag_LandCover ); -} - -void HYDROData_CalculationCase::RemoveLandCover( const Handle(HYDROData_LandCover)& theLandCover ) -{ - if ( theLandCover.IsNull() ) - return; - - RemoveReferenceObject( theLandCover->Label(), DataTag_LandCover ); - - // Indicate model of the need to update land cover partition - SetToUpdate( true ); -} - -void HYDROData_CalculationCase::RemoveLandCovers() -{ - ClearReferenceObjects( DataTag_LandCover ); - - // Indicate model of the need to update land cover partition - SetToUpdate( true ); -} - -Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone, - const bool theLandCover ) +Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone ) { Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); - Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF, theLandCover ); + Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF ); if ( aNewRegion.IsNull() ) return aNewRegion; @@ -673,16 +582,14 @@ Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(H return aNewRegion; } -bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRegion, - const bool theLandCover ) +bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRegion ) { Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); if ( theRegion.IsNull() ) return false; - HYDROData_CalculationCase::DataTag aDataTag = - theLandCover ? DataTag_LandCoverRegion : DataTag_Region; + HYDROData_CalculationCase::DataTag aDataTag = DataTag_Region; if ( HasReference( theRegion, aDataTag ) ) return false; // Object is already in reference list @@ -692,10 +599,10 @@ 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, theLandCover ); + Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF ); theRegion->CopyTo( aNewRegion, true ); - aFatherCalc->RemoveRegion( theRegion, theLandCover ); + aFatherCalc->RemoveRegion( theRegion ); theRegion->SetLabel( aNewRegion->Label() ); } @@ -707,9 +614,9 @@ bool HYDROData_CalculationCase::AddRegion( const Handle(HYDROData_Region)& theRe return true; } -HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetRegions( const bool theLandCover ) const +HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetRegions() const { - return GetReferenceObjects( theLandCover ? DataTag_LandCoverRegion : DataTag_Region ); + return GetReferenceObjects( DataTag_Region ); } void HYDROData_CalculationCase::UpdateRegionsOrder() @@ -718,10 +625,7 @@ void HYDROData_CalculationCase::UpdateRegionsOrder() if ( aDocument.IsNull() ) return; - HYDROData_SequenceOfObjects aRegions = GetRegions( false ); - HYDROData_SequenceOfObjects aRegionsLC = GetRegions( true ); - aRegions.Append( aRegionsLC ); - + HYDROData_SequenceOfObjects aRegions = GetRegions(); HYDROData_SequenceOfObjects::Iterator anIter( aRegions ); for ( ; anIter.More(); anIter.Next() ) { @@ -748,14 +652,12 @@ void HYDROData_CalculationCase::UpdateRegionsOrder() } } -void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& theRegion, - const bool theLandCover ) +void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& theRegion ) { if ( theRegion.IsNull() ) return; - HYDROData_CalculationCase::DataTag aDataTag = - theLandCover ? DataTag_LandCoverRegion : DataTag_Region; + HYDROData_CalculationCase::DataTag aDataTag = DataTag_Region; RemoveReferenceObject( theRegion->Label(), aDataTag ); // Remove region from data model @@ -765,9 +667,9 @@ void HYDROData_CalculationCase::RemoveRegion( const Handle(HYDROData_Region)& th theRegion->Remove(); } -void HYDROData_CalculationCase::RemoveRegions( const bool theLandCover ) +void HYDROData_CalculationCase::RemoveRegions() { - myLab.FindChild( theLandCover ? DataTag_ChildLandCoverRegion : DataTag_ChildRegion ).ForgetAllAttributes(); + myLab.FindChild( DataTag_ChildRegion ).ForgetAllAttributes(); } HYDROData_SequenceOfObjects HYDROData_CalculationCase::GetSplittedGroups() const @@ -782,7 +684,7 @@ void HYDROData_CalculationCase::RemoveSplittedGroups() double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint ) const { - Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, false ); + Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint ); return GetAltitudeForPoint( thePoint, aZone ); } @@ -791,7 +693,7 @@ double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& { double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude(); - Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, false ); + Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint ); if ( !aZone.IsNull() ) { Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() ); @@ -925,54 +827,26 @@ NCollection_Sequence HYDROData_CalculationCase::GetAltitudesForPoints( double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const { - double aCoeff = 0; - Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); - if ( !aDocument.IsNull() ) - aCoeff = aDocument->GetDefaultStricklerCoefficient(); - - Handle(HYDROData_LandCover) aLandCover; - Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, Standard_True ); - if ( !aZone.IsNull() ) - { - HYDROData_SequenceOfObjects anObjList = aZone->GetObjects(); - if ( anObjList.Length() == 1 ) - aLandCover = Handle(HYDROData_LandCover)::DownCast( anObjList.First() ); - else - aLandCover = Handle(HYDROData_LandCover)::DownCast( aZone->GetMergeObject() ); - } - - if ( !aLandCover.IsNull() ) - { - QString aType = aLandCover->GetStricklerType(); - Handle(HYDROData_StricklerTable) aTable = GetStricklerTable(); - if ( !aTable.IsNull() ) - { - if ( aTable->GetTypes().contains( aType ) ) - aCoeff = aTable->Get( aType, aCoeff ); - } - } - - return aCoeff; + //TODO: #652 + return 0.0; } -Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint, - const bool theLandCover ) const +Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const { Handle(HYDROData_Region) aResRegion; - Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint, theLandCover ); + Handle(HYDROData_Zone) aZone = GetZoneFromPoint( thePoint ); if ( !aZone.IsNull() ) aResRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() ); return aResRegion; } -Handle(HYDROData_Zone) HYDROData_CalculationCase::GetZoneFromPoint( const gp_XY& thePoint, - const bool theLandCover ) const +Handle(HYDROData_Zone) HYDROData_CalculationCase::GetZoneFromPoint( const gp_XY& thePoint ) const { Handle(HYDROData_Zone) aResZone; - HYDROData_SequenceOfObjects aRegions = GetRegions( theLandCover ); + HYDROData_SequenceOfObjects aRegions = GetRegions(); HYDROData_SequenceOfObjects::Iterator anIter( aRegions ); for ( ; anIter.More() && aResZone.IsNull(); anIter.Next() ) @@ -1033,15 +907,14 @@ 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( theLandCover ? DataTag_ChildLandCoverRegion : DataTag_ChildRegion ).NewChild(); + TDF_Label aNewLab = myLab.FindChild( DataTag_ChildRegion ).NewChild(); int aTag = aNewLab.Tag(); Handle(HYDROData_Region) aNewRegion = Handle(HYDROData_Region)::DownCast( HYDROData_Iterator::CreateObject( aNewLab, KIND_REGION ) ); - AddRegion( aNewRegion, theLandCover ); + AddRegion( aNewRegion ); QString aRegionName = isPrefix ? HYDROData_Tool::GenerateObjectName( theDoc, thePrefixOrName ) : thePrefixOrName; aNewRegion->SetName( aRegionName ); @@ -1108,7 +981,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, // Get faces bool isAllNotSubmersible = true; TopTools_ListOfShape aFaces; - HYDROData_SequenceOfObjects aCaseRegions = GetRegions( false ); + HYDROData_SequenceOfObjects aCaseRegions = GetRegions(); HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions ); for ( ; aRegionIter.More(); aRegionIter.Next() ) { @@ -1324,12 +1197,6 @@ QString HYDROData_CalculationCase::DumpRules() const return HYDROData_PriorityQueue::DumpRules( aRulesLab ); } -QString HYDROData_CalculationCase::DumpLandCoverRules() const -{ - TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomLandCoverRules ); - return HYDROData_PriorityQueue::DumpRules( aRulesLab ); -} - void HYDROData_CalculationCase::SetAssignmentMode( AssignmentMode theMode ) { TDF_Label aModeLab = myLab.FindChild( DataTag_AssignmentMode ); @@ -1356,13 +1223,6 @@ void HYDROData_CalculationCase::DumpRulesToPython( const QString& theCalcCaseNam HYDROData_PriorityQueue::DumpRulesToPython( aRulesLab, theCalcCaseName, theScript ); } -void HYDROData_CalculationCase::DumpLandCoverRulesToPython( const QString& theCalcCaseName, - QStringList& theScript ) const -{ - TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomLandCoverRules ); - HYDROData_PriorityQueue::DumpRulesToPython( aRulesLab, theCalcCaseName, theScript ); -} - HYDROData_Warning HYDROData_CalculationCase::GetLastWarning() const { return myLastWarning; @@ -1432,22 +1292,3 @@ bool HYDROData_CalculationCase::GetRule( int theIndex, return HYDROData_PriorityQueue::GetRule( aRulesLab, theIndex, theObject1, thePriority, theObject2, theMergeType ); } - -void HYDROData_CalculationCase::SetAssignmentLandCoverMode( AssignmentMode theMode ) -{ - TDF_Label aModeLab = myLab.FindChild( DataTag_AssignmentLandCoverMode ); - TDataStd_Integer::Set( aModeLab, ( int ) theMode ); - - // Indicate model of the need to update land covers partition - SetToUpdate( true ); -} - -HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentLandCoverMode() const -{ - Handle(TDataStd_Integer) aModeAttr; - bool isOK = myLab.FindChild( DataTag_AssignmentLandCoverMode ).FindAttribute( TDataStd_Integer::GetID(), aModeAttr ); - if( isOK ) - return ( AssignmentMode ) aModeAttr->Get(); - else - return MANUAL; -} diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 4320e4fc..7e52ea2f 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -45,7 +45,6 @@ class Handle(HYDROData_ShapesGroup); class Handle(HYDROData_SplittedShapesGroup); class Handle(HYDROData_Document); class Handle(HYDROData_StricklerTable); -class Handle(HYDROData_LandCover); DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity) @@ -88,11 +87,13 @@ public: DataTag_CustomRules, ///< custom rules DataTag_AssignmentMode, ///< assignment mode 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_ChildLandCoverRegion, ///< child land cover regions - DataTag_LandCoverRegion ///< reference land cover regions + + DataTag_LandCover_Obsolete, ///< reference land covers + DataTag_CustomLandCoverRules_Obsolete, ///< custom rules for land covers priority + DataTag_AssignmentLandCoverMode_Obsolete, ///< assignment mode of land covers priority + DataTag_ChildLandCoverRegion_Obsolete, ///< child land cover regions + DataTag_LandCoverRegion_Obsolete ///< reference land cover regions + }; public: @@ -205,59 +206,28 @@ public: */ HYDRODATA_EXPORT virtual void RemoveStricklerTable(); - - /** - * Add new one reference Land Cover for calculation case. - * \param theLandCover the Land Cover to add - * \return true in case of success - */ - HYDRODATA_EXPORT virtual bool AddLandCover( const Handle(HYDROData_LandCover)& theLandCover ); - - /** - * Returns all reference Land Covers of calculation case. - * \return the list of referenced Land Covers - */ - HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetLandCovers() const; - - /** - * Removes reference Land Cover from calculation case. - * \param theLandCover the Land Cover to remove - */ - HYDRODATA_EXPORT virtual void RemoveLandCover( const Handle(HYDROData_LandCover)& theLandCover ); - - /** - * Removes all reference Land Covers from calculation case. - */ - HYDRODATA_EXPORT virtual void RemoveLandCovers(); - - /** * Add new one child region for calculation case. * The new region is added into the list of reference regions. * The label of theZone is changed during this operation * because of new region becomes the new parent for this zone. - * \param theLandCover if true - Land Cover region will be added * \return the created region */ - HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone, - const bool theLandCover ); + HYDRODATA_EXPORT virtual Handle(HYDROData_Region) AddNewRegion( const Handle(HYDROData_Zone)& theZone ); /** * Add new one reference region for calculation case. * The label of theRegion is changed in case if old parent is not this calculation. - * \param theLandCover if true - Land Cover region will bw created * \return true in case of success */ - HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion, - const bool theLandCover ); + HYDRODATA_EXPORT virtual bool AddRegion( const Handle(HYDROData_Region)& theRegion ); /** * Returns all reference regions of calculation case. - * \param theLandCover if true - Land Cover regions will be returned * \return the list of reference regions */ - HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions( const bool theLandCover ) const; + HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetRegions() const; /** * Updates names of regions to correct order. @@ -267,16 +237,13 @@ public: /** * Removes reference region from calculation case. * \param theRegion the region to remove - * \param theLandCover if true - it means that Land Cover region to be removed */ - HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion, - const bool theLandCover ); + HYDRODATA_EXPORT virtual void RemoveRegion( const Handle(HYDROData_Region)& theRegion ); /** * Removes all reference regions from calculation case. - * \param theLandCover if true - it means that Land Cover regions to be removed */ - HYDRODATA_EXPORT virtual void RemoveRegions( const bool theLandCover ); + HYDRODATA_EXPORT virtual void RemoveRegions(); /** * Returns all reference geometry groups of calculation case. @@ -368,22 +335,18 @@ 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 bool theLandCover ) const; + HYDRODATA_EXPORT virtual Handle(HYDROData_Region) GetRegionFromPoint( const gp_XY& thePoint ) 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 bool theLandCover ) const; + HYDRODATA_EXPORT virtual Handle(HYDROData_Zone) GetZoneFromPoint( const gp_XY& thePoint ) const; /** * Returns classification of point for given zone. @@ -412,11 +375,7 @@ public: HYDROData_Zone::MergeType& theMergeType, HYDROData_CalculationCase::DataTag& theDataTag ) const; - HYDRODATA_EXPORT void SetAssignmentLandCoverMode( AssignmentMode theMode ); - HYDRODATA_EXPORT AssignmentMode GetAssignmentLandCoverMode() const; - HYDRODATA_EXPORT QString DumpRules() const; - HYDRODATA_EXPORT QString DumpLandCoverRules() const; HYDRODATA_EXPORT HYDROData_Warning GetLastWarning() const; @@ -428,7 +387,6 @@ private: */ Handle(HYDROData_Region) addNewRegion( const Handle(HYDROData_Document)& theDoc, const QString& thePrefixOrName, - const bool theLandCover, bool isPrefix = true ); /** @@ -453,17 +411,14 @@ private: #endif void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones, - const bool theLandCover ); + const HYDROData_SplitToZonesTool::SplitDataList& theZones ); void CreateRegionsAuto( const Handle(HYDROData_Document)& theDoc, - const HYDROData_SplitToZonesTool::SplitDataList& theZones, - const bool theLandCover ); + const HYDROData_SplitToZonesTool::SplitDataList& theZones ); void CreateEdgeGroupsDef( const Handle(HYDROData_Document)& theDoc, const HYDROData_SplitToZonesTool::SplitDataList& theEdges ); void DumpRulesToPython( const QString& theCalcCaseName, QStringList& theScript ) const; - void DumpLandCoverRulesToPython( const QString& theCalcCaseName, QStringList& theScript ) const; void SetWarning( HYDROData_WarningType theType = WARN_OK, const QString& theData = "" ); diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index 2086ccf1..7f89f137 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -620,7 +620,7 @@ QString HYDROData_Entity::getPyTypeID() const case KIND_STREAM_ALTITUDE: return "KIND_STREAM_ALTITUDE"; case KIND_OBSTACLE_ALTITUDE: return "KIND_OBSTACLE_ALTITUDE"; case KIND_STRICKLER_TABLE: return "KIND_STRICKLER_TABLE"; - case KIND_LAND_COVER: return "KIND_LAND_COVER"; + case KIND_LAND_COVER_OBSOLETE: return ""; case KIND_LAND_COVER_MAP: return "KIND_LAND_COVER_MAP"; default: return "KIND_UNKNOWN"; ///! Unrecognized object } diff --git a/src/HYDROData/HYDROData_Entity.h b/src/HYDROData/HYDROData_Entity.h index 243a41a2..7a1391a4 100644 --- a/src/HYDROData/HYDROData_Entity.h +++ b/src/HYDROData/HYDROData_Entity.h @@ -37,36 +37,36 @@ class Handle_HYDROData_Entity; ///! Kind of an object in a document typedef int ObjectKind; -const ObjectKind KIND_UNKNOWN = 0; ///! Unrecognized object -const ObjectKind KIND_IMAGE = 1; -const ObjectKind KIND_POLYLINE = 2; -const ObjectKind KIND_BATHYMETRY = 3; -const ObjectKind KIND_ALTITUDE = 4; -const ObjectKind KIND_IMMERSIBLE_ZONE = 5; -const ObjectKind KIND_RIVER = 6; -const ObjectKind KIND_STREAM = 7; -const ObjectKind KIND_CONFLUENCE = 8; -const ObjectKind KIND_CHANNEL = 9; -const ObjectKind KIND_OBSTACLE = 10; -const ObjectKind KIND_DIGUE = 11; -const ObjectKind KIND_PROFILE = 12; -const ObjectKind KIND_PROFILEUZ = 13; -const ObjectKind KIND_POLYLINEXY = 14; -const ObjectKind KIND_CALCULATION = 15; -const ObjectKind KIND_ZONE = 16; -const ObjectKind KIND_REGION = 17; -const ObjectKind KIND_VISUAL_STATE = 18; -const ObjectKind KIND_ARTIFICIAL_OBJECT = 19; -const ObjectKind KIND_NATURAL_OBJECT = 20; -const ObjectKind KIND_DUMMY_3D = 21; -const ObjectKind KIND_SHAPES_GROUP = 22; -const ObjectKind KIND_SPLITTED_GROUP = 23; -const ObjectKind KIND_STREAM_ALTITUDE = 24; -const ObjectKind KIND_OBSTACLE_ALTITUDE = 25; -const ObjectKind KIND_STRICKLER_TABLE = 26; -const ObjectKind KIND_LAND_COVER = 27; -const ObjectKind KIND_LAND_COVER_MAP = 28; -const ObjectKind KIND_LAST = KIND_LAND_COVER; +const ObjectKind KIND_UNKNOWN = 0; ///! Unrecognized object +const ObjectKind KIND_IMAGE = 1; +const ObjectKind KIND_POLYLINE = 2; +const ObjectKind KIND_BATHYMETRY = 3; +const ObjectKind KIND_ALTITUDE = 4; +const ObjectKind KIND_IMMERSIBLE_ZONE = 5; +const ObjectKind KIND_RIVER = 6; +const ObjectKind KIND_STREAM = 7; +const ObjectKind KIND_CONFLUENCE = 8; +const ObjectKind KIND_CHANNEL = 9; +const ObjectKind KIND_OBSTACLE = 10; +const ObjectKind KIND_DIGUE = 11; +const ObjectKind KIND_PROFILE = 12; +const ObjectKind KIND_PROFILEUZ = 13; +const ObjectKind KIND_POLYLINEXY = 14; +const ObjectKind KIND_CALCULATION = 15; +const ObjectKind KIND_ZONE = 16; +const ObjectKind KIND_REGION = 17; +const ObjectKind KIND_VISUAL_STATE = 18; +const ObjectKind KIND_ARTIFICIAL_OBJECT = 19; +const ObjectKind KIND_NATURAL_OBJECT = 20; +const ObjectKind KIND_DUMMY_3D = 21; +const ObjectKind KIND_SHAPES_GROUP = 22; +const ObjectKind KIND_SPLITTED_GROUP = 23; +const ObjectKind KIND_STREAM_ALTITUDE = 24; +const ObjectKind KIND_OBSTACLE_ALTITUDE = 25; +const ObjectKind KIND_STRICKLER_TABLE = 26; +const ObjectKind KIND_LAND_COVER_OBSOLETE = 27; +const ObjectKind KIND_LAND_COVER_MAP = 28; +const ObjectKind KIND_LAST = KIND_LAND_COVER_MAP; DEFINE_STANDARD_HANDLE(HYDROData_Entity, MMgt_TShared) diff --git a/src/HYDROData/HYDROData_Iterator.cxx b/src/HYDROData/HYDROData_Iterator.cxx index c92eda18..152a60a5 100644 --- a/src/HYDROData/HYDROData_Iterator.cxx +++ b/src/HYDROData/HYDROData_Iterator.cxx @@ -42,7 +42,6 @@ #include "HYDROData_StreamAltitude.h" #include "HYDROData_Zone.h" #include "HYDROData_StricklerTable.h" -#include "HYDROData_LandCover.h" #include "HYDROData_LandCoverMap.h" #include @@ -153,9 +152,10 @@ Handle(HYDROData_Entity) HYDROData_Iterator::Object( const TDF_Label& theLabel ) case KIND_STREAM_ALTITUDE: aResult = new HYDROData_StreamAltitude(); break; case KIND_OBSTACLE_ALTITUDE: aResult = new HYDROData_ObstacleAltitude(); break; case KIND_STRICKLER_TABLE: aResult = new HYDROData_StricklerTable(); break; - case KIND_LAND_COVER: aResult = new HYDROData_LandCover(); break; - case KIND_LAND_COVER_MAP: aResult = new HYDROData_LandCoverMap(); break; - default: break; + case KIND_LAND_COVER_MAP: aResult = new HYDROData_LandCoverMap(); break; + + case KIND_LAND_COVER_OBSOLETE: break; + default: break; } if ( !aResult.IsNull() ) diff --git a/src/HYDROData/HYDROData_LandCover.cxx b/src/HYDROData/HYDROData_LandCover.cxx deleted file mode 100644 index 278f42c5..00000000 --- a/src/HYDROData/HYDROData_LandCover.cxx +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright (C) 2014-2015 EDF-R&D -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "HYDROData_LandCover.h" - -#include "HYDROData_PolylineXY.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -IMPLEMENT_STANDARD_HANDLE( HYDROData_LandCover, HYDROData_Entity ) -IMPLEMENT_STANDARD_RTTIEXT( HYDROData_LandCover, HYDROData_Entity ) - -HYDROData_LandCover::HYDROData_LandCover() -{ -} - -HYDROData_LandCover::~HYDROData_LandCover() -{ -} - -const ObjectKind HYDROData_LandCover::GetKind() const -{ - return KIND_LAND_COVER; -} - -QStringList HYDROData_LandCover::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const -{ - QStringList aResList = dumpObjectCreation( theTreatedObjects ); - QString aName = GetObjPyName(); - - // Set Strickler type - QString aType = GetStricklerType(); - if ( !aType.isEmpty() ) { - aResList << QString( "" ); - ///< \TODO to be implemented: - // aResList << QString( "%1.SetStricklerType( \"%2\" );" ).arg( aName ).arg( aType ); - aResList << QString( "" ); - } - - // Set polylines - ///< \TODO to be implemented: - - aResList << QString( "" ); - aResList << QString( "%1.Update();" ).arg( aName ); - aResList << QString( "" ); - - return aResList; -} - -HYDROData_SequenceOfObjects HYDROData_LandCover::GetAllReferenceObjects() const -{ - HYDROData_SequenceOfObjects aResSeq = HYDROData_Entity::GetAllReferenceObjects(); - - HYDROData_SequenceOfObjects aSeqOfPolylines = GetPolylines(); - aResSeq.Append( aSeqOfPolylines ); - - return aResSeq; -} - -bool HYDROData_LandCover::IsHas2dPrs() const -{ - return true; -} - -void HYDROData_LandCover::SetStricklerType( const QString& theType ) -{ - TCollection_AsciiString anAsciiStr( theType.toStdString().c_str() ); - TDataStd_AsciiString::Set( myLab.FindChild( DataTag_StricklerType ), anAsciiStr ); -} - -QString HYDROData_LandCover::GetStricklerType() const -{ - QString aType; - - TDF_Label aLabel = myLab.FindChild( DataTag_StricklerType, false ); - if ( !aLabel.IsNull() ) { - Handle(TDataStd_AsciiString) anAsciiStr; - if ( aLabel.FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) { - aType = QString( anAsciiStr->Get().ToCString() ); - } - } - - return aType; -} - -void HYDROData_LandCover::Update() -{ - HYDROData_Entity::Update(); - - removeShape(); - - TCollection_AsciiString anErrorMsg; - TopoDS_Shape aResShape = buildShape( GetPolylines(), anErrorMsg ); - - setShape( aResShape ); -} - -void HYDROData_LandCover::SetPolylines( const HYDROData_SequenceOfObjects& thePolylines ) -{ - SetReferenceObjects( thePolylines, DataTag_Polylines ); - SetToUpdate( true ); -} - -HYDROData_SequenceOfObjects HYDROData_LandCover::GetPolylines() const -{ - return GetReferenceObjects( DataTag_Polylines ); -} - -TopoDS_Shape HYDROData_LandCover::GetShape() const -{ - TopoDS_Shape aShape; - - TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false ); - if ( !aLabel.IsNull() ) - { - Handle(TNaming_NamedShape) aNamedShape; - if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) ) { - aShape = aNamedShape->Get(); - } - } - - return aShape; -} - -void HYDROData_LandCover::SetFillingColor( const QColor& theColor ) -{ - SetColor( theColor, DataTag_FillingColor ); -} - -QColor HYDROData_LandCover::GetFillingColor() const -{ - return GetColor( DefaultFillingColor(), DataTag_FillingColor ); -} - -void HYDROData_LandCover::SetBorderColor( const QColor& theColor ) -{ - SetColor( theColor, DataTag_BorderColor ); -} - -QColor HYDROData_LandCover::GetBorderColor() const -{ - return GetColor( DefaultBorderColor(), DataTag_BorderColor ); -} - -QColor HYDROData_LandCover::DefaultFillingColor() -{ - return QColor( Qt::magenta ); -} - -QColor HYDROData_LandCover::DefaultBorderColor() -{ - return QColor( Qt::transparent ); -} - -void HYDROData_LandCover::setShape( const TopoDS_Shape& theShape ) -{ - TNaming_Builder aBuilder( myLab.FindChild( DataTag_Shape ) ); - aBuilder.Generated( theShape ); -} - -void HYDROData_LandCover::removeShape() -{ - TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false ); - if ( !aLabel.IsNull() ) { - aLabel.ForgetAllAttributes(); - } -} - -TopoDS_Shape HYDROData_LandCover::buildShape( const HYDROData_SequenceOfObjects& thePolylines, - TCollection_AsciiString& theErrorMsg ) -{ - theErrorMsg.Clear(); - TopoDS_Shape aResShape; - - BRepBuilderAPI_MakeWire aMakeWire; - - TopTools_ListOfShape aClosedWires; - - int aNbPolylines = thePolylines.Length(); - for ( int i = 1; i <= aNbPolylines; ++i ) { - Handle(HYDROData_PolylineXY) aPolyline = - Handle(HYDROData_PolylineXY)::DownCast( thePolylines.Value( i ) ); - - if ( aPolyline.IsNull() ) { - continue; - } - - TopoDS_Shape aPolyShape = aPolyline->GetShape(); - if ( aPolyShape.IsNull() ) { - continue; - } - - // Extract polyline wire(s) - TopTools_ListOfShape aPolylineWires; - - if ( aPolyShape.ShapeType() == TopAbs_WIRE ) { - const TopoDS_Wire& aPolylineWire = TopoDS::Wire( aPolyShape ); - if ( !aPolylineWire.IsNull() ) { - aPolylineWires.Append( aPolylineWire ); - } - } else if ( aPolyShape.ShapeType() == TopAbs_COMPOUND ) { - TopExp_Explorer anExp( aPolyShape, TopAbs_WIRE ); - for (; anExp.More(); anExp.Next() ) { - if(!anExp.Current().IsNull()) { - const TopoDS_Wire& aWire = TopoDS::Wire( anExp.Current() ); - aPolylineWires.Append( aWire ); - } - } - } - - TopTools_ListIteratorOfListOfShape anIt( aPolylineWires ); - for ( ; anIt.More(); anIt.Next() ) { - TopoDS_Wire& aWire = TopoDS::Wire( anIt.Value() ); - - if ( aWire.Closed() ) { - aClosedWires.Append( aWire ); - } else { - aMakeWire.Add( aWire ); - aMakeWire.Build(); - if ( aMakeWire.IsDone() ) { - if ( aMakeWire.Wire().Closed() ) { - aClosedWires.Append( aMakeWire.Wire() ); - aMakeWire = BRepBuilderAPI_MakeWire(); - } - } - } - } - } - - if ( aClosedWires.Extent() == 1 ) { - // make face - TopoDS_Wire aW = TopoDS::Wire( aClosedWires.First()); - BRepBuilderAPI_MakeFace aMakeFace( aW ); - aMakeFace.Build(); - if( aMakeFace.IsDone() ) - { - Handle(ShapeAnalysis_Wire) aSAW = new ShapeAnalysis_Wire(aW, aMakeFace.Face(), Precision::Confusion()); - if (!aSAW->CheckSelfIntersection()) - aResShape = aMakeFace.Face(); - else - theErrorMsg = "Can't create landcover on the given polyline\nSelf-intersection of wire have been detected"; - } - } else if ( aClosedWires.Extent() > 1 ) { - // make compound - BRep_Builder aBuilder; - TopoDS_Compound aCompound; - aBuilder.MakeCompound( aCompound ); - TopTools_SequenceOfShape aSeq; - TopTools_ListIteratorOfListOfShape aWiresIter( aClosedWires ); - bool anErrStat = false; - for ( ; aWiresIter.More() && !anErrStat; aWiresIter.Next() ) - { - TopoDS_Wire aW = TopoDS::Wire( aWiresIter.Value() ); - BRepBuilderAPI_MakeFace aMakeFace( aW ); - aMakeFace.Build(); - if( aMakeFace.IsDone() ) - { - Handle(ShapeAnalysis_Wire) aSAW = new ShapeAnalysis_Wire(aW, aMakeFace.Face(), Precision::Confusion()); - if (!aSAW->CheckSelfIntersection()) - aSeq.Append( aMakeFace.Face() ); - else - { - anErrStat = true; - theErrorMsg = "Can't create landcover on the given polyline\nSelf-intersection of wire(s) have been detected"; - } - } - } - if (!anErrStat) - { - for (int i = 1; i <= aSeq.Length(); i++) - aBuilder.Add( aCompound, aSeq(i) ); - aResShape = aCompound; - } - else - aResShape = TopoDS_Shape(); - } else if ( aNbPolylines > 0 ) { - TCollection_AsciiString aSourceName = aNbPolylines > 1 ? "polylines" : "polyline"; - theErrorMsg = "Can't build closed contour on the given "; - theErrorMsg += aSourceName; - } - - ///< \TODO to be reimplemented - /* - TopoDS_Shape anArgShape; - TopTools_ListOfShape aToolShapes; - - HYDROData_SequenceOfObjects aRefPolylines = GetPolylines(); - for ( int i = 1, n = aRefPolylines.Length(); i <= n; ++i ) { - Handle(HYDROData_PolylineXY) aPolyline = - Handle(HYDROData_PolylineXY)::DownCast( aRefPolylines.Value( i ) ); - - if ( aPolyline.IsNull() ) { - continue; - } - - if ( !aPolyline->IsClosed() ) { - continue; - } - - TopoDS_Shape aPolyShape = aPolyline->GetShape(); - if ( aPolyShape.IsNull() || aPolyShape.ShapeType() != TopAbs_WIRE ) { - continue; - } - - const TopoDS_Wire& aPolylineWire = TopoDS::Wire( aPolyShape ); - if ( aPolylineWire.IsNull() ) { - continue; - } - - TopoDS_Face aResultFace = TopoDS_Face(); - BRepBuilderAPI_MakeFace aMakeFace( aPolylineWire, Standard_True ); - aMakeFace.Build(); - if( aMakeFace.IsDone() ) { - aResultFace = aMakeFace.Face(); - } - - if( aResultFace.IsNull() ) { - continue; - } - - if ( anArgShape.IsNull() ) { - anArgShape = aResultFace; - } else { - aToolShapes.Append( aResultFace ); - } - } - - aResShape = anArgShape; - - if ( !anArgShape.IsNull() && aToolShapes.Extent() > 0 ) { - Handle(NCollection_BaseAllocator)aAL=new NCollection_IncAllocator; - BOPAlgo_BOP aBOP(aAL); - - aBOP.AddArgument( anArgShape ); - - TopTools_ListIteratorOfListOfShape anIt(aToolShapes); - for( ; anIt.More(); anIt.Next() ) { - aBOP.AddTool( anIt.Value() ); - } - - aBOP.SetOperation( BOPAlgo_CUT ); - aBOP.Perform(); - - if ( !aBOP.Shape().IsNull() ) { - aResShape = aBOP.Shape(); - } - } - */ - - return aResShape; -} \ No newline at end of file diff --git a/src/HYDROData/HYDROData_LandCover.h b/src/HYDROData/HYDROData_LandCover.h deleted file mode 100644 index 289e4bff..00000000 --- a/src/HYDROData/HYDROData_LandCover.h +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (C) 2014-2015 EDF-R&D -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef HYDROData_LANDCOVER_HeaderFile -#define HYDROData_LANDCOVER_HeaderFile - -#include - -DEFINE_STANDARD_HANDLE( HYDROData_LandCover, HYDROData_Entity ) - -class TopoDS_Shape; - -class HYDROData_LandCover : public HYDROData_Entity -{ -protected: - friend class HYDROData_Iterator; - - enum DataTag - { - DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve - DataTag_Shape, ///< the shape presentation of the land cover - DataTag_StricklerType, ///< the type corresponding to types in the Strickler tables - DataTag_Polylines, ///< the set of reference polylines - DataTag_FillingColor, ///< filling color of the land cover presentation - DataTag_BorderColor ///< border color of the land cover presentation - }; - - HYDRODATA_EXPORT HYDROData_LandCover(); - HYDRODATA_EXPORT ~HYDROData_LandCover(); - -public: - DEFINE_STANDARD_RTTI( HYDROData_LandCover ); - - /** - */ - HYDRODATA_EXPORT virtual const ObjectKind GetKind() const; - - /** - * Dump object to Python script representation. - */ - HYDRODATA_EXPORT virtual QStringList DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const; - - /** - * Returns the list of all reference objects of this object. - */ - HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetAllReferenceObjects() const; - - /** - * Update the shape presentation of the land cover. - * Call this method whenever you made changes for land cover polylines. - */ - HYDRODATA_EXPORT virtual void Update(); - - /** - * Checks that object has 2D presentation. Reimlemented to return true. - */ - HYDRODATA_EXPORT virtual bool IsHas2dPrs() const; - - /** - * Set Strickler type for the land cover. - */ - HYDRODATA_EXPORT virtual void SetStricklerType( const QString& theType ); - - /** - * Returns Strickler type for the land cover. - */ - HYDRODATA_EXPORT virtual QString GetStricklerType() const; - - /** - * Set reference polyline objects for the land cover. - */ - HYDRODATA_EXPORT virtual void SetPolylines( const HYDROData_SequenceOfObjects& thePolylines ); - - /** - * Returns all reference polyline objects of the land cover. - */ - HYDRODATA_EXPORT virtual HYDROData_SequenceOfObjects GetPolylines() const; - - /** - * Returns the shape presentation of the land cover. - */ - HYDRODATA_EXPORT virtual TopoDS_Shape GetShape() const; - - /** - * Sets filling color for land cover. - */ - HYDRODATA_EXPORT virtual void SetFillingColor( const QColor& theColor ); - - /** - * Returns filling color of land cover. - */ - HYDRODATA_EXPORT virtual QColor GetFillingColor() const; - - /** - * Sets border color for land cover. - */ - HYDRODATA_EXPORT virtual void SetBorderColor( const QColor& theColor ); - - /** - * Returns border color of land cover. - */ - HYDRODATA_EXPORT virtual QColor GetBorderColor() const; - - /** - * Returns default filling color for new land cover. - */ - HYDRODATA_EXPORT static QColor DefaultFillingColor(); - - /** - * Returns default border color for new land cover. - */ - HYDRODATA_EXPORT static QColor DefaultBorderColor(); - - /** - * Build the shape presentation of the land cover. - */ - HYDRODATA_EXPORT static TopoDS_Shape buildShape( const HYDROData_SequenceOfObjects& thePolylines, - TCollection_AsciiString& theErrorMsg ); - - /** - * Sets the shape presentation of the land cover. - */ - HYDRODATA_EXPORT virtual void setShape( const TopoDS_Shape& theShape ); - -protected: - - /** - * Removes the shape from data label of the land cover object. - */ - HYDRODATA_EXPORT virtual void removeShape(); -}; - -#endif diff --git a/src/HYDROData/HYDROData_PriorityQueue.cxx b/src/HYDROData/HYDROData_PriorityQueue.cxx index 12d39ce6..27427dd4 100644 --- a/src/HYDROData/HYDROData_PriorityQueue.cxx +++ b/src/HYDROData/HYDROData_PriorityQueue.cxx @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -27,8 +26,7 @@ HYDROData_PriorityQueue::HYDROData_PriorityQueue( HYDROData_CalculationCase* theCalcCase, Standard_Integer aTag ) { - bool isLandCover = aTag == HYDROData_CalculationCase::DataTag_CustomLandCoverRules; - myObjects = isLandCover ? theCalcCase->GetLandCovers() : theCalcCase->GetGeometryObjects(); + myObjects = theCalcCase->GetGeometryObjects(); for( int i=myObjects.Lower(), n=myObjects.Upper(); i<=n; i++ ) { Handle(HYDROData_Entity) anObj = myObjects.Value( i ); @@ -201,8 +199,7 @@ HYDROData_ListOfRules HYDROData_PriorityQueue::GetRules( const TDF_Label& theRul QString HYDROData_PriorityQueue::DumpRules( const TDF_Label& theRulesLab ) { - bool isLandCover = theRulesLab.Tag() == HYDROData_CalculationCase::DataTag_CustomLandCoverRules; - QString aDump = isLandCover ? "Land Cover rules:\n" : "Rules:\n"; + QString aDump = "Rules:\n"; HYDROData_ListOfRules aRules = GetRules( theRulesLab ); HYDROData_ListOfRules::const_iterator anIt = aRules.begin(), aLast = aRules.end(); @@ -246,10 +243,6 @@ void HYDROData_PriorityQueue::DumpRulesToPython( const TDF_Label& theRulesLab, QString aMergeType; HYDROData_CalculationCase::DataTag aDataTag = HYDROData_CalculationCase::DataTag_CustomRules; - Handle(HYDROData_LandCover) aLandCover1 = Handle(HYDROData_LandCover)::DownCast( anIt->Object1 ); - Handle(HYDROData_LandCover) aLandCover2 = Handle(HYDROData_LandCover)::DownCast( anIt->Object2 ); - if ( !aLandCover1.IsNull() && !aLandCover2.IsNull() ) - aDataTag = HYDROData_CalculationCase::DataTag_CustomLandCoverRules; switch( anIt->MergeType ) { diff --git a/src/HYDROData/HYDROData_ShapeFile.cxx b/src/HYDROData/HYDROData_ShapeFile.cxx index 16f72c78..30cd00f5 100644 --- a/src/HYDROData/HYDROData_ShapeFile.cxx +++ b/src/HYDROData/HYDROData_ShapeFile.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -64,9 +63,10 @@ HYDROData_ShapeFile::~HYDROData_ShapeFile() void HYDROData_ShapeFile::Export(const QString& aFileName, NCollection_Sequence aPolyXYSeq, NCollection_Sequence aPoly3DSeq, - NCollection_Sequence aLCSeq, + const Handle_HYDROData_LandCoverMap& aLCSeq, QStringList& aNonExpList) { + /*TODO SHPHandle hSHPHandle; if (!aPolyXYSeq.IsEmpty() && aPoly3DSeq.IsEmpty()) { @@ -98,7 +98,7 @@ void HYDROData_ShapeFile::Export(const QString& aFileName, QString aFN = aFileName.simplified(); remove (aFN.toStdString().c_str()); remove (aFN.replace( ".shp", ".shx", Qt::CaseInsensitive).toStdString().c_str()); - } + }*/ } int HYDROData_ShapeFile::WriteObjectPolyXY(SHPHandle theShpHandle, Handle_HYDROData_PolylineXY thePoly ) @@ -168,7 +168,7 @@ int HYDROData_ShapeFile::WriteObjectPoly3D(SHPHandle theShpHandle, Handle_HYDROD return 1; } -int HYDROData_ShapeFile::WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC ) +/*TODO:int HYDROData_ShapeFile::WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC ) { TopoDS_Shape aSh = theLC->GetShape(); if (aSh.IsNull()) @@ -215,7 +215,7 @@ int HYDROData_ShapeFile::WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_ return 1; } - +*/ void HYDROData_ShapeFile::ProcessFace(TopoDS_Face theFace, SHPHandle theShpHandle) { SHPObject *aSHPObj; diff --git a/src/HYDROData/HYDROData_ShapeFile.h b/src/HYDROData/HYDROData_ShapeFile.h index e23c9d6e..29a2790a 100644 --- a/src/HYDROData/HYDROData_ShapeFile.h +++ b/src/HYDROData/HYDROData_ShapeFile.h @@ -35,11 +35,11 @@ class gp_XYZ; class Handle_HYDROData_PolylineXY; class Handle_HYDROData_Polyline3D; -class Handle_HYDROData_LandCover; class Handle(HYDROData_Document); class TopTools_SequenceOfShape; class TopoDS_Face; class Handle_HYDROData_Entity; +class Handle_HYDROData_LandCoverMap; class HYDROData_ShapeFile { @@ -58,11 +58,11 @@ public: HYDRODATA_EXPORT void Export(const QString& aFileName, NCollection_Sequence aPolyXYSeq, NCollection_Sequence aPoly3DSeq, - NCollection_Sequence aLCSeq, + const Handle_HYDROData_LandCoverMap& aLCSeq, QStringList& aNonExpList); int WriteObjectPolyXY(SHPHandle theShpHandle, Handle_HYDROData_PolylineXY thePoly ); int WriteObjectPoly3D(SHPHandle theShpHandle, Handle_HYDROData_Polyline3D thePoly ); - int WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC ); + //TODO:int WriteObjectLC(SHPHandle theShpHandle, Handle_HYDROData_LandCover theLC ); //Import bool Parse(SHPHandle theHandle, ShapeType theType, int& theShapeTypeOfFile); //Import Landcover diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index cd7a2d0d..f91732cd 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -19,7 +19,6 @@ #include "HYDROData_SplitToZonesTool.h" #include "HYDROData_PolylineXY.h" -#include "HYDROData_LandCover.h" #include "HYDROData_ShapesGroup.h" #include #include @@ -146,11 +145,6 @@ HYDROData_SplitToZonesTool::SplitDataList Handle(HYDROData_Object) aGeomObj = Handle(HYDROData_Object)::DownCast( anObj ); if( !aGeomObj.IsNull() ) { aShape = aGeomObj->GetTopShape(); - } else { - Handle(HYDROData_LandCover) aLandCoverObj = Handle(HYDROData_LandCover)::DownCast( anObj ); - if ( !aLandCoverObj.IsNull() ) { - aShape = aLandCoverObj->GetShape(); - } } if ( aShape.IsNull() ) diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx index c6e3da1a..33a7cd2f 100644 --- a/src/HYDROData/HYDROData_Zone.cxx +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -22,7 +22,6 @@ #include "HYDROData_IAltitudeObject.h" #include "HYDROData_Document.h" #include "HYDROData_NaturalObject.h" -#include "HYDROData_LandCover.h" #include #include @@ -119,30 +118,6 @@ bool HYDROData_Zone::IsMergingNeed() const return true; } - // Zones based on land cover objects (compare Strickler types) - QString aRefStricklerType; - - anObjsIter.Init( anObjects ); - for ( ; anObjsIter.More(); anObjsIter.Next() ) - { - Handle(HYDROData_LandCover) aRefLandCoverObj = - Handle(HYDROData_LandCover)::DownCast( anObjsIter.Value() ); - if ( aRefLandCoverObj.IsNull() ) - continue; - - QString aStricklerType = aRefLandCoverObj->GetStricklerType(); - - if ( aRefStricklerType.isNull() ) - { - aRefStricklerType = aStricklerType; - continue; - } - - if ( aRefStricklerType != aStricklerType ) - return true; - } - - return false; } @@ -198,8 +173,7 @@ bool HYDROData_Zone::AddObject( const Handle(HYDROData_Entity)& theObject ) return false; if ( !theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) && - !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) && - !theObject->IsKind( STANDARD_TYPE(HYDROData_LandCover) ) ) + !theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ) ) return false; // Wrong type of object if ( HasReference( theObject, DataTag_Object ) ) diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 2f052325..23d8dc98 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include @@ -286,8 +286,8 @@ void HYDROGUI_DataModel::update( const int theStudyId ) // STRICKLER TABLES LightApp_DataObject* aStricklerTablesRootObj = createObject( aNewRootObj, tr( partitionName( KIND_STRICKLER_TABLE ).toAscii() ) ); - // LAND COVERS - LightApp_DataObject* aLandCoversRootObj = createObject( aNewRootObj, tr( partitionName( KIND_LAND_COVER ).toAscii() ) ); + // LAND COVER MAPS + LightApp_DataObject* aLandCoversRootObj = createObject( aNewRootObj, tr( partitionName( KIND_LAND_COVER_MAP ).toAscii() ) ); // CALCULATION CASES LightApp_DataObject* aCalculRootObj = createObject( aNewRootObj, tr( partitionName( KIND_CALCULATION ).toAscii() ) ); @@ -404,12 +404,12 @@ void HYDROGUI_DataModel::update( const int theStudyId ) break; } - case KIND_LAND_COVER: + case KIND_LAND_COVER_MAP: { - Handle(HYDROData_LandCover) aLandCoverObj = - Handle(HYDROData_LandCover)::DownCast( anObj ); - if( !aLandCoverObj.IsNull() ) { - obj = createObject( aLandCoversRootObj, aLandCoverObj ); + Handle(HYDROData_LandCoverMap) aLandCoverMapObj = + Handle(HYDROData_LandCoverMap)::DownCast( anObj ); + if( !aLandCoverMapObj.IsNull() ) { + obj = createObject( aLandCoversRootObj, aLandCoverMapObj ); } break; @@ -710,7 +710,7 @@ QString HYDROGUI_DataModel::partitionName( const ObjectKind theObjectKind ) case KIND_ARTIFICIAL_OBJECT: return "ARTIFICIAL_OBJECTS"; case KIND_NATURAL_OBJECT: return "NATURAL_OBJECTS"; case KIND_STRICKLER_TABLE: return "STRICKLER_TABLES"; - case KIND_LAND_COVER: return "LAND_COVERS"; + case KIND_LAND_COVER_MAP: return "LAND_COVER_MAPS"; default: break; } return QString(); @@ -734,7 +734,7 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject* aKind == KIND_SHAPES_GROUP || aKind == KIND_SPLITTED_GROUP || aKind == KIND_ZONE || aKind == KIND_IMMERSIBLE_ZONE || aKind == KIND_REGION || aKind == KIND_BATHYMETRY || aKind == KIND_OBSTACLE || aKind == KIND_STREAM || aKind == KIND_CHANNEL || - aKind == KIND_DIGUE || aKind == KIND_DUMMY_3D || aKind == KIND_LAND_COVER; + aKind == KIND_DIGUE || aKind == KIND_DUMMY_3D || aKind == KIND_LAND_COVER_MAP; if ( !visibility ) { Handle(HYDROData_Profile) aProfObj = Handle(HYDROData_Profile)::DownCast( theModelObject ); @@ -992,7 +992,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, LightApp_DataObject* aCaseRegionsSect = createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() ); - HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions( false ); + HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions(); HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions ); for ( ; anIter.More(); anIter.Next() ) { @@ -1001,20 +1001,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, if( !aCaseRegion.IsNull() && !aCaseRegion->IsRemoved() ) createRegion( aCaseRegionsSect, aCaseRegion, "", true, theIsInOperation ); } - - LightApp_DataObject* aCaseLandCoverRegionsSect = - createObject( aGuiObj, tr( "CASE_LAND_COVER_REGIONS" ), aGuiObj->entry() ); - - HYDROData_SequenceOfObjects aCaseLandCoverRegions = aCaseObj->GetRegions( true ); - anIter.Init( aCaseLandCoverRegions ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(HYDROData_Region) aCaseLCRegion = - Handle(HYDROData_Region)::DownCast( anIter.Value() ); - if( !aCaseLCRegion.IsNull() && !aCaseLCRegion->IsRemoved() ) - createRegion( aCaseLandCoverRegionsSect, aCaseLCRegion, "", true, theIsInOperation ); - } - + #ifdef DEB_GROUPS HYDROData_SequenceOfObjects aCalcGroups = aCaseObj->GetGeometryGroups(); buildObjectPartition( aGuiObj, aCalcGroups, tr( "OBJECT_GROUPS" ), false ); @@ -1085,19 +1072,19 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent, createObject( aGuiObj, aBottomPolyline, aGuiObj->entry(), false ); } } - else if ( anObjectKind == KIND_LAND_COVER ) + else if ( anObjectKind == KIND_LAND_COVER_MAP ) { - Handle(HYDROData_LandCover) aLandCoverObj = - Handle(HYDROData_LandCover)::DownCast( aDataObj ); + Handle(HYDROData_LandCoverMap) aLandCoverMapObj = + Handle(HYDROData_LandCoverMap)::DownCast( aDataObj ); - HYDROData_SequenceOfObjects aPolylines = aLandCoverObj->GetPolylines(); - buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true ); + /*TODO: reference objects of the land cover map + HYDROData_SequenceOfObjects aPolylines = aLandCoverMapObj->GetPolylines(); + buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true );*/ } } -void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase, - const bool theLandCover ) +void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase ) { if ( !theCase.IsNull() ) { @@ -1113,7 +1100,7 @@ void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDRO new HYDROGUI_DropTargetObject( theParent, tr( "NEW_REGION" ), "", true ); - HYDROData_SequenceOfObjects aCaseRegions = theCase->GetRegions( theLandCover ); + HYDROData_SequenceOfObjects aCaseRegions = theCase->GetRegions(); HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions ); for ( ; anIter.More(); anIter.Next() ) { @@ -1184,8 +1171,7 @@ SUIT_DataObject* HYDROGUI_DataModel::findChildByName( const SUIT_DataObject* the } bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase, - const QList& theZonesList, - const bool theLandCover ) + const QList& theZonesList ) { bool isOk = !theCase.IsNull(); if ( isOk ) @@ -1199,7 +1185,7 @@ bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theC { if ( aRegion.IsNull() ) { - aRegion = theCase->AddNewRegion( aZone, theLandCover ); + aRegion = theCase->AddNewRegion( aZone ); isOk = !aRegion.IsNull(); } else diff --git a/src/HYDROGUI/HYDROGUI_DataModel.h b/src/HYDROGUI/HYDROGUI_DataModel.h index 33d6a07f..6d735d86 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.h +++ b/src/HYDROGUI/HYDROGUI_DataModel.h @@ -150,8 +150,7 @@ public: * Create a new region in the given calculation case containing given zones. */ bool createNewRegion( Handle(HYDROData_CalculationCase) theCase, - const QList& theZonesList, - const bool theLandCover ); + const QList& theZonesList ); /** * Correct an internal model object according to the current document mode @@ -236,8 +235,7 @@ public: * \param theLandCover if true - land cover regions will be represented in the tree */ void buildCaseTree( SUIT_DataObject* theParent, - Handle(HYDROData_CalculationCase) theCase, - const bool theLandCover ); + Handle(HYDROData_CalculationCase) theCase ); /** * Updates the object subtree. diff --git a/src/HYDROGUI/HYDROGUI_ExportFileOp.h b/src/HYDROGUI/HYDROGUI_ExportFileOp.h index d5884f58..65f42b8b 100644 --- a/src/HYDROGUI/HYDROGUI_ExportFileOp.h +++ b/src/HYDROGUI/HYDROGUI_ExportFileOp.h @@ -30,7 +30,6 @@ class SUIT_FileDlg; class gp_XYZ; class Handle_HYDROData_PolylineXY; class Handle_HYDROData_Polyline3D; -class Handle_HYDROData_LandCover; class TopoDS_Face; class HYDROGUI_ExportFileOp : public HYDROGUI_Operation diff --git a/src/HYDROGUI/HYDROGUI_ShapeLandCover.h b/src/HYDROGUI/HYDROGUI_ShapeLandCover.h index 3f89307d..60bee858 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeLandCover.h +++ b/src/HYDROGUI/HYDROGUI_ShapeLandCover.h @@ -21,7 +21,6 @@ #include -class Handle_HYDROData_LandCover; class HYDROGUI_OCCDisplayer; class HYDROGUI_ShapeLandCover : public HYDROGUI_Shape diff --git a/src/HYDROGUI/HYDROGUI_Tool.cxx b/src/HYDROGUI/HYDROGUI_Tool.cxx index 41458254..3ea16053 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.cxx +++ b/src/HYDROGUI/HYDROGUI_Tool.cxx @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -229,7 +228,7 @@ bool HYDROGUI_Tool::IsObjectHasPresentation( const Handle(HYDROData_Entity)& the anObjectKind == KIND_DIGUE || anObjectKind == KIND_DUMMY_3D || anObjectKind == KIND_BATHYMETRY || - anObjectKind == KIND_LAND_COVER + anObjectKind == KIND_LAND_COVER_MAP #ifdef DEB_GROUPS || anObjectKind == KIND_SHAPES_GROUP || anObjectKind == KIND_SPLITTED_GROUP @@ -364,23 +363,6 @@ HYDROData_SequenceOfObjects HYDROGUI_Tool::GetGeometryObjects( return aResSeq; } -HYDROData_SequenceOfObjects HYDROGUI_Tool::GetLandCovers( HYDROGUI_Module* theModule ) -{ - Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() ); - - HYDROData_SequenceOfObjects aResSeq; - - HYDROData_Iterator anIter( aDocument ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(HYDROData_Entity) anObj = anIter.Current(); - if ( !anObj.IsNull() && anObj->IsKind( STANDARD_TYPE(HYDROData_LandCover) )) - aResSeq.Append( anObj ); - } - - return aResSeq; -} - ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule ) { HYDROGUI_DataModel* aModel = theModule->getDataModel(); diff --git a/src/HYDROGUI/HYDROGUI_Tool.h b/src/HYDROGUI/HYDROGUI_Tool.h index 3231d00b..4ea4039e 100644 --- a/src/HYDROGUI/HYDROGUI_Tool.h +++ b/src/HYDROGUI/HYDROGUI_Tool.h @@ -166,13 +166,6 @@ public: */ static HYDROData_SequenceOfObjects GetGeometryObjects( HYDROGUI_Module* theModule ); - /** - * \brief Get the land covers from document. - * \param theModule module - * \return sequence of land covers - */ - static HYDROData_SequenceOfObjects GetLandCovers( HYDROGUI_Module* theModule ); - /** * \brief Get kind of objects the selected partition contains. * \param theModule module diff --git a/src/HYDROPy/HYDROData_CalculationCase.sip b/src/HYDROPy/HYDROData_CalculationCase.sip index 34b90621..c1ebd5ce 100644 --- a/src/HYDROPy/HYDROData_CalculationCase.sip +++ b/src/HYDROPy/HYDROData_CalculationCase.sip @@ -76,11 +76,11 @@ public: DataTag_CustomRules, ///< custom rules DataTag_AssignmentMode, ///< assignment mode 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_ChildLandCoverRegion, ///< child land cover regions - DataTag_LandCoverRegion ///< reference land cover regions + DataTag_LandCover_Obsolete, ///< reference land covers + DataTag_CustomLandCoverRules_Obsolete, ///< custom rules for land covers priority + DataTag_AssignmentLandCoverMode_Obsolete, ///< assignment mode of land covers priority + DataTag_ChildLandCoverRegion_Obsolete, ///< child land cover regions + DataTag_LandCoverRegion_Obsolete ///< reference land cover regions }; public: @@ -222,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, const bool theLandCover ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone&, const bool )]; + HYDROData_Region AddNewRegion( HYDROData_Zone theZone ) [Handle_HYDROData_Region ( const Handle_HYDROData_Zone& )]; %MethodCode Handle(HYDROData_Zone) aRef = Handle(HYDROData_Zone)::DownCast( createHandle( a0 ) ); @@ -231,8 +231,8 @@ public: if ( !aRef.IsNull() ) { Py_BEGIN_ALLOW_THREADS - aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef, a1 ) : - sipCpp->AddNewRegion( aRef, a1 ); + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddNewRegion( aRef ) : + sipCpp->AddNewRegion( aRef ); Py_END_ALLOW_THREADS } @@ -243,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, const bool theLandCover ) [bool ( const Handle_HYDROData_Region&, const bool )]; + bool AddRegion( HYDROData_Region theRegion ) [bool ( const Handle_HYDROData_Region& )]; %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, a1 ): - sipCpp->AddRegion( aRef, a1 ); + sipRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::AddRegion( aRef ): + sipCpp->AddRegion( aRef ); Py_END_ALLOW_THREADS } %End @@ -259,7 +259,7 @@ public: /** * Returns all reference regions of calculation case. */ - HYDROData_SequenceOfObjects GetRegions( const bool theLandCover ) const; + HYDROData_SequenceOfObjects GetRegions() const; /** * Updates names of regions to correct order. @@ -269,7 +269,7 @@ public: /** * Removes reference region from calculation case. */ - void RemoveRegion( HYDROData_Region theRegion, const bool theLandCover ) [void ( const Handle_HYDROData_Region&, const bool )]; + void RemoveRegion( HYDROData_Region theRegion ) [void ( const Handle_HYDROData_Region& )]; %MethodCode Handle(HYDROData_Region) aRef = Handle(HYDROData_Region)::DownCast( createHandle( a0 ) ); @@ -277,9 +277,9 @@ public: { Py_BEGIN_ALLOW_THREADS if ( sipSelfWasArg ) { - sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef, a1 ); + sipCpp->HYDROData_CalculationCase::RemoveRegion( aRef ); } else { - sipCpp->RemoveRegion( aRef, a1 ); + sipCpp->RemoveRegion( aRef ); } Py_END_ALLOW_THREADS } @@ -288,7 +288,7 @@ public: /** * Removes all reference regions from calculation case. */ - void RemoveRegions( const bool theLandCover ); + void RemoveRegions(); /** @@ -462,17 +462,16 @@ public: * \return result region */ HYDROData_Region GetRegionFromPoint( const double theCoordX, - const double theCoordY, - const bool theLandCover ) const - [Handle_HYDROData_Region ( const gp_XY&, const bool )]; + const double theCoordY ) const + [Handle_HYDROData_Region ( const gp_XY& )]; %MethodCode Handle(HYDROData_Region) aRes; gp_XY aPnt( a0, a1 ); Py_BEGIN_ALLOW_THREADS - aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt, a2 ) : - sipCpp->GetRegionFromPoint( aPnt, a2 ); + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetRegionFromPoint( aPnt ) : + sipCpp->GetRegionFromPoint( aPnt ); Py_END_ALLOW_THREADS sipRes = (HYDROData_Region*)createPointer( aRes ); @@ -484,17 +483,16 @@ public: * \return result zone */ HYDROData_Zone GetZoneFromPoint( const double theCoordX, - const double theCoordY, - const bool theLandCover ) const - [Handle_HYDROData_Zone ( const gp_XY&, const bool )]; + const double theCoordY ) const + [Handle_HYDROData_Zone ( const gp_XY& )]; %MethodCode Handle(HYDROData_Zone) aRes; gp_XY aPnt( a0, a1 ); Py_BEGIN_ALLOW_THREADS - aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt, a2 ) : - sipCpp->GetZoneFromPoint( aPnt, a2 ); + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) : + sipCpp->GetZoneFromPoint( aPnt ); Py_END_ALLOW_THREADS sipRes = (HYDROData_Zone*)createPointer( aRes ); @@ -544,14 +542,10 @@ public: %End QString DumpRules(); - QString DumpLandCoverRules(); void SetAssignmentMode( AssignmentMode theMode ); AssignmentMode GetAssignmentMode() const; - void SetAssignmentLandCoverMode( AssignmentMode theMode ); - AssignmentMode GetAssignmentLandCoverMode() const; - protected: /** diff --git a/src/HYDRO_tests/ExternalFiles.cmake b/src/HYDRO_tests/ExternalFiles.cmake index 48d1d12a..45590698 100644 --- a/src/HYDRO_tests/ExternalFiles.cmake +++ b/src/HYDRO_tests/ExternalFiles.cmake @@ -41,7 +41,6 @@ set( EXTERNAL_FILES ../HYDROData/HYDROData_Stream.cxx ../HYDROData/HYDROData_StreamAltitude.cxx ../HYDROData/HYDROData_StricklerTable.cxx - ../HYDROData/HYDROData_LandCover.cxx ../HYDROData/HYDROData_Tool.cxx ../HYDROData/HYDROData_TopoCurve.cxx ../HYDROData/HYDROData_Transform.cxx