1 // An OpenVG path on the Canvas
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_PATH_HXX_
20 #define CANVAS_PATH_HXX_
22 #include "CanvasElement.hxx"
23 #include <boost/preprocessor/iteration/iterate.hpp>
33 Path( const CanvasWeakPtr& canvas,
34 const SGPropertyNode_ptr& node,
35 const Style& parent_style,
36 Element* parent = 0 );
39 virtual void update(double dt);
41 virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const;
43 #define BOOST_PP_ITERATION_LIMITS (0, 6)
44 #define BOOST_PP_FILENAME_1 \
45 <simgear/canvas/elements/detail/add_segment_variadic.hxx>
46 #include BOOST_PP_ITERATE()
48 /** Move path cursor */
49 Path& moveTo(float x_abs, float y_abs);
50 Path& move(float x_rel, float y_rel);
53 Path& lineTo(float x_abs, float y_abs);
54 Path& line(float x_rel, float y_rel);
56 /** Add a horizontal line */
57 Path& horizTo(float x_abs);
58 Path& horiz(float x_rel);
60 /** Add a vertical line */
61 Path& vertTo(float y_abs);
62 Path& vert(float y_rel);
64 /** Close the path (implicit lineTo to first point of path) */
71 CMDS = LAST_ATTRIBUTE << 1,
76 typedef osg::ref_ptr<PathDrawable> PathDrawableRef;
77 PathDrawableRef _path;
79 virtual void childRemoved(SGPropertyNode * child);
80 virtual void childChanged(SGPropertyNode * child);
84 } // namespace simgear
86 #endif /* CANVAS_PATH_HXX_ */