X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_Zone.cxx;h=edd4169040c90629a63026d2e6e8bf284bdbd97a;hb=c7cf59e092fe050003d1e556715e3ac97acf6bd4;hp=70272326726f6cf06226ebd22cae9ae70884d477;hpb=8543e637cbb4ae48998c596241fce567a729eb67;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_Zone.cxx b/src/HYDROData/HYDROData_Zone.cxx index 70272326..edd41690 100644 --- a/src/HYDROData/HYDROData_Zone.cxx +++ b/src/HYDROData/HYDROData_Zone.cxx @@ -1,3 +1,24 @@ +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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_Zone.h" @@ -15,8 +36,6 @@ #include -#define PYTHON_ZONE_ID "KIND_ZONE" - IMPLEMENT_STANDARD_HANDLE(HYDROData_Zone, HYDROData_Entity) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity) @@ -24,48 +43,21 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Zone, HYDROData_Entity) HYDROData_Zone::HYDROData_Zone() : HYDROData_Entity() { + myInterpolator = NULL; } HYDROData_Zone::~HYDROData_Zone() { } -QStringList HYDROData_Zone::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const +bool HYDROData_Zone::CanBeUpdated() const { - QStringList aResList; - - Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab ); - if ( aDocument.IsNull() ) - return aResList; - - QString aDocName = aDocument->GetDocPyName(); - QString aZoneName = GetName(); - - aResList << QString( "%1 = %2.CreateObject( %3 );" ) - .arg( aZoneName ).arg( aDocName ).arg( PYTHON_ZONE_ID ); - aResList << QString( "%1.SetName( \"%2\" );" ) - .arg( aZoneName ).arg( aZoneName ); - aResList << QString( "" ); - - HYDROData_SequenceOfObjects aGeomObjects = GetGeometryObjects(); - HYDROData_SequenceOfObjects::Iterator aGeomObjsIter( aGeomObjects ); - for ( ; aGeomObjsIter.More(); aGeomObjsIter.Next() ) - { - Handle(HYDROData_Object) aRefGeomObj = - Handle(HYDROData_Object)::DownCast( aGeomObjsIter.Value() ); - if ( !aRefGeomObj.IsNull() ) - setPythonReferenceObject( theTreatedObjects, aResList, aRefGeomObj, "AddGeometryObject" ); - } - - // How can we get the shape? Mb Update() method to intersect the shapes of reference objects? - // TODO: TopoDS_Shape aRefShape = GetShape(); - - return aResList; + return false; } -bool HYDROData_Zone::CanBeUpdated() const +bool HYDROData_Zone::IsHas2dPrs() const { - return false; + return true; } bool HYDROData_Zone::CanRemove() @@ -91,9 +83,14 @@ void HYDROData_Zone::SetShape( const TopoDS_Shape& theShape ) TopoDS_Shape HYDROData_Zone::GetShape() const { - Handle(TNaming_NamedShape) aNamedShape; - if( myLab.FindChild( DataTag_Shape ).FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) ) - return aNamedShape->Get(); + TDF_Label aLabel = myLab.FindChild( DataTag_Shape, false ); + if ( !aLabel.IsNull() ) + { + Handle(TNaming_NamedShape) aNamedShape; + if( aLabel.FindAttribute( TNaming_NamedShape::GetID(), aNamedShape ) ) + return aNamedShape->Get(); + } + return TopoDS_Shape(); } @@ -127,26 +124,32 @@ bool HYDROData_Zone::IsMergingNeed() const return false; } +void HYDROData_Zone::SetInterpolator( HYDROData_IInterpolator* theInter ) +{ + myInterpolator = theInter; +} + +HYDROData_IInterpolator* HYDROData_Zone::GetInterpolator() const +{ + return myInterpolator; +} + void HYDROData_Zone::SetMergeType( const MergeAltitudesType& theType ) { - Handle(TDataStd_Integer) anInt; - if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) ) - { - anInt->Set( (int)theType ); - } - else - { - anInt = TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType ); - } + TDataStd_Integer::Set( myLab.FindChild( DataTag_MergeType ), (int)theType ); } HYDROData_Zone::MergeAltitudesType HYDROData_Zone::GetMergeType() const { MergeAltitudesType aMergeType = Merge_UNKNOWN; - Handle(TDataStd_Integer) anInt; - if ( myLab.FindChild( DataTag_MergeType ).FindAttribute( TDataStd_Integer::GetID(), anInt ) ) - aMergeType = (MergeAltitudesType)anInt->Get(); + TDF_Label aLabel = myLab.FindChild( DataTag_MergeType, false ); + if ( !aLabel.IsNull() ) + { + Handle(TDataStd_Integer) anInt; + if ( aLabel.FindAttribute( TDataStd_Integer::GetID(), anInt ) ) + aMergeType = (MergeAltitudesType)anInt->Get(); + } return aMergeType; } @@ -180,6 +183,7 @@ bool HYDROData_Zone::AddGeometryObject( const Handle(HYDROData_Object)& theObjec return false; // Object is already in reference list AddReferenceObject( theObject, DataTag_GeometryObject ); + return true; }