Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 156 lines (124 sloc) 5.34 kb
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
1 // -*- c++ -*-
2 // Way complicated
3
34ae14d Kurt Schwehr starting on IMO 8 1 22
authored
4 // Which spec was I coding to? Probably the Nav55
5
5f364d8 Kurt Schwehr minor cleanup and checks
authored
6 // FIX: remove cout's and this include will not be needed
7 #include <iostream>
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
8
9 enum Ais8_366_22_AreaShapeEnum {
10 AIS8_366_22_SHAPE_ERROR = -1,
11 AIS8_366_22_SHAPE_CIRCLE = 0,
12 AIS8_366_22_SHAPE_RECT = 1,
13 AIS8_366_22_SHAPE_SECTOR = 2,
14 AIS8_366_22_SHAPE_POLYLINE = 3,
15 AIS8_366_22_SHAPE_POLYGON = 4,
16 AIS8_366_22_SHAPE_TEXT = 5,
17 AIS8_366_22_SHAPE_RESERVED_6 = 6,
18 AIS8_366_22_SHAPE_RESERVED_7 = 7
19 };
20
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
21 extern const char *shape_names[8];
22
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
23
24
25 class Ais8_366_22_SubArea {
26 public:
27 //Ais8_366_22_AreaShapeEnum area_shape;
28 virtual Ais8_366_22_AreaShapeEnum getType()=0;
29 // FIX: make the destructor pure virtual
30 virtual ~Ais8_366_22_SubArea() { std::cout << "Ais8_366_22_Circle: destructor" << std::endl; };
31 virtual void print()=0;
32 };
33
34 Ais8_366_22_SubArea* ais8_366_22_subarea_factory(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
35
36 // or Point if radius is 0
37 class Ais8_366_22_Circle : public Ais8_366_22_SubArea {
38 public:
39 float x,y; // longitude and latitude
40 // Going to assume that the precision is load of crap
41 //int precision; // How many decimal places for x and y. FIX: is this really supposed to be here????
42 int radius_m;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
43 unsigned int spare; // 18 bits
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
44
45 Ais8_366_22_Circle(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
46 ~Ais8_366_22_Circle() { std::cout << "Ais8_366_22_Circle: destructor" << std::endl;};
47 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_CIRCLE;}
48 void print();
49 };
50
51 class Ais8_366_22_Rect : public Ais8_366_22_SubArea {
52 public:
53 float x,y; // longitude and latitude
54 //int precision; // How many decimal places for x and y. FIX: in IMO, but not RTCM
55 int e_dim_m; // East dimension in meters
56 int n_dim_m;
57 int orient_deg; // Orientation in degrees from true north
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
58 unsigned int spare; // 5 bits
59
60 Ais8_366_22_Rect(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
61 ~Ais8_366_22_Rect() { std::cout << "Ais8_366_22_Rect: destructor" << std::endl;};
62 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_RECT;}
63 void print();
64
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
65 };
66
67 class Ais8_366_22_Sector : public Ais8_366_22_SubArea {
68 public:
69 float x,y; // longitude and latitude
70 //int precision; // How many decimal places for x and y FIX: in IMO, but not RTCM
71 int radius_m;
72 int left_bound_deg;
73 int right_bound_deg;
74 //int spare; // bits
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
75
76 Ais8_366_22_Sector(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
77 ~Ais8_366_22_Sector() { std::cout << "Ais8_366_22_Sector: destructor" << std::endl;};
78 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_SECTOR;}
79 void print();
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
80 };
81
82 // Or Waypoint
83 // Must have a point before on the VDL, but pulled together here.
84 class Ais8_366_22_Polyline : public Ais8_366_22_SubArea {
85 public:
86
87 // x, y, and precision sent as separate Point before the waypoint start
88 float x,y; // longitude and latitude
89 //int precision; // How many decimal places for x and y. FIX: in IMO
90
91 // Up to 4 points
92 std::vector<float> angles;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
93 std::vector<float> dists_m;
94 unsigned int spare; // 1 bit
95
96 Ais8_366_22_Polyline(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
97 ~Ais8_366_22_Polyline() { std::cout << "Ais8_366_22_Polyline: destructor" << std::endl;};
98 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYLINE;}
99 void print();
100
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
101 };
102
103 class Ais8_366_22_Polygon : public Ais8_366_22_SubArea {
104 public:
105
106 // x, y, and precision sent as separate Point before the waypoint start
107 float x,y; // longitude and latitude
108 //int precision; // How many decimal places for x and y. FIX: in IMO
109
110 // Up to 4 points in a first message, but aggregated if multiple sub areas
111 std::vector<float> angles;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
112 std::vector<float> dists_m;
113 unsigned int spare; // 1 bit
114
115 Ais8_366_22_Polygon(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
116 ~Ais8_366_22_Polygon() { std::cout << "Ais8_366_22_Polygon: destructor" << std::endl;};
117 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYGON;}
118 void print();
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
119 };
120
121 class Ais8_366_22_Text : public Ais8_366_22_SubArea {
122 public:
123 std::string text;
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
124 unsigned int spare; // 3 bits
125
126 Ais8_366_22_Text(const std::bitset<AIS8_MAX_BITS> &bs, const size_t offset);
127 ~Ais8_366_22_Text() { std::cout << "Ais8_366_22_Text: destructor" << std::endl;};
128 Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_TEXT;}
129 void print();
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
130 };
131
132 class Ais8_366_22 : public Ais8 {
133 public:
134 // Common block at the front
135 int link_id; // 10 bit id to match up text blocks
136 int notice_type; // area_type / Notice Description
137 int month; // These really are in utc
138 int day;
139 int utc_hour;
140 int utc_minute;
141 int duration_minutes; // Time from the start until the notice expires
142
143 // 1 or more sub messages
144
145 std::vector<Ais8_366_22_SubArea *> sub_areas;
146
147 Ais8_366_22(const char *nmea_payload);
0fc6efb Msg 8:366:22 is starting to work. Should handle everything at a low lev...
Kurt Schwehr authored
148 ~Ais8_366_22();
3d5b0eb Kurt Schwehr Working on the area notice based on the RTCM doc from Greg, but without ...
authored
149 void print();
150 };
151 std::ostream& operator<< (std::ostream& o, Ais8_366_22 const& msg);
152
153 // std::vector<std::string> notice_names;
154 const size_t AIS8_366_22_NUM_NAMES=128;
791c882 Kurt Schwehr First round of tests appear to work for the IMO area notice that come fr...
authored
155 extern const char *ais8_366_22_notice_names[AIS8_366_22_NUM_NAMES]; //128];
Something went wrong with that request. Please try again.