return _path->getTransformedBounds(m);
}
+ //----------------------------------------------------------------------------
+ Path& Path::moveTo(float x_abs, float y_abs)
+ {
+ return addSegment(VG_MOVE_TO_ABS, x_abs, y_abs);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::move(float x_rel, float y_rel)
+ {
+ return addSegment(VG_MOVE_TO_REL, x_rel, y_rel);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::lineTo(float x_abs, float y_abs)
+ {
+ return addSegment(VG_LINE_TO_ABS, x_abs, y_abs);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::line(float x_rel, float y_rel)
+ {
+ return addSegment(VG_LINE_TO_REL, x_rel, y_rel);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::horizTo(float x_abs)
+ {
+ return addSegment(VG_HLINE_TO_ABS, x_abs);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::horiz(float x_rel)
+ {
+ return addSegment(VG_HLINE_TO_REL, x_rel);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::vertTo(float y_abs)
+ {
+ return addSegment(VG_VLINE_TO_ABS, y_abs);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::vert(float y_rel)
+ {
+ return addSegment(VG_VLINE_TO_REL, y_rel);
+ }
+
+ //----------------------------------------------------------------------------
+ Path& Path::close()
+ {
+ return addSegment(VG_CLOSE_PATH);
+ }
+
//----------------------------------------------------------------------------
void Path::childRemoved(SGPropertyNode* child)
{
#define CANVAS_PATH_HXX_
#include "CanvasElement.hxx"
+#include <boost/preprocessor/iteration/iterate.hpp>
namespace simgear
{
virtual osg::BoundingBox getTransformedBounds(const osg::Matrix& m) const;
+#define BOOST_PP_ITERATION_LIMITS (0, 6)
+#define BOOST_PP_FILENAME_1 \
+ <simgear/canvas/elements/detail/add_segment_variadic.hxx>
+#include BOOST_PP_ITERATE()
+
+ /** Move path cursor */
+ Path& moveTo(float x_abs, float y_abs);
+ Path& move(float x_rel, float y_rel);
+
+ /** Add a line */
+ Path& lineTo(float x_abs, float y_abs);
+ Path& line(float x_rel, float y_rel);
+
+ /** Add a horizontal line */
+ Path& horizTo(float x_abs);
+ Path& horiz(float x_rel);
+
+ /** Add a vertical line */
+ Path& vertTo(float y_abs);
+ Path& vert(float y_rel);
+
+ /** Close the path (implicit lineTo to first point of path) */
+ Path& close();
+
protected:
enum PathAttributes
--- /dev/null
+#ifndef CANVAS_PATH_HXX_
+# error Canvas - do not include this file!
+#endif
+
+#define n BOOST_PP_ITERATION()
+
+Path& addSegment( uint8_t cmd
+ BOOST_PP_COMMA_IF(n)
+ BOOST_PP_ENUM_PARAMS(n, float coord) )
+{
+ _node->addChild("cmd")->setIntValue(cmd);
+
+#define SG_CANVAS_PATH_SET_COORD(z, n, dummy)\
+ _node->addChild("coord")->setFloatValue(coord##n);
+
+ BOOST_PP_REPEAT(n, SG_CANVAS_PATH_SET_COORD, 0)
+#undef SG_CANVAS_PATH_SET_COORD
+ return *this;
+}
+
+#undef n