X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_IPolyline.cxx;h=adc76d3b87fe47b3b677c041adabcca52240be77;hb=25c483f304a19aace130948fd7f6771bb82bd09c;hp=20fe2099ea3e0d96f04f8cf927a3ac8707ecde4b;hpb=deed826b2d6c39ba2ed410108cdf54d64cded321;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_IPolyline.cxx b/src/HYDROData/HYDROData_IPolyline.cxx old mode 100755 new mode 100644 index 20fe2099..adc76d3b --- a/src/HYDROData/HYDROData_IPolyline.cxx +++ b/src/HYDROData/HYDROData_IPolyline.cxx @@ -1,15 +1,37 @@ +// 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_IPolyline.h" #include +#include +#include +#include #include +#include +#include IMPLEMENT_STANDARD_HANDLE(HYDROData_IPolyline, HYDROData_Entity) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_IPolyline, HYDROData_Entity) HYDROData_IPolyline::HYDROData_IPolyline() -: HYDROData_Entity() +: HYDROData_Entity( Geom_2d ) { } @@ -17,11 +39,71 @@ HYDROData_IPolyline::~HYDROData_IPolyline() { } +void HYDROData_IPolyline::SetWireColor( const QColor& theColor ) +{ + SetColor( theColor, DataTag_WireColor ); +} + +QColor HYDROData_IPolyline::GetWireColor() const +{ + return GetColor( DefaultWireColor(), DataTag_WireColor ); +} + +QColor HYDROData_IPolyline::DefaultWireColor() +{ + return QColor( Qt::black ); +} + int HYDROData_IPolyline::NbPoints( const int theSectionIndex ) const { return GetPoints( theSectionIndex ).Length(); } +TopoDS_Shape HYDROData_IPolyline::GetShape() const +{ + return HYDROData_Entity::GetShape( DataTag_PolylineShape ); +} + +void HYDROData_IPolyline::SetShape( const TopoDS_Shape& theShape ) +{ + HYDROData_Entity::SetShape( DataTag_PolylineShape, theShape ); +} + +void HYDROData_IPolyline::RemovePolylineShape() +{ + SetShape( TopoDS_Shape() ); +} + +void HYDROData_IPolyline::getSectionsLists( Handle(TDataStd_ExtStringList)& theNamesList, + Handle(TDataStd_IntegerList)& theTypesList, + Handle(TDataStd_BooleanList)& theClosuresList, + const bool theIsCreate ) const +{ + theNamesList.Nullify(); + theTypesList.Nullify(); + theClosuresList.Nullify(); + + TDF_Label aSectLabel = myLab.FindChild( DataTag_Sections, theIsCreate ); + if ( aSectLabel.IsNull() ) + return; + + if ( !aSectLabel.FindAttribute( TDataStd_ExtStringList::GetID(), theNamesList ) && theIsCreate ) + theNamesList = TDataStd_ExtStringList::Set( aSectLabel ); + + if ( !aSectLabel.FindAttribute( TDataStd_IntegerList::GetID(), theTypesList ) && theIsCreate ) + theTypesList = TDataStd_IntegerList::Set( aSectLabel ); + + if ( !aSectLabel.FindAttribute( TDataStd_BooleanList::GetID(), theClosuresList ) && theIsCreate ) + theClosuresList = TDataStd_BooleanList::Set( aSectLabel ); +} + +void HYDROData_IPolyline::removeSectionsLists() +{ + TDF_Label aSectsLabel = myLab.FindChild( DataTag_Sections, false ); + if ( !aSectsLabel.IsNull() ) + aSectsLabel.ForgetAllAttributes(); +} + void HYDROData_IPolyline::getPointsLists( const int theSectionIndex, Handle(TDataStd_RealList)& theListX, Handle(TDataStd_RealList)& theListY, @@ -59,7 +141,14 @@ void HYDROData_IPolyline::removePointsLists( const int theSectionIndex ) const if ( aLabel.IsNull() ) return; - TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false ); - if ( !aSectLabel.IsNull() ) - aSectLabel.ForgetAllAttributes(); + if ( theSectionIndex < 0 ) + { + aLabel.ForgetAllAttributes(); + } + else + { + TDF_Label aSectLabel = aLabel.FindChild( theSectionIndex, false ); + if ( !aSectLabel.IsNull() ) + aSectLabel.ForgetAllAttributes(); + } }