Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

HippoRectangle Class Reference

#include <Rectangle.h>

Collaboration diagram for HippoRectangle:

Collaboration graph
[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 optiomized by directly accessing member functions of data members rather than using the public interface. Also the inline functions had a high profile when plotting large images.
Requests:
Should put in namespace to avoid conflict with Rectangle under Windows.
Must test under Windows since Rectangle might be a macro.

Definition at line 29 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.
 HippoRectangle (double x, double y, double z, double width, double height, double depth)
 constructor for 3D Rectangle.
 HippoRectangle (double x, double y, double width, double height)
 Constructor for 2D Rectangle.
 HippoRectangle ()
 Default constructor.
bool isInBounds (double x1, double y1, double z1) const
 Checks the coordinates to see if they are inside or on the boundary of the HippoRectangle.
bool isInBounds (double x1, double y1) const
 Checks the coordinates to see if they are inside or on the boundary of the HippoRectangle.
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 HippoRectangle.
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 HippoRectangle.
void makeInBounds (double &x, double &y, double &z) const
 Changes the coordinates so that they are inside or on the boundary of the HippoRectangle.
void makeInBounds (double &x, double &y) const
 Changes the coordinates so that they are inside or on the boundary of the HippoRectangle.
void moveBy (double x, double y)
 Moves the Rectange by specified amount.
void setDepth (double)
 Sets the depth of the HippoRectangle.
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.

Friends

std::ostream & operator<< (std::ostream &, const HippoRectangle &)


Constructor & Destructor Documentation

HippoRectangle::HippoRectangle  ) 
 

Default constructor.

Definition at line 49 of file Rectangle.cxx.

HippoRectangle::HippoRectangle double  x,
double  y,
double  width,
double  height
 

Constructor for 2D Rectangle.

Definition at line 55 of file Rectangle.cxx.

References setRect().

HippoRectangle::HippoRectangle double  x,
double  y,
double  z,
double  width,
double  height,
double  depth
 

constructor for 3D Rectangle.

Definition at line 61 of file Rectangle.cxx.

References setRect().


Member Function Documentation

double HippoRectangle::getDepth  )  const
 

A shortcut to get size.depth.

Definition at line 116 of file Rectangle.cxx.

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

Referenced by XyPlotter::calcAxisRatios(), isInBounds(), makeInBounds(), and operator<<().

double HippoRectangle::getHeight  )  const
 

A shortcut to get size.height.

Definition at line 111 of file Rectangle.cxx.

References Size::getHeight(), and m_size.

Referenced by XyPlotter::calcAxisRatios(), ViewBaseXML::createElement(), DrawBorder::draw(), QtViewImp::draw_Text(), AxisRepColor::drawColorScale(), ContourPointRep::drawContourTicks(), LinePointRep::drawProjectedValues(), AxisRepBase::drawTitle(), QtView::drawWithPixmap(), AxisRepBase::drawXLabels(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawXTickLines(), AxisRepBase::drawYLabels(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), AxisRepColor::drawZTickLines(), AxisRepBase::initAxisRect(), QtView::initPlot(), isInBounds(), makeInBounds(), XyPlotter::marginToInvertedUserY(), operator<<(), XyPlotter::prepareMarginRect(), AxisRepBase::setXFontSize(), AxisRepBase::setZFontSize(), OpenGLView::toViewY(), EpsView::toViewY(), OpenGLView::toY(), EpsView::toY(), XyPlotter::userToInvertedMarginY(), and YPADDING().

const Point & HippoRectangle::getOrigin  )  const [private]
 

Returns the origin.

Definition at line 86 of file Rectangle.cxx.

References m_origin.

Referenced by getZ().

const Size & HippoRectangle::getSize  )  const [private]
 

Returns the size.

Definition at line 91 of file Rectangle.cxx.

References m_size.

Referenced by getDepth().

double HippoRectangle::getWidth  )  const
 

A shortcut to get size.width.

Definition at line 106 of file Rectangle.cxx.

References Size::getWidth(), and m_size.

Referenced by XyPlotter::calcAxisRatios(), ViewBaseXML::createElement(), DrawBorder::draw(), QtViewImp::draw_Text(), AxisRepColor::drawColorScale(), LinePointRep::drawProjectedValues(), AxisRepBase::drawTitle(), QtView::drawWithPixmap(), AxisRepBase::drawXLabels(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawYLabels(), AxisRepBase::drawYTickLines(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), AxisRepBase::initAxisRect(), QtView::initPlot(), isInBounds(), makeInBounds(), operator<<(), XyPlotter::prepareMarginRect(), AxisRepBase::setFontSize(), AxisRepBase::setYFontSize(), OpenGLView::toViewY(), XPADDING(), and ZPADDING().

double HippoRectangle::getX  )  const [inline]
 

A shortcut to get origin.X.

Definition at line 139 of file Rectangle.h.

References Point::getX(), and m_origin.

