1 // Groups together two nodes representing a geographic position (lat + lon)
3 // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Library General Public
7 // License as published by the Free Software Foundation; either
8 // version 2 of the License, or (at your option) any later version.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
15 // You should have received a copy of the GNU Library General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef CANVAS_GEO_NODE_PAIR_HXX_
20 #define CANVAS_GEO_NODE_PAIR_HXX_
32 LON_MISSING = LAT_MISSING << 1,
33 INCOMPLETE = LAT_MISSING | LON_MISSING,
34 DIRTY = LON_MISSING << 1
43 uint8_t getStatus() const
48 void setDirty(bool flag = true)
58 return (_status & DIRTY)!=0;
61 bool isComplete() const
63 return !(_status & INCOMPLETE);
66 void setNodeLat(SGPropertyNode* node)
69 _status &= ~LAT_MISSING;
71 if( node == _node_lon )
74 _status |= LON_MISSING;
78 void setNodeLon(SGPropertyNode* node)
81 _status &= ~LON_MISSING;
83 if( node == _node_lat )
86 _status |= LAT_MISSING;
90 const char* getLat() const
92 return _node_lat ? _node_lat->getStringValue() : "";
95 const char* getLon() const
97 return _node_lon ? _node_lon->getStringValue() : "";
100 void setTargetName(const std::string& name)
105 void setScreenPos(float x, float y)
107 assert( isComplete() );
108 SGPropertyNode *parent = _node_lat->getParent();
109 parent->getChild(_target_name, _node_lat->getIndex(), true)
111 parent->getChild(_target_name, _node_lon->getIndex(), true)
117 std::cout << "lat=" << (_node_lat ? _node_lat->getPath() : "")
118 << ", lon=" << (_node_lon ? _node_lon->getPath() : "")
125 SGPropertyNode *_node_lat,
127 std::string _target_name;
131 } // namespace canvas
132 } // namespace simgear
134 #endif /* CANVAS_GEO_NODE_PAIR_HXX_ */