File indexing completed on 2024-05-12 03:47:30

0001 /*
0002     File                 : Segments.h
0003     Project              : LabPlot
0004     Description          : Contain Methods to trace curve of image/plot
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2015 Ankit Wagadre <wagadre.ankit@gmail.com>
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef SEGMENTS_H
0011 #define SEGMENTS_H
0012 
0013 #include <QVector>
0014 
0015 class QImage;
0016 class DatapickerImage;
0017 class Segment;
0018 
0019 class Segments {
0020 public:
0021     explicit Segments(DatapickerImage*);
0022 
0023     void makeSegments(QImage&);
0024     void setSegmentsVisible(bool);
0025     void setAcceptHoverEvents(bool);
0026 
0027 private:
0028     DatapickerImage* m_image;
0029     QVector<Segment*> segments;
0030 
0031     void clearSegments();
0032     void loadSegment(Segment**, int);
0033     int adjacentRuns(const bool*, int, int, int);
0034     Segment* adjacentSegment(Segment**, int, int, int);
0035     int adjacentSegments(Segment**, int, int, int);
0036     void matchRunsToSegments(int, int, bool*, Segment**, const bool*, Segment**, bool*);
0037     void finishRun(bool*, bool*, Segment**, Segment**, int, int, int, int);
0038     void scrollSegment(Segment**, Segment**, int);
0039     void removeUnneededLines(Segment**, Segment**, int);
0040 };
0041 #endif