Referenced by ViewBaseXML::createElement(), QtViewImp::draw_Text(), AxisRepColor::drawColorScale(), EpsView::drawMag(), LinePointRep::drawProjectedValues(), QtViewImp::drawText(), AxisRepBase::drawTitle(), QtViewImp::drawUserText(), QtView::drawWithPixmap(), AxisRepBase::drawXLabels(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawYMag(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), AxisRepBase::initAxisRect(), isInBounds(), makeInBounds(), XyPlotter::marginToUserX(), operator<<(), AxisRepBase::setYFontSize(), OpenGLView::toViewX(), EpsView::toViewX(), OpenGLView::toViewY(), OpenGLView::toX(), EpsView::toX(), XyPlotter::userToMarginColor(), and XyPlotter::userToMarginX().

double HippoRectangle::getY  )  const [inline]
 

A shortcut to get origin.Y.

Definition at line 147 of file Rectangle.h.

References Point::getY(), and m_origin.

Referenced by ViewBaseXML::createElement(), QtViewImp::draw_Text(), AxisRepColor::drawColorScale(), ContourPointRep::drawContourTicks(), EpsView::drawMag(), LinePointRep::drawProjectedValues(), QtViewImp::drawText(), QtViewImp::drawUserText(), QtView::drawWithPixmap(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawYLabels(), AxisRepBase::drawYMag(), AxisRepColor::drawZTickLabels(), AxisRepColor::drawZTickLines(), AxisRepBase::initAxisRect(), isInBounds(), makeInBounds(), XyPlotter::marginToInvertedUserY(), XyPlotter::marginToUserY(), operator<<(), AxisRepBase::setXFontSize(), AxisRepBase::setZFontSize(), OpenGLView::toViewY(), EpsView::toViewY(), OpenGLView::toY(), EpsView::toY(), XyPlotter::userToInvertedMarginY(), and XyPlotter::userToMarginY().

double HippoRectangle::getZ  )  const
 

A shortcut to get origin.Z.

Definition at line 96 of file Rectangle.cxx.

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

Referenced by ColorBoxPointRep::drawProjectedValues(), isInBounds(), makeInBounds(), operator<<(), and XyPlotter::userToMarginColor().

bool HippoRectangle::isInBounds double  x1,
double  y1,
double  z1
const
 

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

Definition at line 160 of file Rectangle.cxx.

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

bool HippoRectangle::isInBounds double  x1,
double  y1
const
 

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

Definition at line 144 of file Rectangle.cxx.

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

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

bool HippoRectangle::isInDepth double  z1  )  const
 

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

Todo:
The multicative factor the implementation might be considered a kludge.
Might there be a better way.

Todo:
The final solution for the comparison works when the depth is a very small number compared the the values.
Is there a better numeric way.

Definition at line 133 of file Rectangle.cxx.

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

Referenced by ColorBoxPointRep::drawProjectedValues().

void HippoRectangle::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 HippoRectangle.

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

Definition at line 251 of file Rectangle.cxx.

References std::bind2nd(), getDepth(), getHeight(), getWidth(), getX(), getY(), getZ(), and std::replace_if().

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

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

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

Definition at line 226 of file Rectangle.cxx.

References std::bind2nd(), getHeight(), getWidth(), getX(), getY(), and std::replace_if().

void HippoRectangle::makeInBounds double &  x,
double &  y,
double &  z
const
 

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

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

Definition at line 204 of file Rectangle.cxx.

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

void HippoRectangle::makeInBounds double &  x,
double &  y
const
 

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

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

Definition at line 180 of file Rectangle.cxx.

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

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

void HippoRectangle::moveBy double  x,
double  y
 

Moves the Rectange by specified amount.

The size remains unchanged.

Definition at line 81 of file Rectangle.cxx.

References m_origin, and Point::moveBy().

void HippoRectangle::setDepth double   ) 
 

Sets the depth of the HippoRectangle.

Definition at line 121 of file Rectangle.cxx.

References m_size, and Size::setDepth().

Referenced by CompositePlotter::calcUserRectangle().

void HippoRectangle::setRect double  x,
double  y,
double  z,
double  width,
double  height,
double  depth
 

Set the parameters of 3D Rectangle.

Definition at line 74 of file Rectangle.cxx.

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

void HippoRectangle::setRect double  x,
double  y,
double  width,
double  height
 

Set the parameters of 2D Rectangle.

Definition at line 68 of file Rectangle.cxx.

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

Referenced by HippoRectangle(), OpenGLView::OpenGLView(), XyPlotter::prepareMarginRect(), EpsView::setDrawRect(), and OpenGLView::setRect().

void HippoRectangle::setZ double   ) 
 

Sets the Z dimension.

Definition at line 101 of file Rectangle.cxx.

References m_origin, and Point::setZ().

Referenced by CompositePlotter::calcUserRectangle().


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  o,
const HippoRectangle rect
[friend]
 

Definition at line 284 of file Rectangle.cxx.


Member Data Documentation

Point HippoRectangle::m_origin [private]
 

The origin of the Rectangle.

Definition at line 35 of file Rectangle.h.

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

Size HippoRectangle::m_size [private]
 

The size of the Rectangle.

Definition at line 38 of file Rectangle.h.

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


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3