Rect Class Reference

#include <Rectangle.h>

Collaboration diagram for Rect:

Collaboration graph
SizePoint
[legend]
List of all members.

Detailed Description

Class representing a rectangle.

Attention:
Some methods that show hide usage in a profile of displaying large image have been optimized by directly accessing member functions of data members rather than using the public interface. Also the in line functions had a high profile when plotting large images.
Note:
Would like to have this class named Rectangle, but it conflicts with an apparent typedef under Windows.

Definition at line 34 of file Rectangle.h.

Public Member Functions

double getDepth () const
 A shortcut to get size.depth.
double getHeight () const
 A shortcut to get size.height.
double getWidth () const
 A shortcut to get size.width.
double getX () const
 A shortcut to get origin.X.
double getY () const
 A shortcut to get origin.Y.
double getZ () const
 A shortcut to get origin.Z.
bool isInBounds (double x1, double y1, double z1) const
 Checks the coordinates to see if they are inside or on the boundary of the rectangle.
bool isInBounds (double x1, double y1) const
 Checks the coordinates to see if they are inside or on the boundary of the rectangle.
bool isInDepth (double z1) const
 Checks the value against the depth to see if it is in bounds.
void makeInBounds (std::vector< double > &x, std::vector< double > &y, std::vector< double > &z) const
 Changes the coordinates so that they are inside or on the boundary of the rectangle.
void makeInBounds (std::vector< double > &x, std::vector< double > &y) const
 Changes the coordinates so that they are inside or on the boundary of the rectangle.
void makeInBounds (double &x, double &y, double &z) const
 Changes the coordinates so that they are inside or on the boundary of the rectangle.
void makeInBounds (double &x, double &y) const
 Changes the coordinates so that they are inside or on the boundary of the rectangle.
void moveBy (double x, double y)
 Moves the Rectangle by specified amount.
 Rect (double x, double y, double z, double width, double height, double depth)
 constructor for 3D Rectangle.
 Rect (double x, double y, double width, double height)
 Constructor for 2D Rectangle.
 Rect ()
 Default constructor.
void setDepth (double)
 Sets the depth of the rectangle.
void setRect (double x, double y, double z, double width, double height, double depth)
 Set the parameters of 3D Rectangle.
void setRect (double x, double y, double width, double height)
 Set the parameters of 2D Rectangle.
void setZ (double)
 Sets the Z dimension.

Private Member Functions

const PointgetOrigin () const
 Returns the origin.
const SizegetSize () const
 Returns the size.

Private Attributes

Point m_origin
 The origin of the Rectangle.
Size m_size
 The size of the Rectangle.


Constructor & Destructor Documentation

Rect (  ) 

Default constructor.

Definition at line 51 of file Rectangle.cxx.

Rect ( double  x,
double  y,
double  width,
double  height 
)

Constructor for 2D Rectangle.

Definition at line 57 of file Rectangle.cxx.

References Rect::setRect().

Rect ( double  x,
double  y,
double  z,
double  width,
double  height,
double  depth 
)

constructor for 3D Rectangle.

Definition at line 63 of file Rectangle.cxx.

References Rect::setRect().


Member Function Documentation

double getDepth (  )  const

A shortcut to get size.depth.

Definition at line 118 of file Rectangle.cxx.

References Size::getDepth(), and Rect::getSize().

Referenced by Rect::isInBounds(), Rect::makeInBounds(), and DataView::userToMarginColor().

double getHeight (  )  const

A shortcut to get size.height.

Definition at line 113 of file Rectangle.cxx.

References Size::getHeight(), and Rect::m_size.

Referenced by ViewBaseXML::createElement(), DrawBorder::draw(), QtViewImp::drawImage(), AxisRepBase::drawReferencePoint(), LinePointRep::drawValues(), AxisRepBase::drawXLabels(), AxisRepBase::drawXMag(), AxisRepBase::drawXTickLines(), AxisRepBase::drawYLabels(), AxisRepColor::drawZLabels(), AxisRepBase::initAxisRect(), Rect::isInBounds(), Rect::makeInBounds(), DataView::marginToInvertedUserY(), DataView::marginToUserY(), DataView::prepareMarginRect(), PyCanvas::setWidth(), AxisRepBase::setXFontSize(), AxisRepBase::setYFontSize(), AxisRepBase::setZFontSize(), OpenGLView::toViewY(), EpsView::toViewY(), OpenGLView::toY(), EpsView::toY(), QtView::updateDrawRect(), DataView::userToInvertedMarginY(), DataView::userToMarginY(), and YPADDING().

const Point & getOrigin (  )  const [private]

Returns the origin.

