X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSPlot2d%2FSPlot2d_Curve.cxx;h=16819be7e0afe290d47b0d0f10afbd2bfafd98c3;hb=257308ab92a2ecccb38294bf15b690580d6cbebc;hp=3e6bc0324aef812aab76f08d160b7bb0c597a507;hpb=2e750f9ded92337bc3c44e9d7388180974cc4a43;p=modules%2Fgui.git diff --git a/src/SPlot2d/SPlot2d_Curve.cxx b/src/SPlot2d/SPlot2d_Curve.cxx index 3e6bc0324..16819be7e 100644 --- a/src/SPlot2d/SPlot2d_Curve.cxx +++ b/src/SPlot2d/SPlot2d_Curve.cxx @@ -1,9 +1,28 @@ +// 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 +// // File : SPlot2d_Curve.cxx -// Author : Sergey RUIN -// Module : SUIT +// Author : Sergey RUIN, Open CASCADE S.A.S. (sergey.ruin@opencascade.com) #include "SPlot2d_Curve.h" -using namespace std; /*! Constructor @@ -24,19 +43,10 @@ SPlot2d_Curve::~SPlot2d_Curve() Copy constructor. Makes deep copy of data. */ SPlot2d_Curve::SPlot2d_Curve( const SPlot2d_Curve& curve ) +: Plot2d_Curve( curve ) { - myAutoAssign = curve.isAutoAssign(); - myHorTitle = curve.getHorTitle(); - myVerTitle = curve.getVerTitle(); - myHorUnits = curve.getHorUnits(); - myVerUnits = curve.getVerUnits(); - myColor = curve.getColor(); - myMarker = curve.getMarker(); - myLine = curve.getLine(); - myLineWidth = curve.getLineWidth(); - myPoints = curve.getPointList(); - myIO = curve.getIO(); - myTableIO = curve.getTableIO(); + myIO = curve.getIO(); + myTableIO = curve.getTableIO(); } /*! @@ -44,26 +54,103 @@ SPlot2d_Curve::SPlot2d_Curve( const SPlot2d_Curve& curve ) */ SPlot2d_Curve& SPlot2d_Curve::operator=( const SPlot2d_Curve& curve ) { - myAutoAssign = curve.isAutoAssign(); - myHorTitle = curve.getHorTitle(); - myVerTitle = curve.getVerTitle(); - myHorUnits = curve.getHorUnits(); - myVerUnits = curve.getVerUnits(); - myColor = curve.getColor(); - myMarker = curve.getMarker(); - myLine = curve.getLine(); - myLineWidth = curve.getLineWidth(); - myPoints = curve.getPointList(); + Plot2d_Curve::operator=(curve); myIO = curve.getIO(); myTableIO = curve.getTableIO(); return *this; } /*! - Sets curve's data. + \return corresponding SALOME_InteractiveObject +*/ +Handle(SALOME_InteractiveObject) SPlot2d_Curve::getIO() const +{ + return myIO; +} + +/*! + Sets corresponding SALOME_InteractiveObject + \param io - SALOME_InteractiveObject +*/ +void SPlot2d_Curve::setIO( const Handle(SALOME_InteractiveObject)& io ) +{ + myIO = io; +} + +/*! + \return true if curve has table interactive object +*/ +bool SPlot2d_Curve::hasTableIO() const +{ + return !myTableIO.IsNull(); +} + +/*! + \return table interactive object of curve +*/ +Handle(SALOME_InteractiveObject) SPlot2d_Curve::getTableIO() const +{ + return myTableIO; +} + +/*! + Sets table interactive object of curve + \param io - SALOME_InteractiveObject +*/ +void SPlot2d_Curve::setTableIO( const Handle(SALOME_InteractiveObject)& io ) +{ + myTableIO = io; +} + +/*! + \return SALOME_InteractiveObject +*/ +bool SPlot2d_Curve::hasIO() const +{ + return !myIO.IsNull(); +} + +/*! + \return table title */ -void SPlot2d_Curve::setData( const double* hData, const double* vData, long size ) +QString SPlot2d_Curve::getTableTitle() const { - clearAllPoints(); - for(long i = 0; i < size; i++) addPoint(hData[i], vData[i]); + QString title; + if( hasTableIO() ) + title = getTableIO()->getName(); + return title; } + +/*! + Add owner of the curve. + \param owner - owner of the curve +*/ +void SPlot2d_Curve::addOwner(const QString& owner) { + myOwners.insert(owner); +} + +/*! + Remove owner of the curve. + \param owner - owner of the curve +*/ +void SPlot2d_Curve::removeOwner(const QString& owner) { + myOwners.insert(owner); +} + +/*! + Get all owners of the curve. + \return owners of the curve. +*/ +OwnerSet SPlot2d_Curve::getOwners() const { + return myOwners; +} + + +/*! + Add owners of the curve. + \param owners - owners of the curve +*/ +void SPlot2d_Curve::addOwners(OwnerSet& owners) { + myOwners = myOwners|=owners; +} +