CurveDataVector.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (C) 2015 by Ralf Kaestner                                        *
00003  * ralf.kaestner@gmail.com                                                    *
00004  *                                                                            *
00005  * This program is free software; you can redistribute it and/or modify       *
00006  * it under the terms of the Lesser GNU General Public License as published by*
00007  * the Free Software Foundation; either version 3 of the License, or          *
00008  * (at your option) any later version.                                        *
00009  *                                                                            *
00010  * This program is distributed in the hope that it will be useful,            *
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the               *
00013  * Lesser GNU General Public License for more details.                        *
00014  *                                                                            *
00015  * You should have received a copy of the Lesser GNU General Public License   *
00016  * along with this program. If not, see <http://www.gnu.org/licenses/>.       *
00017  ******************************************************************************/
00018 
00019 #ifndef RQT_MULTIPLOT_CURVE_DATA_VECTOR_H
00020 #define RQT_MULTIPLOT_CURVE_DATA_VECTOR_H
00021 
00022 #include <QVector>
00023 
00024 #include <boost/container/flat_set.hpp>
00025 
00026 #include <rqt_multiplot/CurveData.h>
00027 
00028 namespace rqt_multiplot {
00029   class CurveDataVector :
00030     public CurveData {
00031   public:
00032     CurveDataVector();
00033     ~CurveDataVector();
00034 
00035     size_t getNumPoints() const;
00036     QPointF getPoint(size_t index) const;
00037     QVector<size_t> getPointsInDistance(double x, double maxDistance)
00038       const;
00039     BoundingRectangle getBounds() const;
00040     
00041     void appendPoint(const QPointF& point);
00042     void clearPoints();
00043   
00044   private:
00045     class XCoordinateRef {
00046     public:
00047       inline XCoordinateRef(double x = 0.0, size_t index = 0) :
00048         x_(x),
00049         index_(index) {
00050       };
00051 
00052       inline XCoordinateRef(const XCoordinateRef& src) :
00053         x_(src.x_),
00054         index_(src.index_) {
00055       };
00056       
00057       inline bool operator==(const XCoordinateRef& reference) const {
00058         return (x_ == reference.x_);
00059       };
00060       
00061       inline bool operator<(const XCoordinateRef& reference) const {
00062         return (x_ < reference.x_);
00063       };
00064       
00065       double x_;
00066       size_t index_;
00067     };
00068     
00069     typedef boost::container::flat_set<XCoordinateRef> XCoordinateRefSet;
00070     
00071     QVector<QPointF> points_;
00072     XCoordinateRefSet x_;
00073     
00074     BoundingRectangle bounds_;
00075   };
00076 };
00077 
00078 #endif


rqt_multiplot
Author(s): Ralf Kaestner
autogenerated on Thu Jun 6 2019 21:49:10