A polyline is drawn as a set of ordered vertices relative to the shape's x,y coordinate. More...
#include <polyline.h>
Public Member Functions | |
PAPYRUS_DRAWABLE (Polyline) | |
virtual | ~Polyline () |
Polyline & | operator= (const Polyline &other) |
Vertex | vertex (unsigned n) const |
const Vertices & | vertices () const |
void | add_vertex (Vertex v) |
void | add_vertex (double x, double y) |
void | set_vertex (unsigned n, Vertex v) |
void | set_vertex (unsigned n, double x, double y) |
void | set_vertices (const Vertices &vertices) |
virtual Marker::pointer | marker (MarkerPosition position) |
virtual bool | set_marker (MarkerPosition position, Marker::pointer marker) |
Sets the specified marker to the provided drawable. | |
virtual void | draw (Context &cairo) const |
virtual void | draw_shape (Context &cairo) const |
Draws on the provided context. | |
sigc::signal< void, unsigned > | signal_vertex () |
sigc::signal< void > | signal_vertices () |
Static Public Member Functions | |
static pointer | create (const Vertices &vertices=Vertices(), Stroke::pointer stroke=Stroke::pointer()) |
Creates a polyline from a specified set of vertices. | |
static pointer | create (const Vertices &vertices, Fill::pointer fill, Stroke::pointer stroke=Stroke::pointer()) |
static pointer | create (const Glib::ustring &id, Vertices vertices=Vertices(), Stroke::pointer stroke=Stroke::pointer()) |
static pointer | create (const Glib::ustring &id, Vertices vertices, Fill::pointer fill, Stroke::pointer stroke=Stroke::pointer()) |
Protected Member Functions | |
Polyline (const Glib::ustring &id, const Vertices &vertices, Fill::pointer fill, Stroke::pointer stroke) | |
virtual void | on_vertex_changed (int n) |
virtual void | on_vertices_changed () |
void | update_marker_position (MarkerPosition n) |
virtual Region | calculate_pre_viewbox_extents (const Matrix &m=Matrix::Identity) const |
This method extends the parent Shape method by incorporating any marker extents in the raw extents. | |
void | on_marker_changed (MarkerPosition which) |
Protected Attributes | |
Vertices | m_vertices |
Marker::pointer | m_markers [3] |
sigc::signal< void, unsigned > | m_signal_vertex |
sigc::signal< void > | m_signal_vertices |
sigc::connection | m_marker_changed_connections [3] |
A polyline is drawn as a set of ordered vertices relative to the shape's x,y coordinate.
Polylines may be filled or unfilled. An unfilled polyline is more conceptually familiar with what is implied by a polyline. A filled polyline is essentially an unclosed polygon.
Unfilled Polyline
Filled Polyline
Papyrus::Polyline::Polyline | ( | const Glib::ustring & | id, | |
const Vertices & | vertices, | |||
Fill::pointer | fill, | |||
Stroke::pointer | stroke | |||
) | [protected] |
Papyrus::Polyline::~Polyline | ( | ) | [virtual] |
void Papyrus::Polyline::add_vertex | ( | double | x, | |
double | y | |||
) |
References m_vertices, and on_vertex_changed().
void Papyrus::Polyline::add_vertex | ( | Vertex | v | ) |
References m_vertices, and on_vertex_changed().
Region Papyrus::Polyline::calculate_pre_viewbox_extents | ( | const Matrix & | m = Matrix::Identity |
) | const [protected, virtual] |
This method extends the parent Shape method by incorporating any marker extents in the raw extents.
References Papyrus::Drawable::calculate_extents().
Polyline::pointer Papyrus::Polyline::create | ( | const Glib::ustring & | id, | |
Vertices | vertices, | |||
Fill::pointer | fill, | |||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
References PAPYRUS_CREATE.
Polyline::pointer Papyrus::Polyline::create | ( | const Glib::ustring & | id, | |
Vertices | vertices = Vertices() , |
|||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
References PAPYRUS_CREATE.
Polyline::pointer Papyrus::Polyline::create | ( | const Vertices & | vertices, | |
Fill::pointer | fill, | |||
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
Reimplemented in Papyrus::Polygon.
References PAPYRUS_CREATE.
Polyline::pointer Papyrus::Polyline::create | ( | const Vertices & | vertices = Vertices() , |
|
Stroke::pointer | stroke = Stroke::pointer() | |||
) | [static] |
Creates a polyline from a specified set of vertices.
References PAPYRUS_CREATE.
Referenced by Papyrus::Gtk::LineWidthComboBox::load_pixbufs(), Papyrus::Gtk::StrokeWidget::set_use_preview(), and Papyrus::Gtk::MarkerWidget::set_use_preview().
void Papyrus::Polyline::draw | ( | Context & | cairo | ) | const [virtual] |
Reimplemented from Papyrus::Shape.
References draw_shape(), Papyrus::Shape::draw_stroke_path(), Papyrus::END_MARKER, Papyrus::Context::fill(), Papyrus::Context::is_flag_unset(), Papyrus::Shape::m_fill, m_marker_changed_connections, m_markers, Papyrus::Shape::m_stroke, m_vertices, Papyrus::Drawable::render(), Papyrus::RENDER_SUPPRESS_MATRIX, Papyrus::Drawable::set_rotation(), Papyrus::START_MARKER, and Papyrus::Context::stroke().
void Papyrus::Polyline::draw_shape | ( | Context & | cairo | ) | const [virtual] |
Draws on the provided context.
Implements Papyrus::Shape.
Reimplemented in Papyrus::Polygon.
References m_vertices, Papyrus::Drawable::x(), and Papyrus::Drawable::y().
Referenced by draw().
Marker::pointer Papyrus::Polyline::marker | ( | MarkerPosition | position | ) | [virtual] |
References Papyrus::END_MARKER, and m_markers.
void Papyrus::Polyline::on_marker_changed | ( | MarkerPosition | which | ) | [protected] |
References Papyrus::Shape::shape_changed().
Referenced by set_marker().
void Papyrus::Polyline::on_vertex_changed | ( | int | n | ) | [protected, virtual] |
References m_signal_vertex, m_signal_vertices, and Papyrus::Shape::shape_changed().
Referenced by add_vertex(), and set_vertex().
void Papyrus::Polyline::on_vertices_changed | ( | ) | [protected, virtual] |
References m_signal_vertices, and Papyrus::Shape::shape_changed().
Referenced by Papyrus::Sierpinski::create_vertices(), Papyrus::RegularPolygon::create_vertices(), Papyrus::KochSnowflake::create_vertices(), Papyrus::KochCurve::create_vertices(), Papyrus::Hilbert::create_vertices(), and set_vertices().
Reimplemented from Papyrus::Shape.
References m_markers, m_signal_vertices, m_vertices, and papyrus_dynamic_pointer_cast.
Papyrus::Polyline::PAPYRUS_DRAWABLE | ( | Polyline | ) |
Reimplemented in Papyrus::Polygon, Papyrus::RegularPolygon, Papyrus::Hilbert, Papyrus::KochCurve, Papyrus::KochSnowflake, and Papyrus::Sierpinski.
bool Papyrus::Polyline::set_marker | ( | MarkerPosition | position, | |
Marker::pointer | marker | |||
) | [virtual] |
Sets the specified marker to the provided drawable.
References Papyrus::END_MARKER, m_marker_changed_connections, m_markers, on_marker_changed(), and Papyrus::Shape::shape_changed().
void Papyrus::Polyline::set_vertex | ( | unsigned | n, | |
double | x, | |||
double | y | |||
) |
References m_vertices, and on_vertex_changed().
void Papyrus::Polyline::set_vertex | ( | unsigned | n, | |
Vertex | v | |||
) |
References m_vertices, and on_vertex_changed().
void Papyrus::Polyline::set_vertices | ( | const Vertices & | vertices | ) |
References m_vertices, and on_vertices_changed().
sigc::signal< void, unsigned > Papyrus::Polyline::signal_vertex | ( | ) |
References m_signal_vertex.
sigc::signal< void > Papyrus::Polyline::signal_vertices | ( | ) |
References m_signal_vertices.
void Papyrus::Polyline::update_marker_position | ( | MarkerPosition | n | ) | [protected] |
Vertex Papyrus::Polyline::vertex | ( | unsigned | n | ) | const |
References m_vertices.
const Vertices & Papyrus::Polyline::vertices | ( | ) | const |
References m_vertices.
sigc::connection Papyrus::Polyline::m_marker_changed_connections[3] [mutable, protected] |
Referenced by draw(), and set_marker().
Marker::pointer Papyrus::Polyline::m_markers[3] [protected] |
Referenced by draw(), marker(), operator=(), and set_marker().
sigc::signal<void, unsigned> Papyrus::Polyline::m_signal_vertex [protected] |
Referenced by on_vertex_changed(), and signal_vertex().
sigc::signal<void> Papyrus::Polyline::m_signal_vertices [protected] |
Referenced by on_vertex_changed(), on_vertices_changed(), operator=(), and signal_vertices().
Vertices Papyrus::Polyline::m_vertices [protected] |
Referenced by add_vertex(), Papyrus::Sierpinski::create_vertices(), Papyrus::RegularPolygon::create_vertices(), Papyrus::KochSnowflake::create_vertices(), Papyrus::KochCurve::create_vertices(), Papyrus::Hilbert::create_vertices(), draw(), draw_shape(), Papyrus::Polygon::draw_shape(), Papyrus::Hilbert::hilbert_a(), Papyrus::Hilbert::hilbert_b(), Papyrus::Hilbert::hilbert_c(), Papyrus::Hilbert::hilbert_d(), Papyrus::KochCurve::kochcurve(), Papyrus::KochSnowflake::kochsnowflake(), operator=(), set_vertex(), set_vertices(), Papyrus::Sierpinski::sierpinski_a(), Papyrus::Sierpinski::sierpinski_b(), Papyrus::Sierpinski::sierpinski_c(), Papyrus::Sierpinski::sierpinski_d(), vertex(), and vertices().