~ubuntu-branches/ubuntu/saucy/merkaartor/saucy

« back to all changes in this revision

Viewing changes to src/Maps/Road.h

  • Committer: Bazaar Package Importer
  • Author(s): Bernd Zeimetz
  • Date: 2009-09-13 00:52:12 UTC
  • mto: (1.2.7 upstream) (0.1.3 upstream) (3.1.7 sid)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20090913005212-pjecal8zxm07x0fj
ImportĀ upstreamĀ versionĀ 0.14+svnfixes~20090912

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef MERKAARTOR_ROAD_H_
 
2
#define MERKAARTOR_ROAD_H_
 
3
 
 
4
#include <QList>
 
5
 
 
6
#include "Maps/MapDocument.h"
 
7
#include "Maps/MapFeature.h"
 
8
#include "Maps/MapLayer.h"
 
9
 
 
10
#ifndef _MOBILE
 
11
#include <ggl/ggl.hpp>
 
12
#endif
 
13
 
 
14
class RoadPrivate;
 
15
class TrackPoint;
 
16
class QProgressDialog;
 
17
 
 
18
class Road : public MapFeature
 
19
{
 
20
        Q_OBJECT
 
21
 
 
22
        public:
 
23
                Road(void);
 
24
                Road(const Road& other);
 
25
                virtual ~Road();
 
26
 
 
27
        public:
 
28
                virtual QString getClass() const {return "Road";}
 
29
                virtual MapFeature::FeatureType getType() const {return MapFeature::Nodes;}
 
30
                virtual void updateMeta();
 
31
 
 
32
                virtual CoordBox boundingBox() const;
 
33
                virtual void draw(QPainter& P, MapView* theView);
 
34
                virtual void drawFocus(QPainter& P, MapView* theView, bool solid=true);
 
35
                virtual void drawHover(QPainter& P, MapView* theView, bool solid=true);
 
36
                virtual void drawHighlight(QPainter& P, MapView* theView, bool solid=true);
 
37
                virtual double pixelDistance(const QPointF& Target, double ClearEndDistance, const Projection& theProjection, const QTransform& theTransform) const;
 
38
                virtual void cascadedRemoveIfUsing(MapDocument* theDocument, MapFeature* aFeature, CommandList* theList, const QList<MapFeature*>& Alternatives);
 
39
                virtual bool notEverythingDownloaded();
 
40
                virtual QString description() const;
 
41
                virtual RenderPriority renderPriority();
 
42
                virtual RenderPriority getRenderPriority();
 
43
 
 
44
                virtual void add(TrackPoint* Pt);
 
45
                virtual void add(TrackPoint* Pt, int Idx);
 
46
                virtual void remove(int Idx);
 
47
                virtual void remove(MapFeature* F);
 
48
                virtual int size() const;
 
49
                virtual int find(MapFeature* Pt) const;
 
50
                virtual MapFeature* get(int idx);
 
51
                virtual const MapFeature* get(int Idx) const;
 
52
                virtual bool isNull() const;
 
53
 
 
54
                const QList<Coord>& smoothed() const;
 
55
 
 
56
                TrackPoint* getNode(int idx);
 
57
                const TrackPoint* getNode(int idx) const;
 
58
                const std::vector<TrackPointPtr>& getNodes() const;
 
59
                
 
60
                bool isNodeAtEnd(TrackPoint* node);
 
61
 
 
62
                /** Set the tag "key=value" to the current object
 
63
                 * If a tag with the same key exist, it is replaced
 
64
                 * Otherwise the tag is added at the end
 
65
                 * @param key the key of the tag
 
66
                 * @param value the value corresponding to the key
 
67
                 */
 
68
                virtual void setTag(const QString& key, const QString& value, bool addToTagList=true);
 
69
 
 
70
                /** Set the tag "key=value" at the position index
 
71
                 * If a tag with the same key exist, it is replaced
 
72
                 * Otherwise the tag is added at the index position
 
73
                 * @param index the place for the given tag. Start at 0.
 
74
                 * @param key the key of the tag
 
75
                 * @param value the value corresponding to the key
 
76
                */
 
77
                virtual void setTag(int index, const QString& key, const QString& value, bool addToTagList=true);
 
78
 
 
79
                /** remove all the tags for the curent feature
 
80
                 */
 
81
                virtual void clearTags();
 
82
 
 
83
                /** remove the tag with the key "k".
 
84
                 * if no corresponding tag, don't do anything
 
85
                 */
 
86
                virtual void clearTag(const QString& k);
 
87
 
 
88
                virtual void partChanged(MapFeature* F, int ChangeId);
 
89
                virtual void setLayer(MapLayer* aLayer);
 
90
 
 
91
                bool isCoastline();
 
92
                double area();
 
93
                bool isClosed() const;
 
94
                double distance();
 
95
                double widthOf();
 
96
 
 
97
                virtual bool deleteChildren(MapDocument* theDocument, CommandList* theList);
 
98
 
 
99
                QPainterPath getPath();
 
100
                void buildPath(Projection const &theProjection, const QTransform& theTransform, const QRectF& clipRect);
 
101
 
 
102
                virtual bool toGPX(QDomElement xParent, QProgressDialog & progress, bool forExport=false);
 
103
                virtual QString toXML(int lvl=0, QProgressDialog * progress=NULL);
 
104
                virtual bool toXML(QDomElement xParent, QProgressDialog & progress);
 
105
                static Road* fromXML(MapDocument* d, MapLayer* L, const QDomElement e);
 
106
 
 
107
                virtual QString toHtml();
 
108
        
 
109
                virtual void toBinary(QDataStream& ds, QHash <QString, quint64>& theIndex);
 
110
                static Road* fromBinary(MapDocument* d, OsbMapLayer* L, QDataStream& ds, qint8 c, qint64 id);
 
111
 
 
112
                bool isExtrimity(TrackPoint* node);
 
113
                static Road * GetSingleParentRoad(MapFeature * mapFeature);
 
114
                static Road * GetSingleParentRoadInner(MapFeature * mapFeature);
 
115
 
 
116
        protected:
 
117
                RoadPrivate* p;
 
118
};
 
119
 
 
120
Q_DECLARE_METATYPE( Road * );
 
121
 
 
122
MapFeature::TrafficDirectionType trafficDirection(const Road* R);
 
123
int findSnapPointIndex(const Road* R, Coord& P);
 
124
 
 
125
#endif
 
126
 
 
127