This class defines a region with left and right sides and width and height. More...
#include <region.h>
Public Member Functions | |
Region (double x=NAN, double y=NAN, double w=NAN, double h=NAN) | |
virtual | ~Region () |
double | x () const |
double | y () const |
double | width () const |
double | height () const |
void | xywh (double &x, double &y, double &w, double &h) const |
double | left () const |
double | right () const |
double | top () const |
double | bottom () const |
void | lrtb (double &l, double &r, double &t, double &b) const |
void | set_lrtb (double l, double r, double t, double b) |
void | center (double &x, double &y) const |
void | set_x (double x) |
void | set_y (double y) |
void | set_width (double w) |
void | set_height (double h) |
void | set_xywh (double x, double y, double w, double h) |
void | invalidate () |
Sets all parameters to NAN. | |
bool | include (const Region &other) |
Expands this region to include region other. | |
bool | include (double x, double y) |
Expands this region to include the point (x,y). | |
bool | include_x (double x) |
Expands this region to include x between m_x and m_x + m_w. | |
bool | include_y (double y) |
Expands this region to include y between m_y and m_y + m_h. | |
void | left_bottom (double &l, double &b) const |
void | right_top (double &r, double &t) const |
Region & | operator= (const Region &other) |
bool | operator== (const Region &other) const |
true if the regions are identical | |
bool | operator!= (const Region &other) const |
bool | operator< (const Region &other) const |
true if this region is completely contained within the other region | |
bool | operator<= (const Region &other) const |
bool | operator> (const Region &other) const |
true of this region is completely outside the other region | |
bool | operator>= (const Region &other) const |
operator bool () const | |
bool | is_inside (double x, double y) const |
true if (x,y) is an interior point of or on the boundary of this region | |
bool | is_interior (double x, double y) const |
true if (x,y) is an interior point of this region | |
bool | is_boundary (double x, double y) const |
true if (x,y) is a boundary point of this region | |
bool | overlaps (const Region &other) const |
true if any part of this region overlaps the other region | |
void | transform (const Matrix &matrix) |
sigc::signal< void > & | signal_changed () |
Protected Member Functions | |
bool | include_point (double x, double y) |
Protected Attributes | |
double | m_x |
double | m_y |
double | m_w |
double | m_h |
bool | m_suppress_change_signal |
sigc::signal< void > | m_signal_changed |
This class defines a region with left and right sides and width and height.
A region is invalid if any aspect (l,r,w,h) evaluates to NAN.
Papyrus::Region::Region | ( | double | x = NAN , |
|
double | y = NAN , |
|||
double | w = NAN , |
|||
double | h = NAN | |||
) |
Papyrus::Region::~Region | ( | ) | [virtual] |
double Papyrus::Region::height | ( | ) | const |
References m_h.
Referenced by Papyrus::Rotator::on_button_press(), Papyrus::Scaler::on_motion(), and Papyrus::Viewbox::transformation_matrix().
bool Papyrus::Region::include | ( | double | x, | |
double | y | |||
) |
Expands this region to include the point (x,y).
References include_x(), include_y(), m_signal_changed, and m_suppress_change_signal.
bool Papyrus::Region::include | ( | const Region & | other | ) |
Expands this region to include region other.
other | At a minimum must have valid (x,y) coordinates |
References bottom(), include_x(), include_y(), left(), m_signal_changed, m_suppress_change_signal, right(), and top().
Referenced by Papyrus::Group::add(), Papyrus::Rectangle::calculate_extents(), Papyrus::Group::calculate_extents(), Papyrus::Circle::calculate_extents(), Papyrus::Boxed::calculate_extents(), Papyrus::DrawableSet::extents(), Papyrus::Drawable::extents(), and Papyrus::Drawable::redraw().
bool Papyrus::Region::include_point | ( | double | x, | |
double | y | |||
) | [protected] |
bool Papyrus::Region::include_x | ( | double | x | ) |
Expands this region to include x between m_x and m_x + m_w.
References m_signal_changed, m_suppress_change_signal, m_w, and m_x.
Referenced by include().
bool Papyrus::Region::include_y | ( | double | y | ) |
Expands this region to include y between m_y and m_y + m_h.
References m_h, m_signal_changed, m_suppress_change_signal, and m_y.
Referenced by include().
void Papyrus::Region::invalidate | ( | ) |
Sets all parameters to NAN.
References m_h, m_signal_changed, m_w, m_x, and m_y.
Referenced by Papyrus::Drawable::redraw().
bool Papyrus::Region::is_boundary | ( | double | x, | |
double | y | |||
) | const |
bool Papyrus::Region::is_inside | ( | double | x, | |
double | y | |||
) | const |
true if (x,y) is an interior point of or on the boundary of this region
References m_h, m_w, m_x, and m_y.
Referenced by Papyrus::Image::inside().
bool Papyrus::Region::is_interior | ( | double | x, | |
double | y | |||
) | const |
double Papyrus::Region::left | ( | ) | const |
References m_x.
Referenced by include(), and Papyrus::Rotator::on_button_press().
void Papyrus::Region::left_bottom | ( | double & | l, | |
double & | b | |||
) | const |
void Papyrus::Region::lrtb | ( | double & | l, | |
double & | r, | |||
double & | t, | |||
double & | b | |||
) | const |
References m_h, m_w, m_x, and m_y.
Referenced by Papyrus::Gtk::ScrolledViewport::on_canvas_extents_changed().
bool Papyrus::Region::operator!= | ( | const Region & | other | ) | const |
bool Papyrus::Region::operator< | ( | const Region & | other | ) | const |
Reimplemented in Papyrus::Viewbox.
References m_h, m_signal_changed, m_w, m_x, and m_y.
bool Papyrus::Region::operator== | ( | const Region & | other | ) | const |
bool Papyrus::Region::operator> | ( | const Region & | other | ) | const |
true of this region is completely outside the other region
bool Papyrus::Region::operator>= | ( | const Region & | other | ) | const |
bool Papyrus::Region::overlaps | ( | const Region & | other | ) | const |
void Papyrus::Region::right_top | ( | double & | r, | |
double & | t | |||
) | const |
void Papyrus::Region::set_height | ( | double | h | ) |
References m_h, and m_signal_changed.
void Papyrus::Region::set_lrtb | ( | double | l, | |
double | r, | |||
double | t, | |||
double | b | |||
) |
References set_xywh().
Referenced by Papyrus::Canvas::anchor_extents().
void Papyrus::Region::set_width | ( | double | w | ) |
References m_signal_changed, and m_w.
void Papyrus::Region::set_x | ( | double | x | ) |
References m_signal_changed, and m_x.
void Papyrus::Region::set_xywh | ( | double | x, | |
double | y, | |||
double | w, | |||
double | h | |||
) |
References m_h, m_signal_changed, m_w, m_x, and m_y.
Referenced by set_lrtb().
void Papyrus::Region::set_y | ( | double | y | ) |
References m_signal_changed, and m_y.
sigc::signal< void > & Papyrus::Region::signal_changed | ( | ) |
References m_signal_changed.
double Papyrus::Region::top | ( | ) | const |
References m_y.
Referenced by include(), and Papyrus::Rotator::on_button_press().
void Papyrus::Region::transform | ( | const Matrix & | matrix | ) |
References m_h, m_signal_changed, m_w, m_x, m_y, Papyrus::Matrix::transform_point(), x(), and y().
Referenced by Papyrus::Image::calculate_extents(), Papyrus::Drawable::extents(), Papyrus::Drawable::matrix(), Papyrus::Group::on_child_redraw(), and Papyrus::Drawable::pre_viewbox_extents().
double Papyrus::Region::width | ( | ) | const |
References m_w.
Referenced by Papyrus::Rotator::on_button_press(), Papyrus::Scaler::on_motion(), and Papyrus::Viewbox::transformation_matrix().
double Papyrus::Region::x | ( | ) | const |
References m_x.
Referenced by Papyrus::Scaler::on_motion(), transform(), and Papyrus::Viewbox::transformation_matrix().
void Papyrus::Region::xywh | ( | double & | x, | |
double & | y, | |||
double & | w, | |||
double & | h | |||
) | const |
References m_h, m_w, m_x, and m_y.
Referenced by Papyrus::Group::on_child_redraw(), Papyrus::Drawable::redraw(), Papyrus::Rectangle::set_xywh(), and Papyrus::Viewbox::transformation_matrix().
double Papyrus::Region::y | ( | ) | const |
References m_y.
Referenced by transform(), and Papyrus::Viewbox::transformation_matrix().
double Papyrus::Region::m_h [protected] |
Referenced by bottom(), center(), height(), include_point(), include_y(), invalidate(), is_boundary(), is_inside(), is_interior(), lrtb(), operator bool(), operator<(), operator<=(), operator=(), operator==(), overlaps(), set_height(), set_xywh(), transform(), Papyrus::Viewbox::transformation_matrix(), and xywh().
sigc::signal<void> Papyrus::Region::m_signal_changed [protected] |
bool Papyrus::Region::m_suppress_change_signal [protected] |
Referenced by include(), include_x(), and include_y().
double Papyrus::Region::m_w [protected] |
Referenced by center(), include_point(), include_x(), invalidate(), is_boundary(), is_inside(), is_interior(), lrtb(), operator bool(), operator<(), operator<=(), operator=(), operator==(), overlaps(), right(), set_width(), set_xywh(), transform(), Papyrus::Viewbox::transformation_matrix(), width(), and xywh().
double Papyrus::Region::m_x [protected] |
Referenced by center(), include_point(), include_x(), invalidate(), is_boundary(), is_inside(), is_interior(), left(), lrtb(), operator bool(), operator<(), operator<=(), operator=(), operator==(), overlaps(), right(), set_x(), set_xywh(), transform(), Papyrus::Viewbox::transformation_matrix(), x(), and xywh().
double Papyrus::Region::m_y [protected] |
Referenced by bottom(), center(), include_point(), include_y(), invalidate(), is_boundary(), is_inside(), is_interior(), lrtb(), operator bool(), operator<(), operator<=(), operator=(), operator==(), overlaps(), set_xywh(), set_y(), top(), transform(), Papyrus::Viewbox::transformation_matrix(), xywh(), and y().