From: adv Date: Mon, 11 Nov 2013 08:04:36 +0000 (+0000) Subject: Boundary polyline added for calculation case. X-Git-Tag: BR_hydro_v_0_3~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc3fa6d57266c37e75871074112b0e738d608110;p=modules%2Fhydro.git Boundary polyline added for calculation case. --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 0561d47e..16f25745 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -5,6 +5,7 @@ #include "HYDROData_Document.h" #include "HYDROData_Iterator.h" #include "HYDROData_NaturalObject.h" +#include "HYDROData_Polyline.h" #include "HYDROData_SplitToZonesTool.h" #include "HYDROData_Region.h" #include "HYDROData_Tool.h" @@ -81,12 +82,13 @@ void HYDROData_CalculationCase::SplitGeometryObjects() if ( aDocument.IsNull() ) return; + Handle(HYDROData_Polyline) aBoundaryPolyline = GetBoundaryPolyline(); HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects(); if ( aGeomObjects.IsEmpty() ) return; HYDROData_SplitToZonesTool::SplitDataList aSplitedZones = - HYDROData_SplitToZonesTool::SplitToZones( aGeomObjects ); + HYDROData_SplitToZonesTool::SplitToZones( aGeomObjects, aBoundaryPolyline ); if ( aSplitedZones.isEmpty() ) return; @@ -168,6 +170,22 @@ void HYDROData_CalculationCase::RemoveGeometryObjects() SetToUpdate( true ); } +void HYDROData_CalculationCase::SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline ) +{ + SetReferenceObject( thePolyline, DataTag_Polyline ); +} + +Handle(HYDROData_Polyline) HYDROData_CalculationCase::GetBoundaryPolyline() const +{ + return Handle(HYDROData_Polyline)::DownCast( + GetReferenceObject( DataTag_Polyline ) ); +} + +void HYDROData_CalculationCase::RemoveBoundaryPolyline() +{ + ClearReferenceObjects( DataTag_Polyline ); +} + Handle(HYDROData_Region) HYDROData_CalculationCase::AddNewRegion( const Handle(HYDROData_Zone)& theZone ) { Handle(HYDROData_Region) aNewRegion = addNewRegion(); diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 79d3aae3..d6d6ac45 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -8,6 +8,7 @@ class Handle(HYDROData_Object); class Handle(HYDROData_Region); class Handle(HYDROData_Zone); +class Handle(HYDROData_Polyline); DEFINE_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity) @@ -29,7 +30,8 @@ protected: DataTag_First = HYDROData_Entity::DataTag_First + 100, ///< first tag, to reserve DataTag_GeometryObject, ///< reference geometry objects DataTag_ChildRegion, ///< child regions - DataTag_Region ///< reference regions + DataTag_Region, ///< reference regions + DataTag_Polyline ///< reference boundary polyline }; public: @@ -77,6 +79,22 @@ public: HYDRODATA_EXPORT virtual void RemoveGeometryObjects(); + /** + * Sets reference boundary polyline object for calculation case. + */ + HYDRODATA_EXPORT virtual void SetBoundaryPolyline( const Handle(HYDROData_Polyline)& thePolyline ); + + /** + * Returns reference boundary polyline object of calculation case. + */ + HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline) GetBoundaryPolyline() const; + + /** + * Remove reference boundary polyline object from calculation case. + */ + HYDRODATA_EXPORT virtual void RemoveBoundaryPolyline(); + + /** * Add new one child region for calculation case. * The new region is added into the list of reference regions. diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.cxx b/src/HYDROData/HYDROData_SplitToZonesTool.cxx index dfd60b75..2e29c18e 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.cxx +++ b/src/HYDROData/HYDROData_SplitToZonesTool.cxx @@ -1,7 +1,7 @@ #include "HYDROData_SplitToZonesTool.h" -#include "HYDROData_Object.h" +#include "HYDROData_Polyline.h" #include #include @@ -35,7 +35,8 @@ TopoDS_Face HYDROData_SplitToZonesTool::SplitData::Face() const } HYDROData_SplitToZonesTool::SplitDataList -HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& theObjectList ) +HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& theObjectList, + const Handle(HYDROData_Polyline)& thePolyline ) { SplitDataList anOutputSplitDataList; @@ -90,7 +91,6 @@ HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& the } // Step 2. Take into account the boundary polyline. - /* if( !thePolyline.IsNull() ) { TopoDS_Wire aWire = TopoDS::Wire( thePolyline->GetTopShape() ); @@ -117,7 +117,6 @@ HYDROData_SplitToZonesTool::SplitToZones( const HYDROData_SequenceOfObjects& the } } } - */ // Step 3. Extract the separate regions. SplitDataList anExtractedSplitDataList; diff --git a/src/HYDROData/HYDROData_SplitToZonesTool.h b/src/HYDROData/HYDROData_SplitToZonesTool.h index dd70ed42..4552dd8c 100644 --- a/src/HYDROData/HYDROData_SplitToZonesTool.h +++ b/src/HYDROData/HYDROData_SplitToZonesTool.h @@ -41,7 +41,8 @@ public: public: - static SplitDataList SplitToZones( const HYDROData_SequenceOfObjects& theObjectList ); + static SplitDataList SplitToZones( const HYDROData_SequenceOfObjects& theObjectList, + const Handle(HYDROData_Polyline)& thePolyline ); private: