2016-11-05 17:33:29 +01:00
|
|
|
#ifndef PATH_H
|
|
|
|
#define PATH_H
|
|
|
|
|
|
|
|
#include <QVector>
|
2017-03-18 01:30:31 +01:00
|
|
|
#include <QRectF>
|
2017-11-26 18:54:03 +01:00
|
|
|
#include "common/coordinates.h"
|
|
|
|
#include "common/rectc.h"
|
2022-09-25 02:15:24 +02:00
|
|
|
#include "style.h"
|
2016-11-05 17:33:29 +01:00
|
|
|
|
2016-11-14 22:12:43 +01:00
|
|
|
class PathPoint
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PathPoint() :
|
|
|
|
_coordinates(Coordinates()), _distance(NAN) {}
|
|
|
|
PathPoint(const Coordinates &coordinates, qreal distance)
|
|
|
|
: _coordinates(coordinates), _distance(distance) {}
|
|
|
|
|
|
|
|
const Coordinates &coordinates() const {return _coordinates;}
|
|
|
|
qreal distance() const {return _distance;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Coordinates _coordinates;
|
|
|
|
qreal _distance;
|
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_TYPEINFO(PathPoint, Q_PRIMITIVE_TYPE);
|
2018-02-13 23:03:18 +01:00
|
|
|
#ifndef QT_NO_DEBUG
|
2016-11-14 22:12:43 +01:00
|
|
|
QDebug operator<<(QDebug dbg, const PathPoint &point);
|
2018-02-13 23:03:18 +01:00
|
|
|
#endif // QT_NO_DEBUG
|
2016-11-14 22:12:43 +01:00
|
|
|
|
2019-02-11 23:28:08 +01:00
|
|
|
typedef QVector<PathPoint> PathSegment;
|
2017-03-18 01:30:31 +01:00
|
|
|
|
2019-02-11 23:28:08 +01:00
|
|
|
class Path : public QList<PathSegment>
|
2017-03-18 01:30:31 +01:00
|
|
|
{
|
|
|
|
public:
|
2019-02-11 23:28:08 +01:00
|
|
|
bool isValid() const;
|
2017-06-29 22:29:27 +02:00
|
|
|
RectC boundingRect() const;
|
2022-09-25 02:15:24 +02:00
|
|
|
|
|
|
|
const LineStyle &style() const {return _style;}
|
|
|
|
void setStyle(const LineStyle &style) {_style = style;}
|
|
|
|
|
|
|
|
private:
|
|
|
|
LineStyle _style;
|
2017-03-18 01:30:31 +01:00
|
|
|
};
|
2016-11-05 17:33:29 +01:00
|
|
|
|
|
|
|
#endif // PATH_H
|