From: ana Date: Fri, 13 Jan 2012 13:37:36 +0000 (+0000) Subject: remove windows line endings X-Git-Tag: pxsxl1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aa37425c25f0cdd3ff4fe8bd77c15479d44d56e6;p=modules%2Fgui.git remove windows line endings --- diff --git a/src/Plot2d/Plot2d_Algorithm.cxx b/src/Plot2d/Plot2d_Algorithm.cxx index 4e1a1c62a..09014254a 100755 --- a/src/Plot2d/Plot2d_Algorithm.cxx +++ b/src/Plot2d/Plot2d_Algorithm.cxx @@ -1,73 +1,72 @@ -// Copyright (C) 2007-2011 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. -// -// 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 : Plot2d_Algorithm.cxx - -#include "Plot2d_Algorithm.h" - -/*! - Constructor -*/ -Plot2d_Algorithm::Plot2d_Algorithm(QObject *parent) : - QObject(parent), - myDataChanged(false) -{ -} - -/*! - Destructor -*/ -Plot2d_Algorithm::~Plot2d_Algorithm() -{ -} - -/*! - Sets input data values -*/ -void Plot2d_Algorithm::setInput(AlgoPlot2dInputData theInuptData) -{ - clear(); - myInuptData = theInuptData; - myDataChanged = true; -} - -/*! - Gets result data values -*/ -AlgoPlot2dOutputData Plot2d_Algorithm::getOutput() -{ - return myResultData; -} - -/*! - Check the data values changed -*/ -bool Plot2d_Algorithm::isDataChanged() -{ - return myDataChanged; -} - - -void Plot2d_Algorithm::clear() { - myDataChanged=false; - myInuptData.clear(); - myResultData.clear(); -} \ No newline at end of file +// Copyright (C) 2007-2011 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. +// +// 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 : Plot2d_Algorithm.cxx + +#include "Plot2d_Algorithm.h" + +/*! + Constructor +*/ +Plot2d_Algorithm::Plot2d_Algorithm(QObject *parent) : + QObject(parent), + myDataChanged(false) +{ +} + +/*! + Destructor +*/ +Plot2d_Algorithm::~Plot2d_Algorithm() +{ +} + +/*! + Sets input data values +*/ +void Plot2d_Algorithm::setInput(AlgoPlot2dInputData theInuptData) +{ + clear(); + myInuptData = theInuptData; + myDataChanged = true; +} + +/*! + Gets result data values +*/ +AlgoPlot2dOutputData Plot2d_Algorithm::getOutput() +{ + return myResultData; +} + +/*! + Check the data values changed +*/ +bool Plot2d_Algorithm::isDataChanged() +{ + return myDataChanged; +} + +void Plot2d_Algorithm::clear() { + myDataChanged=false; + myInuptData.clear(); + myResultData.clear(); +} diff --git a/src/Plot2d/Plot2d_Algorithm.h b/src/Plot2d/Plot2d_Algorithm.h index 43595ab9a..e92b36b09 100755 --- a/src/Plot2d/Plot2d_Algorithm.h +++ b/src/Plot2d/Plot2d_Algorithm.h @@ -1,58 +1,58 @@ -// Copyright (C) 2007-2011 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. -// -// 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 : Plot2d_Algorithm.h - -#ifndef PLOT2D_ALGORITHM_H -#define PLOT2D_ALGORITHM_H - -#include "Plot2d.h" - -#include -#include -#include - -class Plot2d_Object; - -typedef QList< QPair > AlgoPlot2dItem; -typedef QList AlgoPlot2dInputData; -typedef QMap AlgoPlot2dOutputData; - -class PLOT2D_EXPORT Plot2d_Algorithm : public QObject { - Q_OBJECT -public: - Plot2d_Algorithm(QObject *parent = 0); - ~Plot2d_Algorithm(); - - void setInput(AlgoPlot2dInputData); - AlgoPlot2dOutputData getOutput(); - virtual void execute() = 0; - virtual void clear(); - - bool isDataChanged(); - -protected: - AlgoPlot2dInputData myInuptData; - AlgoPlot2dOutputData myResultData; - bool myDataChanged; -}; - -#endif //PLOT2D_ALGORITHM_H +// Copyright (C) 2007-2011 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. +// +// 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 : Plot2d_Algorithm.h + +#ifndef PLOT2D_ALGORITHM_H +#define PLOT2D_ALGORITHM_H + +#include "Plot2d.h" + +#include +#include +#include + +class Plot2d_Object; + +typedef QList< QPair > AlgoPlot2dItem; +typedef QList AlgoPlot2dInputData; +typedef QMap AlgoPlot2dOutputData; + +class PLOT2D_EXPORT Plot2d_Algorithm : public QObject { + Q_OBJECT +public: + Plot2d_Algorithm(QObject *parent = 0); + ~Plot2d_Algorithm(); + + void setInput(AlgoPlot2dInputData); + AlgoPlot2dOutputData getOutput(); + virtual void execute() = 0; + virtual void clear(); + + bool isDataChanged(); + +protected: + AlgoPlot2dInputData myInuptData; + AlgoPlot2dOutputData myResultData; + bool myDataChanged; +}; + +#endif //PLOT2D_ALGORITHM_H diff --git a/src/Plot2d/Plot2d_NormalizeAlgorithm.cxx b/src/Plot2d/Plot2d_NormalizeAlgorithm.cxx index f30b618b8..ec0e52877 100755 --- a/src/Plot2d/Plot2d_NormalizeAlgorithm.cxx +++ b/src/Plot2d/Plot2d_NormalizeAlgorithm.cxx @@ -1,183 +1,182 @@ -// Copyright (C) 2007-2011 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. -// -// 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 : Plot2d_NormalizeAlgorithm.cxx - -#include "Plot2d_NormalizeAlgorithm.h" -#include -#include -#include "Plot2d_Object.h" - -/*! - Constructor -*/ -Plot2d_NormalizeAlgorithm::Plot2d_NormalizeAlgorithm(QObject *parent) : - Plot2d_Algorithm(parent), - myNormalizationMode(NormalizeNone) -{ -} - -/*! - Destructor -*/ -Plot2d_NormalizeAlgorithm::~Plot2d_NormalizeAlgorithm() -{ -} - -/*! - Sets normalozation mode -*/ -void Plot2d_NormalizeAlgorithm::setNormalizationMode(NormalizationMode theMode) { - if(myNormalizationMode != theMode) { - myNormalizationMode = theMode; - myDataChanged = true; - } -} - -/*! - Gets normalozation mode -*/ -Plot2d_NormalizeAlgorithm::NormalizationMode Plot2d_NormalizeAlgorithm::getNormalizationMode()const { - return myNormalizationMode; -} - -/*! - Gets k normalization coefficient -*/ -double Plot2d_NormalizeAlgorithm::getKkoef(Plot2d_Object* theObj) -{ - QMap::iterator it = myKkoefs.find(theObj); - if(it != myKkoefs.end()) - return it.value(); - return 0; -} - -/*! - Gets b normalization coefficient -*/ -double Plot2d_NormalizeAlgorithm::getBkoef(Plot2d_Object* theObj) -{ - QMap::iterator it = myBkoefs.find(theObj); - if(it != myBkoefs.end()) - return it.value(); - return 0; - -} - -void Plot2d_NormalizeAlgorithm::execute() { - if (!isDataChanged() || myInuptData.isEmpty()) - return; - - if (myNormalizationMode != NormalizeNone) { - QList yMinLst, yMaxLst; - QList aKkoefs,aBkoefs; - double _pMin, _pMax; - for (int i = 0; i < myInuptData.size(); ++i) { - QList aTmpItemValues; - Plot2d_Object* object = myInuptData.at(i); - double *x, *y; - long nb = object->getData( &x, &y ); - for (int j = 0; j < nb; ++j) { - aTmpItemValues<getPoint(j).y; - } - delete x; - delete y; - yMaxLst<<*(std::max_element(aTmpItemValues.begin(), aTmpItemValues.end())); - yMinLst<<*(std::min_element(aTmpItemValues.begin(), aTmpItemValues.end())); - } - _pMin = *(std::min_element(yMinLst.begin(), yMinLst.end())); - _pMax = *(std::max_element(yMaxLst.begin(), yMaxLst.end())); - - double pMin, pMax, kKoef, bKoef, yMin, yMax; - switch( getNormalizationMode() ) { - case NormalizeToMin: - pMin = _pMin; - for (int i = 0; i < yMaxLst.size(); ++i) { - yMin = yMinLst.at(i); - yMax = yMaxLst.at(i); - pMax = yMax; - kKoef = (pMax - pMin)/(yMax - yMin); - bKoef = pMin - kKoef * yMin; - aBkoefs<nbPoints(); ++j) { - yOld = myInuptData.at(i)->getPoint(j).y; - xOld = myInuptData.at(i)->getPoint(j).x; - yNew = aKkoefs.at(i) * yOld + aBkoefs.at(i); - tmpItem.append( qMakePair(xOld, yNew) ); - } - myResultData.insert(myInuptData.at(i),tmpItem); - myKkoefs.insert(myInuptData.at(i),aKkoefs.at(i)); - myBkoefs.insert(myInuptData.at(i),aBkoefs.at(i)); - } - } else { - for (int i = 0; i < myInuptData.size(); ++i) { - double yOld,xOld; - AlgoPlot2dItem tmpItem; - for (int j = 0; j < myInuptData.at(i)->nbPoints(); ++j) { - yOld = myInuptData.at(i)->getPoint(j).y; - xOld = myInuptData.at(i)->getPoint(j).x; - tmpItem.append( qMakePair(xOld, yOld) ); - } - myResultData.insert(myInuptData.at(i),tmpItem); - } - - } - myDataChanged = false; -} - - -void Plot2d_NormalizeAlgorithm::clear() { - Plot2d_Algorithm::clear(); - myBkoefs.clear(); - myKkoefs.clear(); -} \ No newline at end of file +// Copyright (C) 2007-2011 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. +// +// 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 : Plot2d_NormalizeAlgorithm.cxx + +#include "Plot2d_NormalizeAlgorithm.h" +#include +#include +#include "Plot2d_Object.h" + +/*! + Constructor +*/ +Plot2d_NormalizeAlgorithm::Plot2d_NormalizeAlgorithm(QObject *parent) : + Plot2d_Algorithm(parent), + myNormalizationMode(NormalizeNone) +{ +} + +/*! + Destructor +*/ +Plot2d_NormalizeAlgorithm::~Plot2d_NormalizeAlgorithm() +{ +} + +/*! + Sets normalozation mode +*/ +void Plot2d_NormalizeAlgorithm::setNormalizationMode(NormalizationMode theMode) { + if(myNormalizationMode != theMode) { + myNormalizationMode = theMode; + myDataChanged = true; + } +} + +/*! + Gets normalozation mode +*/ +Plot2d_NormalizeAlgorithm::NormalizationMode Plot2d_NormalizeAlgorithm::getNormalizationMode()const { + return myNormalizationMode; +} + +/*! + Gets k normalization coefficient +*/ +double Plot2d_NormalizeAlgorithm::getKkoef(Plot2d_Object* theObj) +{ + QMap::iterator it = myKkoefs.find(theObj); + if(it != myKkoefs.end()) + return it.value(); + return 0; +} + +/*! + Gets b normalization coefficient +*/ +double Plot2d_NormalizeAlgorithm::getBkoef(Plot2d_Object* theObj) +{ + QMap::iterator it = myBkoefs.find(theObj); + if(it != myBkoefs.end()) + return it.value(); + return 0; + +} + +void Plot2d_NormalizeAlgorithm::execute() { + if (!isDataChanged() || myInuptData.isEmpty()) + return; + + if (myNormalizationMode != NormalizeNone) { + QList yMinLst, yMaxLst; + QList aKkoefs,aBkoefs; + double _pMin, _pMax; + for (int i = 0; i < myInuptData.size(); ++i) { + QList aTmpItemValues; + Plot2d_Object* object = myInuptData.at(i); + double *x, *y; + long nb = object->getData( &x, &y ); + for (int j = 0; j < nb; ++j) { + aTmpItemValues<getPoint(j).y; + } + delete x; + delete y; + yMaxLst<<*(std::max_element(aTmpItemValues.begin(), aTmpItemValues.end())); + yMinLst<<*(std::min_element(aTmpItemValues.begin(), aTmpItemValues.end())); + } + _pMin = *(std::min_element(yMinLst.begin(), yMinLst.end())); + _pMax = *(std::max_element(yMaxLst.begin(), yMaxLst.end())); + + double pMin, pMax, kKoef, bKoef, yMin, yMax; + switch( getNormalizationMode() ) { + case NormalizeToMin: + pMin = _pMin; + for (int i = 0; i < yMaxLst.size(); ++i) { + yMin = yMinLst.at(i); + yMax = yMaxLst.at(i); + pMax = yMax; + kKoef = (pMax - pMin)/(yMax - yMin); + bKoef = pMin - kKoef * yMin; + aBkoefs<nbPoints(); ++j) { + yOld = myInuptData.at(i)->getPoint(j).y; + xOld = myInuptData.at(i)->getPoint(j).x; + yNew = aKkoefs.at(i) * yOld + aBkoefs.at(i); + tmpItem.append( qMakePair(xOld, yNew) ); + } + myResultData.insert(myInuptData.at(i),tmpItem); + myKkoefs.insert(myInuptData.at(i),aKkoefs.at(i)); + myBkoefs.insert(myInuptData.at(i),aBkoefs.at(i)); + } + } else { + for (int i = 0; i < myInuptData.size(); ++i) { + double yOld,xOld; + AlgoPlot2dItem tmpItem; + for (int j = 0; j < myInuptData.at(i)->nbPoints(); ++j) { + yOld = myInuptData.at(i)->getPoint(j).y; + xOld = myInuptData.at(i)->getPoint(j).x; + tmpItem.append( qMakePair(xOld, yOld) ); + } + myResultData.insert(myInuptData.at(i),tmpItem); + } + } + myDataChanged = false; +} + + +void Plot2d_NormalizeAlgorithm::clear() { + Plot2d_Algorithm::clear(); + myBkoefs.clear(); + myKkoefs.clear(); +} diff --git a/src/Plot2d/Plot2d_NormalizeAlgorithm.h b/src/Plot2d/Plot2d_NormalizeAlgorithm.h index 5156a218b..0441bb20b 100755 --- a/src/Plot2d/Plot2d_NormalizeAlgorithm.h +++ b/src/Plot2d/Plot2d_NormalizeAlgorithm.h @@ -1,54 +1,54 @@ -// Copyright (C) 2007-2011 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. -// -// 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 : Plot2d_NormalizeAlgorithm.h - -#ifndef PLOT2D_NORMALIZEALGORITHM_H -#define PLOT2D_NORMALIZEALGORITHM_H - -#include "Plot2d.h" -#include "Plot2d_Algorithm.h" -#include - -class Plot2d_Object; - -class PLOT2D_EXPORT Plot2d_NormalizeAlgorithm : public Plot2d_Algorithm { - Q_OBJECT -public: - Plot2d_NormalizeAlgorithm(QObject *parent); - ~Plot2d_NormalizeAlgorithm(); - - enum NormalizationMode { NormalizeToMin, NormalizeToMax, NormalizeToMinMax, NormalizeNone }; - - void setNormalizationMode(NormalizationMode); - NormalizationMode getNormalizationMode() const; - double getKkoef(Plot2d_Object*); - double getBkoef(Plot2d_Object*); - virtual void execute(); - virtual void clear(); - -private: - NormalizationMode myNormalizationMode; - QMap myBkoefs; - QMap myKkoefs; -}; - -#endif //PLOT2D_NORMALIZEALGORITHM_H +// Copyright (C) 2007-2011 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. +// +// 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 : Plot2d_NormalizeAlgorithm.h + +#ifndef PLOT2D_NORMALIZEALGORITHM_H +#define PLOT2D_NORMALIZEALGORITHM_H + +#include "Plot2d.h" +#include "Plot2d_Algorithm.h" +#include + +class Plot2d_Object; + +class PLOT2D_EXPORT Plot2d_NormalizeAlgorithm : public Plot2d_Algorithm { + Q_OBJECT +public: + Plot2d_NormalizeAlgorithm(QObject *parent); + ~Plot2d_NormalizeAlgorithm(); + + enum NormalizationMode { NormalizeToMin, NormalizeToMax, NormalizeToMinMax, NormalizeNone }; + + void setNormalizationMode(NormalizationMode); + NormalizationMode getNormalizationMode() const; + double getKkoef(Plot2d_Object*); + double getBkoef(Plot2d_Object*); + virtual void execute(); + virtual void clear(); + +private: + NormalizationMode myNormalizationMode; + QMap myBkoefs; + QMap myKkoefs; +}; + +#endif //PLOT2D_NORMALIZEALGORITHM_H