File indexing completed on 2024-05-12 15:26:42

0001 /***************************************************************************
0002     File                 : Segment.h
0003     Project              : LabPlot
0004     Description          : Graphics-item for curve of Datapicker
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2015 by Ankit Wagadre (wagadre.ankit@gmail.com)
0007  ***************************************************************************/
0008 /***************************************************************************
0009  *                                                                         *
0010  *  This program is free software; you can redistribute it and/or modify   *
0011  *  it under the terms of the GNU General Public License as published by   *
0012  *  the Free Software Foundation; either version 2 of the License, or      *
0013  *  (at your option) any later version.                                    *
0014  *                                                                         *
0015  *  This program is distributed in the hope that it will be useful,        *
0016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0018  *  GNU General Public License for more details.                           *
0019  *                                                                         *
0020  *   You should have received a copy of the GNU General Public License     *
0021  *   along with this program; if not, write to the Free Software           *
0022  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0023  *   Boston, MA  02110-1301  USA                                           *
0024  *                                                                         *
0025  ***************************************************************************/
0026 
0027 #ifndef SEGMENT_H
0028 #define SEGMENT_H
0029 
0030 #include <QVector>
0031 #include "backend/lib/macros.h"
0032 
0033 class QGraphicsItem;
0034 class QLine;
0035 
0036 class SegmentPrivate;
0037 class DatapickerImage;
0038 
0039 class Segment {
0040 public:
0041     explicit Segment(DatapickerImage*);
0042 
0043     QVector<QLine*> path;
0044     int yLast{0};
0045     int length{0};
0046 
0047     QGraphicsItem *graphicsItem() const;
0048     void setParentGraphicsItem(QGraphicsItem*);
0049 
0050     bool isVisible() const;
0051     void setVisible(bool);
0052     void retransform();
0053 
0054     typedef SegmentPrivate Private;
0055 
0056 private:
0057     Q_DECLARE_PRIVATE(Segment)
0058     DatapickerImage* m_image;
0059 
0060 protected:
0061     SegmentPrivate* const d_ptr;
0062 };
0063 
0064 #endif