// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#ifdef WIN32
- #pragma warning ( disable: 4251 )
-#endif
-
#include "HYDROData_CalculationCase.h"
#include "HYDROData_ArtificialObject.h"
#include "HYDROData_IAltitudeObject.h"
#include "HYDROData_NaturalObject.h"
#include "HYDROData_PolylineXY.h"
#include "HYDROData_StricklerTable.h"
+#include "HYDROData_LandCoverMap.h"
#include "HYDROData_SplittedShapesGroup.h"
#include "HYDROData_Region.h"
#include "HYDROData_Tool.h"
#include "HYDROData_GeomTool.h"
+#ifdef WIN32
+ #pragma warning ( disable: 4251 )
+#endif
+
#ifndef LIGHT_MODE
#include <GEOMBase.h>
#endif
+#ifdef WIN32
+ #pragma warning ( default: 4251 )
+#endif
+
#include <QSet>
#include <TopoDS.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#endif
-#ifdef WIN32
- #pragma warning ( default: 4251 )
-#endif
-
#define EXPORT_NAME "HYDRO_" + GetName()
IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
HYDROData_CalculationCase::HYDROData_CalculationCase()
-: HYDROData_Entity()
+: HYDROData_Entity( Geom_2d_and_groups )
{
}
if ( !aBoundaryPolyline.IsNull() )
aResSeq.Append( aBoundaryPolyline );
+ HYDROData_SequenceOfObjects aSeqOfGeomObjs = GetGeometryObjects();
+ aResSeq.Append( aSeqOfGeomObjs );
+
// Regions
HYDROData_SequenceOfObjects aSeqOfRegions = GetRegions();
aResSeq.Append( aSeqOfRegions );
AddReferenceObject( theObject, DataTag_GeometryObject );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_2d );
return true;
}
RemoveReferenceObject( theObject->Label(), DataTag_GeometryObject );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_2d );
}
void HYDROData_CalculationCase::RemoveGeometryObjects()
ClearReferenceObjects( DataTag_GeometryObject );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_2d );
}
bool HYDROData_CalculationCase::AddGeometryGroup( const Handle(HYDROData_ShapesGroup)& theGroup )
AddReferenceObject( theGroup, DataTag_GeometryGroup );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_Groups );
return true;
}
RemoveReferenceObject( theGroup->Label(), DataTag_GeometryGroup );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_Groups );
}
void HYDROData_CalculationCase::RemoveGeometryGroups()
ClearReferenceObjects( DataTag_GeometryGroup );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_Groups );
}
void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_PolylineXY)& thePolyline )
SetReferenceObject( thePolyline, DataTag_Polyline );
// Indicate model of the need to update zones splitting
- SetToUpdate( !IsEqual( aPrevPolyline, thePolyline ) || IsMustBeUpdated() );
+ if( !IsEqual( aPrevPolyline, thePolyline ) )
+ Changed( Geom_2d );
}
Handle(HYDROData_PolylineXY) HYDROData_CalculationCase::GetBoundaryPolyline() const
ClearReferenceObjects( DataTag_Polyline );
// Indicate model of the need to update zones splitting
- SetToUpdate( !aPrevPolyline.IsNull() || IsMustBeUpdated() );
+ Changed( Geom_2d );
}
void HYDROData_CalculationCase::SetStricklerTable( const Handle(HYDROData_StricklerTable)& theStricklerTable )
SetReferenceObject( theStricklerTable, DataTag_StricklerTable );
// Indicate model of the need to update land covers partition
- SetToUpdate( !IsEqual( aPrevStricklerTable, theStricklerTable ) || IsMustBeUpdated() );
+ if( !IsEqual( aPrevStricklerTable, theStricklerTable ) )
+ Changed( Geom_No );
}
Handle(HYDROData_StricklerTable) HYDROData_CalculationCase::GetStricklerTable() const
ClearReferenceObjects( DataTag_StricklerTable );
// Indicate model of the need to update land covers partition
- SetToUpdate( !aPrevStricklerTable.IsNull() || IsMustBeUpdated() );
+ Changed( Geom_No );
+}
+
+Handle(HYDROData_LandCoverMap) HYDROData_CalculationCase::GetLandCoverMap() const
+{
+ Handle(HYDROData_LandCoverMap) aMap = Handle(HYDROData_LandCoverMap)::DownCast(
+ GetReferenceObject( DataTag_LandCoverMap ) );
+ return aMap;
+}
+
+void HYDROData_CalculationCase::SetLandCoverMap( const Handle(HYDROData_LandCoverMap)& theMap )
+{
+ SetReferenceObject( theMap, DataTag_LandCoverMap );
}
Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone )
{
+ Changed( Geom_No );
+ Changed( Geom_No );
+ Changed( Geom_No );
Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
Handle(HYDROData_Region) aNewRegion = addNewRegion( aDocument, CALCULATION_REGIONS_PREF );
if ( aNewRegion.IsNull() )
double HYDROData_CalculationCase::GetStricklerCoefficientForPoint( const gp_XY& thePoint ) const
{
- //TODO: #652
- return 0.0;
+ Handle( HYDROData_LandCoverMap ) aMap = GetLandCoverMap();
+ Handle( HYDROData_StricklerTable ) aTable = GetStricklerTable();
+ if( aMap.IsNull() )
+ return 0.0;
+
+ QString aType;
+ aMap->FindByPoint( thePoint, aType );
+ double aCoeff = aTable->Get( aType, 0.0 );
+ return aCoeff;
}
Handle(HYDROData_Region) HYDROData_CalculationCase::GetRegionFromPoint( const gp_XY& thePoint ) const
// Indicate model of the need to update splitting
if ( theIsSetToUpdate ) {
- SetToUpdate( true );
+ Changed( Geom_2d );
}
}
HYDROData_PriorityQueue::AddRule( aRulesLab, theObject1, thePriority, theObject2, theMergeType );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_2d );
}
QString HYDROData_CalculationCase::DumpRules() const
TDataStd_Integer::Set( aModeLab, ( int ) theMode );
// Indicate model of the need to update splitting
- SetToUpdate( true );
+ Changed( Geom_2d );
}
HYDROData_CalculationCase::AssignmentMode HYDROData_CalculationCase::GetAssignmentMode() const