C++: define Duration as a metatype in Qt to be able to parse it in
[smartapi.git] / Common / C++ / SmartAPI / smartapi / model / Route.h
1 #ifndef _ROUTE_H_
2 #define _ROUTE_H_
3
4 #include "smartapi/model/Obj.h"
5 #include "smartapi/model/Coordinates.h"
6 #include "smartapi/model/ValueObject.h"
7 #include "smartapi/model/TemporalContext.h"
8 #include "smartapi/model/Velocity.h"
9 #include "smartapi/model/Zone.h"
10 #include "smartapi/rdf/PropertyList.h"
11
12
13 #include <QString>
14
15 class Route : public Obj
16 {
17 public:
18         Route(QString uri = QString());
19         Route(Route* l);
20         ~Route();
21
22         Resource* serialize(Model* model);
23         void parse(Statement* statement);
24         void clearReferences(QSet<GraphItem*>* trash);
25         
26         PropertyList<Coordinates*> getRoutePoints()                     { return mRoutePoints; }
27         bool hasRoutePoints()                                                           { return (mRoutePoints.length() > 0); }
28         void setRoutePoints(PropertyList<Coordinates*> l)       { mRoutePoints = l; add(PROPERTY__LIST, &mRoutePoints);  }
29         void setRoutePoints(QList<Coordinates*> l);
30         void setRoutePoints(PropertyList<GraphItem*> l);
31         void addRoutePoint(Coordinates* l)                                      { mRoutePoints.append(l); }
32
33         PropertyList<Zone*> getRouteZones()                                     { return mRouteZones; }
34         bool hasRouteZones()                                                            { return (mRouteZones.length() > 0); }
35         void setRouteZones(PropertyList<Zone*> l)                       { mRouteZones = l; add(PROPERTY__ZONEROUTE, &mRouteZones);  }
36         void setRouteZones(QList<Zone*> l);
37         void setRouteZones(PropertyList<GraphItem*> l);
38         void addRouteZone(Zone* l)                                                      { mRouteZones.append(l); }
39
40         bool hasLength()                                                                        { return (mLength != NULL); }
41         ValueObject* getLength()                                                        { return mLength; }
42         void setLength(ValueObject* s)                                          { add(PROPERTY__LENGTH, s); mLength = s; }
43         
44         bool hasEnergyConsumption()                                                     { return (mEnergyConsumption != NULL); }
45         ValueObject* getEnergyConsumption()                                     { return mEnergyConsumption; }
46         void setEnergyConsumption(ValueObject* s)                       { add(PROPERTY__ENERGYCONSUMPTION, s); mEnergyConsumption = s; }
47         
48         bool hasAverageVelocity()                                                       { return (mAverageVelocity != NULL); }
49         Velocity* getAverageVelocity()                                          { return mAverageVelocity; }
50         void setAverageVelocity(Velocity* s)                            { add(PROPERTY__AVERAGEVELOCITY, s); mAverageVelocity = s; }
51         
52         bool hasDuration()                                                                      { return (mDuration != NULL); }
53         TemporalContext* getDuration()                                          { return mDuration; }
54         void setDuration(TemporalContext* s)                            { add(PROPERTY__DURATION, s); mDuration = s; }
55
56         
57 private:
58         PropertyList<Coordinates*> mRoutePoints;
59         PropertyList<Zone*> mRouteZones;
60         ValueObject* mLength;
61         ValueObject* mEnergyConsumption;
62         Velocity* mAverageVelocity;
63         TemporalContext* mDuration;
64 };
65
66 #endif // _ROUTE_H_