Definition at line 88 of file Rectangle.cxx.

References Rect::m_origin.

Referenced by Rect::getZ().

const Size & getSize (  )  const [private]

Returns the size.

Definition at line 93 of file Rectangle.cxx.

References Rect::m_size.

Referenced by Rect::getDepth().

double getWidth (  )  const

A shortcut to get size.width.

Definition at line 108 of file Rectangle.cxx.

References Size::getWidth(), and Rect::m_size.

Referenced by ViewBaseXML::createElement(), DrawBorder::draw(), AxisRepColor::drawColorScale(), QtViewImp::drawImage(), AxisRepBase::drawReferencePoint(), AxisRepBase::drawTitle(), LinePointRep::drawValues(), AxisRepBase::drawXLabels(), AxisRepBase::drawYLabels(), AxisRepBase::drawYTickLines(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), AxisRepBase::initAxisRect(), Rect::isInBounds(), Rect::makeInBounds(), DataView::marginToInvertedUserX(), DataView::marginToUserX(), DataView::prepareMarginRect(), QtView::setDrawRect(), AxisRepBase::setFontSize(), PyCanvas::setHeight(), AxisRepBase::setXFontSize(), AxisRepBase::setYFontSize(), OpenGLView::toViewY(), DataView::userToInvertedMarginX(), DataView::userToMarginColor(), DataView::userToMarginX(), XPADDING(), and ZPADDING().

double getX (  )  const [inline]

A shortcut to get origin.X.

Definition at line 154 of file Rectangle.h.

References Point::getX(), and Rect::m_origin.

Referenced by ViewBaseXML::createElement(), QtViewImp::draw_Text(), AxisRepColor::drawColorScale(), QtViewImp::drawImage(), AxisRepBase::drawReferencePoint(), QtViewImp::drawText(), AxisRepBase::drawTitle(), LinePointRep::drawValues(), QtView::drawWithPixmap(), AxisRepBase::drawXLabels(), AxisRepBase::drawXMag(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), AxisRepBase::initAxisRect(), Rect::isInBounds(), Rect::makeInBounds(), DataView::marginToInvertedUserX(), DataView::marginToUserX(), QtView::setDrawRect(), PyCanvas::setHeight(), PyCanvas::setWidth(), AxisRepBase::setYFontSize(), OpenGLView::toViewX(), EpsView::toViewX(), OpenGLView::toViewY(), OpenGLView::toX(), EpsView::toX(), QtView::updateDrawRect(), DataView::userToInvertedMarginX(), DataView::userToMarginColor(), and DataView::userToMarginX().

double getY (  )  const [inline]

A shortcut to get origin.Y.

Definition at line 162 of file Rectangle.h.

References Point::getY(), and Rect::m_origin.

