OSDN Git Service

航路保存機能試作。
[gvonavish/GVONavish.git] / GVONavish / GVONavish / GVOShipRoute.h
1 #pragma once
2 #include <deque>
3 #include <ctime>
4 #include "GVONormalizedPoint.h"
5
6 //!@brief \8dq\98H
7 class GVOShipRoute {
8 public:
9         typedef std::vector<GVONormalizedPoint> Line;
10         typedef std::deque<Line> Lines;
11 private:
12         Lines m_lines;
13         double m_length = 0.0;
14         bool m_favorite = false;
15         bool m_hilight = false;
16         bool m_fixed = false;           //!<@brief \8dq\98H\8cÅ\92è\83t\83\89\83O
17
18         std::time_t m_earliestDateTime = std::time_t();
19         std::time_t m_latestDateTime = std::time_t();
20
21 public:
22         GVOShipRoute() = default;
23         ~GVOShipRoute() = default;
24
25         //!@attention \8cÅ\92è\82³\82ê\82½\8dq\98H\82É\8dÀ\95W\82ð\92Ç\89Á\82µ\82Ä\82Í\82È\82ç\82È\82¢\81B\83\8d\83W\83b\83N\83G\83\89\81[\82È\82Ì\82ÅDebug\8e\9e\82Ì\82Ý\83G\83\89\81[\82Æ\82µ\82Ä\82¢\82é\81B
26         void addRoutePoint( const GVONormalizedPoint & point );
27
28         const Lines & getLines() const
29         {
30                 return m_lines;
31         }
32
33         bool isFavorite() const
34         {
35                 return m_favorite;
36         }
37
38         void setFavorite( bool favorite )
39         {
40                 m_favorite = favorite;
41         }
42
43         bool isHilight() const
44         {
45                 return m_hilight;
46         }
47
48         void setHilight( bool hilight )
49         {
50                 m_hilight = hilight;
51         }
52
53         //!@brief srcRoute\82Ì\95Û\8e\9d\82·\82é\8dq\98H\82ð\91S\82Ä\91O\82É\98A\8c\8b\82·\82é\81B
54         void jointPreviousLinesWithRoute( const GVOShipRoute & srcRoute );
55
56         bool isEmptyRoute() const
57         {
58                 if ( m_lines.empty() ) {
59                         return true;
60                 }
61
62                 // \82P\82Â\82Å\82à\93_\82ð\95Û\8e\9d\82µ\82Ä\82¢\82ê\82Î\8bó\8dq\98H\82Å\82Í\82È\82¢\82Æ\94»\92f\82·\82é
63                 for ( auto line : m_lines ) {
64                         if ( !line.empty() ) {
65                                 return false;
66                         }
67                 }
68                 return true;
69         }
70
71         bool isFixed() const
72         {
73                 return m_fixed;
74         }
75
76         void setFix( bool isFixed)
77         {
78                 m_fixed = isFixed;
79         }
80
81         double length() const
82         {
83                 return m_length;
84         }
85
86         std::time_t earliestDateTime() const
87         {
88                 return m_earliestDateTime;
89         }
90
91         // \82¿\82å\82Á\82Æ\89\98\82¢\82©\82È\81[
92         void setEarliestDateTime( const std::time_t dateTime )
93         {
94                 m_earliestDateTime = dateTime;
95         }
96
97         // \82¿\82å\82Á\82Æ\89\98\82¢\82©\82È\81[
98         std::time_t latestDateTime() const
99         {
100                 return m_latestDateTime;
101         }
102
103         // \82¿\82å\82Á\82Æ\89\98\82¢\82©\82È\81[
104         void setLatestDateTime( const std::time_t dateTime )
105         {
106                 m_latestDateTime = dateTime;
107         }
108
109         // \82¿\82å\82Á\82Æ\89\98\82¢\82©\82È\81[
110         void addLine( Line & line )
111         {
112                 m_lines.push_back( line );
113         }
114         void addLine( Line && line )
115         {
116                 m_lines.push_back( line );
117         }
118 private:
119 };
120
121 typedef std::shared_ptr<GVOShipRoute> GVOShipRoutePtr;
122 typedef std::weak_ptr<GVOShipRoute> GVOShipRouteWeakPtr;