Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/declarative/GeoPolylineItem.h
- This file was added.
1 | // | ||||
---|---|---|---|---|---|
2 | // This file is part of the Marble Virtual Globe. | ||||
3 | // | ||||
4 | // This program is free software licensed under the GNU LGPL. You can | ||||
5 | // find a copy of this license in LICENSE.txt in the top directory of | ||||
6 | // the source code. | ||||
7 | // | ||||
8 | // Copyright 2019 Torsten Rahn <rahn@kde.org> | ||||
9 | // | ||||
10 | | ||||
11 | #ifndef MARBLE_DECLARATIVE_GEOPOLYLINEITEM_H | ||||
12 | #define MARBLE_DECLARATIVE_GEOPOLYLINEITEM_H | ||||
13 | | ||||
14 | #include "GeoDataCoordinates.h" | ||||
15 | #include "GeoDataLineString.h" | ||||
16 | #include <QQuickItem> | ||||
17 | #include <QObject> | ||||
18 | #include <QtQml> | ||||
19 | | ||||
20 | /** | ||||
21 | * Represents a coordinate with the properties of a name and coordinates | ||||
22 | * | ||||
23 | * @todo: Introduce GeoDataCoordinates | ||||
24 | */ | ||||
25 | namespace Marble | ||||
26 | { | ||||
27 | class MarbleQuickItem; | ||||
28 | | ||||
29 | class GeoPolylineItem : public QQuickItem | ||||
30 | { | ||||
31 | Q_OBJECT | ||||
32 | | ||||
33 | Q_PROPERTY( Marble::MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged ) | ||||
34 | | ||||
35 | Q_PROPERTY( QVariantList geoCoordinates READ geoCoordinates WRITE setGeoCoordinates NOTIFY geoCoordinatesChanged ) | ||||
36 | Q_PROPERTY( QVariantList screenCoordinates READ screenCoordinates NOTIFY screenCoordinatesChanged ) | ||||
37 | Q_PROPERTY( bool observable READ observable NOTIFY observableChanged ) | ||||
38 | Q_PROPERTY( bool tessellate READ tessellate WRITE setTessellate NOTIFY tessellateChanged ) | ||||
39 | Q_PROPERTY( QColor strokeColor READ strokeColor WRITE setStrokeColor NOTIFY strokeColorChanged ) | ||||
40 | Q_PROPERTY( qreal strokeWidth READ strokeWidth WRITE setStrokeWidth NOTIFY strokeWidthChanged ) | ||||
41 | | ||||
42 | public: | ||||
43 | /** Constructor */ | ||||
44 | explicit GeoPolylineItem( QQuickItem *parent = nullptr ); | ||||
45 | | ||||
46 | MarbleQuickItem* map() const; | ||||
47 | | ||||
48 | void setMap(MarbleQuickItem* map); | ||||
49 | void updatePosition(); | ||||
50 | | ||||
51 | bool observable() const; | ||||
52 | | ||||
53 | QVariantList geoCoordinates() const; | ||||
54 | | ||||
55 | void setGeoCoordinates(const QVariantList & geoCoordinates); | ||||
56 | | ||||
57 | QVariantList screenCoordinates() const; | ||||
58 | | ||||
59 | QColor strokeColor() const; | ||||
60 | qreal strokeWidth() const; | ||||
61 | bool tessellate() const; | ||||
62 | | ||||
63 | void setStrokeColor(const QColor& strokeColor); | ||||
64 | void setStrokeWidth(const qreal strokeWidth); | ||||
65 | void setTessellate(bool tessellate); | ||||
66 | | ||||
67 | Q_SIGNALS: | ||||
68 | void mapChanged(MarbleQuickItem* map); | ||||
69 | void observableChanged(bool observable); | ||||
70 | void geoCoordinatesChanged(); | ||||
71 | void screenCoordinatesChanged(); | ||||
72 | void strokeColorChanged(QColor strokeColor); | ||||
73 | void strokeWidthChanged(qreal strokeWidth); | ||||
74 | | ||||
75 | void tessellateChanged(bool tessellate); | ||||
76 | | ||||
77 | protected: | ||||
78 | QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override; | ||||
79 | | ||||
80 | private: | ||||
81 | MarbleQuickItem* m_map; | ||||
82 | bool m_observable; | ||||
83 | GeoDataLineString m_lineString; | ||||
84 | QVariantList m_geoCoordinates; | ||||
85 | QVector<QPolygonF*> m_screenPolygons; | ||||
86 | QVariantList m_screenCoordinates; | ||||
87 | QColor m_strokeColor; | ||||
88 | qreal m_strokeWidth; | ||||
89 | bool m_tessellate; | ||||
90 | }; | ||||
91 | } | ||||
92 | | ||||
93 | #endif // MARBLE_DECLARATIVE_GEOPOLYLINEITEM_H |