1 #ifndef MERKATOR_TRACKSEGMENT_H_
2 #define MERKATOR_TRACKSEGMENT_H_
3 
4 #include "Feature.h"
5 
6 class TrackSegmentPrivate;
7 class TrackNode;
8 
9 class QProgressDialog;
10 
11 class TrackSegment : public Feature
12 {
13     friend class MemoryBackend;
14 
15 protected:
16     TrackSegment(void);
17     ~TrackSegment(void);
18     TrackSegment(const TrackSegment& other);
19 
20 private:
21     void drawDirectionMarkers(QPainter & P, QPen & pen, const QPointF & FromF, const QPointF & ToF);
22 
23 public:
getClass()24     virtual QString getClass() const {return "TrackSegment";}
getType()25     virtual char getType() const {return IFeature::GpxSegment;}
26     virtual void updateMeta();
27 
28     virtual const CoordBox& boundingBox(bool update=true) const;
29     virtual void drawSimple(QPainter& P, MapView* theView);
30     virtual void drawTouchup(QPainter& P, MapView* theView);
31     virtual void drawSpecial(QPainter& P, QPen& Pen, MapView* theView);
32     virtual void drawParentsSpecial(QPainter& P, QPen& Pen, MapView* theView);
33     virtual void drawChildrenSpecial(QPainter& P, QPen& Pen, MapView* theView, int depth);
34 
35     virtual qreal pixelDistance(const QPointF& Target, qreal ClearEndDistance, const QList<Feature*>& NoSnap, MapView* theView) const;
36     void cascadedRemoveIfUsing(Document* theDocument, Feature* aFeature, CommandList* theList, const QList<Feature*>& Alternatives);
37     virtual bool notEverythingDownloaded();
38     virtual QString description() const;
39 
40     void add(TrackNode* aPoint);
41     void add(TrackNode* Pt, int Idx);
42     virtual int find(Feature* Pt) const;
43     virtual void remove(int idx);
44     virtual void remove(Feature* F);
45     virtual Feature* get(int idx);
46     virtual int size() const;
47     TrackNode* getNode(int idx);
48     virtual const Feature* get(int Idx) const;
49     virtual bool isNull() const;
50 
51     void sortByTime();
52     virtual void partChanged(Feature* F, int ChangeId);
53 
54     qreal distance();
55     int duration() const;
56 
57     virtual bool toGPX(QXmlStreamWriter& stream, QProgressDialog * progress, bool forExport=false);
58     static TrackSegment* fromGPX(Document* d, Layer* L, QXmlStreamReader& stream, QProgressDialog * progress);
59     virtual bool toXML(QXmlStreamWriter& stream, QProgressDialog * progress, bool strict=false,QString changetsetid = QString());
60     static TrackSegment* fromXML(Document* d, Layer* L, QXmlStreamReader& stream, QProgressDialog * progress);
61 
toHtml()62     virtual QString toHtml() {return QString();}
63 
64 private:
65     TrackSegmentPrivate* p;
66 };
67 
68 #endif
69 
70 
71