1 // -*- C++ -*- 2 /** 3 * @brief Curve class for curve plots 4 * 5 * Copyright 2005-2021 Airbus-EDF-IMACS-ONERA-Phimeca 6 * 7 * This library is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU Lesser General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public License 18 * along with this library. If not, see <http://www.gnu.org/licenses/>. 19 * 20 */ 21 #ifndef OPENTURNS_CURVE_HXX 22 #define OPENTURNS_CURVE_HXX 23 24 #include "openturns/DrawableImplementation.hxx" 25 #include "openturns/Sample.hxx" 26 27 BEGIN_NAMESPACE_OPENTURNS 28 29 /** 30 * @class Curve 31 * 32 * The class describing a curve plot 33 * Instance of Drawable 34 */ 35 36 37 class OT_API Curve : public DrawableImplementation 38 { 39 40 CLASSNAME 41 42 public: 43 44 45 /** Default constructor */ 46 explicit Curve(const String & legend = ""); 47 48 /** Default constructor */ 49 explicit Curve(const Sample & data, 50 const String & legend = ""); 51 52 /** Contructor from 2 data sets */ 53 Curve(const Sample & dataX, 54 const Sample & dataY, 55 const String & legend = ""); 56 57 /** Contructor from 2 data sets */ 58 Curve(const Point & dataX, 59 const Point & dataY, 60 const String & legend = ""); 61 62 /** Constructor with parameters */ 63 Curve(const Sample & data, 64 const String & color, 65 const String & lineStyle, 66 const Scalar lineWidth = 1.0, 67 const String & legend = ""); 68 69 /** String converter */ 70 String __repr__() const override; 71 72 /** Draw method */ 73 String draw() const override; 74 75 /** Clone method */ 76 Curve * clone() const override; 77 78 /** Method save() stores the object through the StorageManager */ 79 void save(Advocate & adv) const override; 80 81 /** Method load() stores the object through the StorageManager */ 82 void load(Advocate & adv) override; 83 84 protected: 85 /** Check fo data validity */ 86 void checkData(const Sample & data) const override; 87 88 private: 89 90 }; /* class Curve */ 91 92 93 94 END_NAMESPACE_OPENTURNS 95 96 #endif /* OPENTURNS_CURVE_HXX */ 97