]> git.mxchange.org Git - flightgear.git/blob - src/Canvas/elements/map.hxx
Fix a Clang warning in Shiva.
[flightgear.git] / src / Canvas / elements / map.hxx
1 // A group of 2D canvas elements which get automatically transformed according
2 // to the map parameters.
3 //
4 // Copyright (C) 2012  Thomas Geymayer <tomgey@gmail.com>
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License as
8 // published by the Free Software Foundation; either version 2 of the
9 // License, or (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19
20 #ifndef CANVAS_MAP_HXX_
21 #define CANVAS_MAP_HXX_
22
23 #include "group.hxx"
24
25 #include <boost/shared_ptr.hpp>
26 #include <boost/unordered_map.hpp>
27
28 namespace canvas
29 {
30   class GeoNodePair;
31   class HorizontalProjection;
32   class Map:
33     public Group
34   {
35     public:
36       Map(SGPropertyNode_ptr node, const Style& parent_style);
37       virtual ~Map();
38
39       virtual void update(double dt);
40
41       virtual void childAdded( SGPropertyNode * parent,
42                                SGPropertyNode * child );
43       virtual void childRemoved( SGPropertyNode * parent,
44                                  SGPropertyNode * child );
45       virtual void valueChanged(SGPropertyNode * child);
46
47     protected:
48
49       virtual void childChanged(SGPropertyNode * child);
50
51       typedef boost::unordered_map< SGPropertyNode*,
52                                     boost::shared_ptr<GeoNodePair>
53                                   > GeoNodes;
54       GeoNodes _geo_nodes;
55       boost::shared_ptr<HorizontalProjection> _projection;
56       bool _projection_dirty;
57
58       struct GeoCoord
59       {
60         GeoCoord():
61           type(INVALID)
62         {}
63         enum
64         {
65           INVALID,
66           LATITUDE,
67           LONGITUDE
68         } type;
69         double value;
70       };
71
72       GeoCoord parseGeoCoord(const std::string& val) const;
73   };
74
75 } // namespace canvas
76
77 #endif /* CANVAS_MAP_HXX_ */