OSDN Git Service

3470c6cf7fa44c8503f5864c057bc8c01bbd0ca7
[gvonavish/GVONavish.git] / GVONavish / GVONavish / GVOShipRoute.h
1 #pragma once
2 #include <deque>
3 #include "GVONormalizedPoint.h"
4
5 //!@brief \8dq\98H
6 class GVOShipRoute {
7 public:
8         typedef std::deque<GVONormalizedPoint> Line;
9         typedef std::deque<Line> Lines;
10 private:
11         Lines m_lines;
12         double m_length = 0.0;
13         bool m_favorite = false;
14         bool m_hilight = false;
15         bool m_fixed = false;           //!<@brief \8dq\98H\8cÅ\92è\83t\83\89\83O
16
17 public:
18         GVOShipRoute() = default;
19         ~GVOShipRoute() = default;
20
21         //!@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
22         void addRoutePoint( const GVONormalizedPoint & point );
23
24         const Lines & getLines() const
25         {
26                 return m_lines;
27         }
28
29         bool isFavorite() const
30         {
31                 return m_favorite;
32         }
33
34         void setFavorite( bool favorite )
35         {
36                 m_favorite = favorite;
37         }
38
39         bool isHilight() const
40         {
41                 return m_hilight;
42         }
43
44         void setHilight( bool hilight )
45         {
46                 m_hilight = hilight;
47         }
48
49         //!@brief srcRoute\82Ì\95Û\8e\9d\82·\82é\8dq\98H\82ð\91S\82Ä\91O\82É\98A\8c\8b\82·\82é\81B
50         void jointPreviousLinesWithRoute( const GVOShipRoute & srcRoute );
51
52         bool isEmptyRoute() const
53         {
54                 if ( m_lines.empty() ) {
55                         return true;
56                 }
57
58                 // \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é
59                 for ( auto line : m_lines ) {
60                         if ( !line.empty() ) {
61                                 return false;
62                         }
63                 }
64                 return true;
65         }
66
67         bool isFixed() const
68         {
69                 return m_fixed;
70         }
71
72         void setFix( bool isFixed)
73         {
74                 m_fixed = isFixed;
75         }
76
77         double length() const
78         {
79                 return m_length;
80         }
81 private:
82 };
83
84 typedef std::shared_ptr<GVOShipRoute> GVOShipRoutePtr;
85 typedef std::weak_ptr<GVOShipRoute> GVOShipRouteWeakPtr;