Goby v2
liaison_geodesy.h
1 // Copyright 2009-2018 Toby Schneider (http://gobysoft.org/index.wt/people/toby)
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 //
6 //
7 // This file is part of the Goby Underwater Autonomy Project Libraries
8 // ("The Goby Libraries").
9 //
10 // The Goby Libraries are free software: you can redistribute them and/or modify
11 // them under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 2.1 of the License, or
13 // (at your option) any later version.
14 //
15 // The Goby Libraries are distributed in the hope that they will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
22 
23 #ifndef LIAISONGEODESY20131115H
24 #define LIAISONGEODESY20131115H
25 
26 #include <Wt/WBoxLayout>
27 #include <Wt/WText>
28 #include <Wt/WTimer>
29 #include <Wt/WVBoxLayout>
30 
31 #include "goby/common/liaison_container.h"
32 #include "goby/moos/moos_geodesy.h"
33 #include "goby/moos/protobuf/liaison_config.pb.h"
34 
35 namespace goby
36 {
37 namespace common
38 {
40 {
41  public:
42  LiaisonGeodesy(const protobuf::LiaisonConfig& cfg, Wt::WContainerWidget* parent = 0);
43 
44  private:
45  enum LatLonMode
46  {
47  DECIMAL_DEGREES = 0,
48  DEGREES_MINUTES = 1,
49  DEGREES_MINUTES_SECONDS = 2
50  };
51 
52  void loop();
53  void convert_local_to_geo();
54  void convert_geo_to_local();
55 
56  void reformat();
57 
58  enum LatLon
59  {
60  LAT,
61  LON
62  };
63 
64  std::wstring format(double angle, LatLonMode mode, LatLon type);
65 
66  void change_mode();
67 
68  private:
69  const protobuf::GeodesyConfig& geodesy_config_;
70 
71  Wt::WText* datum_lat_;
72  Wt::WText* datum_lon_;
73 
74  Wt::WPushButton* local_to_geo_button_;
75  Wt::WLineEdit* local_to_geo_x_;
76  Wt::WLineEdit* local_to_geo_y_;
77  Wt::WText* local_to_geo_lat_;
78  Wt::WText* local_to_geo_lon_;
79 
80  Wt::WPushButton* geo_to_local_button_;
81  Wt::WText* geo_to_local_x_;
82  Wt::WText* geo_to_local_y_;
83 
84  Wt::WLineEdit* geo_to_local_lat_deg_;
85  Wt::WLineEdit* geo_to_local_lon_deg_;
86 
87  Wt::WContainerWidget* lat_min_box_;
88  Wt::WLineEdit* geo_to_local_lat_min_;
89  Wt::WContainerWidget* lon_min_box_;
90  Wt::WLineEdit* geo_to_local_lon_min_;
91  Wt::WContainerWidget* lat_hemi_box_;
92  Wt::WComboBox* geo_to_local_lat_hemi_;
93  Wt::WContainerWidget* lon_hemi_box_;
94  Wt::WComboBox* geo_to_local_lon_hemi_;
95 
96  Wt::WContainerWidget* lat_sec_box_;
97  Wt::WLineEdit* geo_to_local_lat_sec_;
98  Wt::WContainerWidget* lon_sec_box_;
99  Wt::WLineEdit* geo_to_local_lon_sec_;
100 
101  Wt::WComboBox* latlon_format_;
102 
103  CMOOSGeodesy geodesy_;
104 
105  LatLonMode mode_;
106 
107  double last_lat_, last_lon_, last_x_, last_y_;
108 };
109 
110 } // namespace common
111 } // namespace goby
112 
113 #endif
The global namespace for the Goby project.