Referenced by ViewBaseXML::createElement(), QtViewImp::draw_Text(), AxisRepColor::drawColorScale(), ContourPointRep::drawContourTicks(), QtViewImp::drawImage(), AxisRepBase::drawReferencePoint(), QtViewImp::drawText(), LinePointRep::drawValues(), QtView::drawWithPixmap(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawYLabels(), AxisRepBase::drawYMag(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), AxisRepColor::drawZTickLines(), AxisRepBase::initAxisRect(), Rect::isInBounds(), Rect::makeInBounds(), DataView::marginToInvertedUserY(), DataView::marginToUserY(), PyCanvas::setHeight(), PyCanvas::setWidth(), AxisRepBase::setXFontSize(), AxisRepBase::setZFontSize(), OpenGLView::toViewY(), EpsView::toViewY(), OpenGLView::toY(), EpsView::toY(), QtView::updateDrawRect(), DataView::userToInvertedMarginY(), and DataView::userToMarginY().

double getZ (  )  const

A shortcut to get origin.Z.

Definition at line 98 of file Rectangle.cxx.

References Rect::getOrigin(), and Point::getZ().

Referenced by ColorBoxPointRep::drawProjectedValues(), Rect::isInBounds(), Rect::makeInBounds(), and DataView::userToMarginColor().

bool isInBounds ( double  x1,
double  y1,
double  z1 
) const

Checks the coordinates to see if they are inside or on the boundary of the rectangle.

Definition at line 165 of file Rectangle.cxx.

References Rect::getDepth(), Rect::getHeight(), Rect::getWidth(), Rect::getX(), Rect::getY(), and Rect::getZ().

bool isInBounds ( double  x1,
double  y1 
) const

Checks the coordinates to see if they are inside or on the boundary of the rectangle.

Todo:
Use if ( x!=1 ) to est for nan.

Definition at line 149 of file Rectangle.cxx.

References Rect::getHeight(), Rect::getWidth(), Rect::getX(), and Rect::getY().

Referenced by LinePointRep::addEndPoints(), and LinePointRep::cornerCase().

bool isInDepth ( double  z1  )  const

Checks the value against the depth to see if it is in bounds.

Definition at line 136 of file Rectangle.cxx.

References Size::getDepth(), Point::getZ(), Rect::m_origin, and Rect::m_size.

Referenced by ColorBoxPointRep::drawProjectedValues().

void makeInBounds ( std::vector< double > &  x,
std::vector< double > &  y,
std::vector< double > &  z 
) const

Changes the coordinates so that they are inside or on the boundary of the rectangle.

That is, for each element of the vector x or y or z, leave it unchanged if it is within the rectangle; otherwise, set it to the boundary on which it exceeds.

Definition at line 256 of file Rectangle.cxx.

References Rect::getDepth(), Rect::getHeight(), Rect::getWidth(), Rect::getX(), Rect::getY(), and Rect::getZ().

void makeInBounds ( std::vector< double > &  x,
std::vector< double > &  y 
) const

Changes the coordinates so that they are inside or on the boundary of the rectangle.

That is, for each element of the vector x or y, leave it unchanged if it is within the rectangle; otherwise, set it to the boundary on which it exceeds.

Definition at line 231 of file Rectangle.cxx.

References Rect::getHeight(), Rect::getWidth(), Rect::getX(), and Rect::getY().

void makeInBounds ( double &  x,
double &  y,
double &  z 
) const

Changes the coordinates so that they are inside or on the boundary of the rectangle.

That is, for x or y or z, leave it unchanged if it is within the rectangle; otherwise, set it to the boundary on which it exceeds.

Definition at line 209 of file Rectangle.cxx.

References Size::getDepth(), Size::getHeight(), Size::getWidth(), Point::getX(), Point::getY(), Point::getZ(), Rect::m_origin, and Rect::m_size.

void makeInBounds ( double &  x,
double &  y 
) const

Changes the coordinates so that they are inside or on the boundary of the rectangle.

That is, for x or y, leave it unchanged if it is within the rectangle; otherwise, set it to the boundary on which it exceeds.

Definition at line 185 of file Rectangle.cxx.

References Size::getHeight(), Size::getWidth(), Point::getX(), Point::getY(), Rect::m_origin, and Rect::m_size.

Referenced by ErrorBarRep::drawProjectedValues(), ColumnPointRep::drawProjectedValues(), ColorBoxPointRep::drawProjectedValues(), ContourPointRep::drawValues(), and ContourPointRep::drawValuesWithStyle().

void moveBy ( double  x,
double  y 
)

Moves the Rectangle by specified amount.

The size remains unchanged.

Definition at line 83 of file Rectangle.cxx.

References Rect::m_origin, and Point::moveBy().

void setDepth ( double   ) 

Sets the depth of the rectangle.

Definition at line 124 of file Rectangle.cxx.

References Rect::m_size, and Size::setDepth().

Referenced by CompositePlotter::calcUserRectangle().

void setRect ( double  x,
double  y,
double  z,
double  width,
double  height,
double  depth 
)

Set the parameters of 3D Rectangle.

Definition at line 76 of file Rectangle.cxx.

References Rect::m_origin, Rect::m_size, Point::setPoint(), and Size::setSize().

void setRect ( double  x,
double  y,
double  width,
double  height 
)

Set the parameters of 2D Rectangle.

Definition at line 70 of file Rectangle.cxx.

References Rect::m_origin, Rect::m_size, Point::setPoint(), and Size::setSize().

Referenced by OpenGLView::OpenGLView(), DataView::prepareMarginRect(), Rect::Rect(), EpsView::setDrawRect(), and OpenGLView::setRect().

void setZ ( double   ) 

Sets the Z dimension.

Definition at line 103 of file Rectangle.cxx.

References Rect::m_origin, and Point::setZ().

Referenced by CompositePlotter::calcUserRectangle().


Member Data Documentation

Point m_origin [private]

The origin of the Rectangle.

Definition at line 40 of file Rectangle.h.

Referenced by Rect::getOrigin(), Rect::getX(), Rect::getY(), Rect::isInDepth(), Rect::makeInBounds(), Rect::moveBy(), Rect::setRect(), and Rect::setZ().

Size m_size [private]

The size of the Rectangle.

Definition at line 43 of file Rectangle.h.

Referenced by Rect::getHeight(), Rect::getSize(), Rect::getWidth(), Rect::isInDepth(), Rect::makeInBounds(), Rect::setDepth(), and Rect::setRect().


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen