papyrus logo

Papyrus::Region Class Reference

This class defines a region with left and right sides and width and height. More...

#include <region.h>

Inheritance diagram for Papyrus::Region:
Inheritance graph
[legend]

List of all members.

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
Regionoperator= (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

Detailed Description

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.

Author:
Rick L Vinyard Jr

Constructor & Destructor Documentation

Papyrus::Region::Region ( double  x = NAN,
double  y = NAN,
double  w = NAN,
double  h = NAN 
)
Papyrus::Region::~Region (  )  [virtual]

Member Function Documentation

double Papyrus::Region::bottom (  )  const

References m_h, and m_y.

Referenced by include().

void Papyrus::Region::center ( double &  x,
double &  y 
) const

References m_h, m_w, m_x, and m_y.

double Papyrus::Region::height (  )  const
bool Papyrus::Region::include ( double  x,
double  y 
)

Expands this region to include the point (x,y).

Returns:
true if inclusion of the point(x,y) caused a changed in this region, false otherwise
false if both parameters x and y are NAN.

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.

Returns:
true if inclusion of region other caused a change in this region, false otherwise
Parameters:
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]

References m_h, m_w, m_x, and m_y.

bool Papyrus::Region::include_x ( double  x  ) 

Expands this region to include x between m_x and m_x + m_w.

Returns:
true if the inclusion caused a change in this region, or false if no change occurred or x is NAN

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.

Returns:
true if the inclusion caused a change in this region, or false if no change occurred or y is NAN

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

true if (x,y) is a boundary point of this region

References m_h, m_w, m_x, and m_y.

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

true if (x,y) is an interior point of this region

References m_h, m_w, m_x, and m_y.

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
Papyrus::Region::operator bool (  )  const

References m_h, m_w, m_x, and m_y.

bool Papyrus::Region::operator!= ( const Region other  )  const
bool Papyrus::Region::operator< ( const Region other  )  const

true if this region is completely contained within the other region

References m_h, m_w, m_x, and m_y.

bool Papyrus::Region::operator<= ( const Region other  )  const

References m_h, m_w, m_x, and m_y.

Region & Papyrus::Region::operator= ( const Region other  ) 

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

true if the regions are identical

References m_h, m_w, m_x, and m_y.

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

true if any part of this region overlaps the other region

References m_h, m_w, m_x, and m_y.

double Papyrus::Region::right (  )  const

References m_w, and m_x.

Referenced by include().

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  ) 
double Papyrus::Region::width (  )  const
double Papyrus::Region::x (  )  const
void Papyrus::Region::xywh ( double &  x,
double &  y,
double &  w,
double &  h 
) const
double Papyrus::Region::y (  )  const

Member Data Documentation

double Papyrus::Region::m_h [protected]
sigc::signal<void> Papyrus::Region::m_signal_changed [protected]

Referenced by include(), include_x(), and include_y().

double Papyrus::Region::m_w [protected]
double Papyrus::Region::m_x [protected]
double Papyrus::Region::m_y [protected]

The documentation for this class was generated from the following files:

Generated on Fri Apr 16 12:41:09 2010 for papyrus by doxygen 1.6.1