1 // The canvas for rendering with the 2d api
3 // Copyright (C) 2012 Thomas Geymayer <tomgey@gmail.com>
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <Instrumentation/od_gauge.hxx>
23 #include <simgear/props/props.hxx>
24 #include <osg/NodeCallback>
26 #include <boost/shared_ptr.hpp>
35 public SGPropertyChangeListener
42 MISSING_SIZE_X = 0x0001,
43 MISSING_SIZE_Y = 0x0002,
44 CREATE_FAILED = 0x0004
50 void reset(SGPropertyNode* node);
51 void update(double delta_time_sec);
53 void setSizeX(int sx);
56 void setSizeY(int sy);
59 void setViewWidth(int w);
60 int getViewWidth() const;
62 void setViewHeight(int h);
63 int getViewHeight() const;
65 int getStatus() const;
66 const char* getStatusMsg() const;
68 virtual void childAdded( SGPropertyNode * parent,
69 SGPropertyNode * child );
70 virtual void childRemoved( SGPropertyNode * parent,
71 SGPropertyNode * child );
72 virtual void valueChanged (SGPropertyNode * node);
76 Canvas(const Canvas&); // = delete;
77 Canvas& operator=(const Canvas&); // = delete;
85 std::string _status_msg;
92 SGPropertyNode_ptr _node;
93 std::vector<SGPropertyNode_ptr> _color_background;
95 osg::ref_ptr<osg::NodeCallback> _camera_callback;
96 osg::ref_ptr<osg::NodeCallback> _cull_callback;
97 std::vector<SGPropertyNode*> _dirty_placements;
98 std::vector<Placements> _placements;
100 // TODO replace auto_ptr with unique_ptr as soon as C++11 is used!
101 std::vector<boost::shared_ptr<canvas::Group> > _groups;
103 void setStatusFlags(unsigned int flags, bool set = true);
104 void clearPlacements(int index);
105 void clearPlacements();
110 #endif /* CANVAS_HXX_ */