Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
Public Member Functions | Public Attributes | Friends | List of all members
hdi::core::Rect Class Reference

Contains Point and Size objects to describe a rectangle that exists at a specific point of given dimensions. More...

#include <hdicoreRect.h>

Collaboration diagram for hdi::core::Rect:
Collaboration graph
[legend]

Public Member Functions

 Rect ()
 Default Rect constructor; calls the default constructors for the origin and size. More...
 
 Rect (const double x_, const double y_, const double width_, const double height_)
 Constructs a Rect from an (x,y) point for the top-left and a width and height. More...
 
 Rect (const Point &pt_, const Size &size_)
 Rect constructor, taking Point and Size arguments. More...
 
 Rect (const Rect &rect_)
 Rect copy constructor. More...
 
virtual ~Rect ()
 Rect destructor. More...
 
virtual Rectoperator= (const Rect &rhs_)
 Sets a Rect object from another Rect object. More...
 
virtual bool operator== (const Rect &rhs_) const
 Tests whether a given Rect object is the same as another. More...
 
virtual bool operator!= (const Rect &rhs_) const
 Tests whether a given Rect object is not the same as another. More...
 
virtual Rect operator+ (const Rect &rhs_) const
 Allows two rects to have their origin and size objects added using the + operator. More...
 
virtual Rectoperator+= (const Rect &rhs_)
 Allows two rects to have their origin and size objects added and assigned using the += operator. More...
 
virtual Rect operator- (const Rect &rhs_) const
 Allows two rects to have their origin and size objects subtracted using the - operator. More...
 
virtual Rectoperator-= (const Rect &rhs_)
 Allows two rects to have their origin and size objects subtracted and assigned using the -= operator. More...
 
virtual void offset (const double tx_, const double ty_)
 Offsets a rect along the x- and y-axes by given amounts. More...
 
virtual void resize (const double w_, const double h_)
 Resizes a rect to a given width and height. More...
 
virtual Rect inset (const double x_, const double y_) const
 Insets a rect by given amounts on the x- and y-axes (or expands if negative) More...
 
virtual Point topLeft () const
 Gets the top-left point of the rect. More...
 
virtual Point topCenter () const
 Gets the top-center point of the rect. More...
 
virtual Point topRight () const
 Gets the top-right point of the rect. More...
 
virtual Point midLeft () const
 Gets the mid-left point of the rect. More...
 
virtual Point midCenter () const
 Gets the mid-center point of the rect. More...
 
virtual Point midRight () const
 Gets the mid-right point of the rect. More...
 
virtual Point bottomLeft () const
 Gets the bottom-left point of the rect. More...
 
virtual Point bottomCenter () const
 Gets the bottom-center point of the rect. More...
 
virtual Point bottomRight () const
 Gets the bottom-right point of the rect. More...
 
virtual double area () const
 Gets the area of the rect. More...
 
virtual double perimeter () const
 Gets the perimeter of the rect. More...
 
virtual bool containsPoint (const Point &pt_) const
 Gets whether a given point lies inside the target rect. More...
 
virtual bool overlaps (const Rect &rect2_) const
 Checks whether the target rect overlaps a given rect. More...
 

Public Attributes

Point origin
 Origin point for the rect (top-left, when size.width and size.height are positive)
 
Size size
 Dimensions of the rect.
 

Friends

plugin::Rect * __accessImpl (const Rect &)
 
Rect __accessCtor (const plugin::Rect &)
 

Detailed Description

Contains Point and Size objects to describe a rectangle that exists at a specific point of given dimensions.

Constructor & Destructor Documentation

hdi::core::Rect::Rect ( )

Default Rect constructor; calls the default constructors for the origin and size.

Author
GW
Date
08/2013
hdi::core::Rect::Rect ( const double  x_,
const double  y_,
const double  width_,
const double  height_ 
)

Constructs a Rect from an (x,y) point for the top-left and a width and height.

Author
GW
Date
08/2013
Parameters
x_Position of the left of the rect along the x-axis
y_Position of the top of the rect along the y-axis
width_Width of the rect
height_Height of the rect
hdi::core::Rect::Rect ( const Point pt_,
const Size size_ 
)

Rect constructor, taking Point and Size arguments.

Author
GW
Date
08/2013
Parameters
pt_(x,y) point of the rect (top-left)
size_Dimensions of the rect
hdi::core::Rect::Rect ( const Rect rect_)

Rect copy constructor.

Author
GW
Date
08/2013
Parameters
rect_Existing Rect to copy
virtual hdi::core::Rect::~Rect ( )
virtual

Rect destructor.

Author
GW
Date
08/2013

Member Function Documentation

virtual double hdi::core::Rect::area ( ) const
virtual

Gets the area of the rect.

Author
GW
Date
08/2013
Returns
The area of the rect
Note
The value returned will always be positive
virtual Point hdi::core::Rect::bottomCenter ( ) const
virtual

Gets the bottom-center point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the bottom-center of the rect
Note
The point returned may not be the geometric bottom-center of the rect in the case of a negative width and/or height
virtual Point hdi::core::Rect::bottomLeft ( ) const
virtual

Gets the bottom-left point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the bottom-left of the rect
Note
The point returned may not be the geometric bottom-left of the rect in the case of a negative width and/or height
virtual Point hdi::core::Rect::bottomRight ( ) const
virtual

Gets the bottom-right point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the bottom-right of the rect
Note
The point returned may not be the geometric bottom-right of the rect in the case of a negative width and/or height
virtual bool hdi::core::Rect::containsPoint ( const Point pt_) const
virtual

Gets whether a given point lies inside the target rect.

Author
GW
Date
08/2013
Parameters
pt_Point to test
Returns
true if the point is within the bounds of the rect, false otherwise
virtual Rect hdi::core::Rect::inset ( const double  x_,
const double  y_ 
) const
virtual

Insets a rect by given amounts on the x- and y-axes (or expands if negative)

Author
GW
Date
08/2013
Parameters
x_Amount to inset the rect on the left and right sides
y_Amount to inset the rect on the top and bottom sides
Returns
A copy of the target Rect, with its origin and size updated to reflect the provided inset
Note
Positive values cause an inset, while negative values cause an "outset" (expansion)
virtual Point hdi::core::Rect::midCenter ( ) const
virtual

Gets the mid-center point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the mid-center of the rect
virtual Point hdi::core::Rect::midLeft ( ) const
virtual

Gets the mid-left point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the mid-left of the rect
Note
The point returned may not be the geometric mid-left of the rect in the case of a negative width and/or height
virtual Point hdi::core::Rect::midRight ( ) const
virtual

Gets the mid-right point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the mid-right of the rect
Note
The point returned may not be the geometric mid-right of the rect in the case of a negative width and/or height
virtual void hdi::core::Rect::offset ( const double  tx_,
const double  ty_ 
)
virtual

Offsets a rect along the x- and y-axes by given amounts.

This is a convenience method to adjust both the x and y values in one call

Author
GW
Date
08/2013
Parameters
tx_Amount to offset along the x-axis
ty_Amount to offset along the y-axis
Note
Negative values go toward 0.0 if the object to be transformed has a positive x and/or y value; positive values go away from 0.0
virtual bool hdi::core::Rect::operator!= ( const Rect rhs_) const
virtual

Tests whether a given Rect object is not the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Rect to compare against (righthand side of inequality operator)
Returns
true for the target and rhs_ being different rects, false otherwise
virtual Rect hdi::core::Rect::operator+ ( const Rect rhs_) const
virtual

Allows two rects to have their origin and size objects added using the + operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the + operator
Returns
A copy of the target ArtboardPoint, with all x and y values summed together
virtual Rect& hdi::core::Rect::operator+= ( const Rect rhs_)
virtual

Allows two rects to have their origin and size objects added and assigned using the += operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the += operator
Returns
The lefthand side of the += operator, with all origin and size objects summed together
virtual Rect hdi::core::Rect::operator- ( const Rect rhs_) const
virtual

Allows two rects to have their origin and size objects subtracted using the - operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the - operator
Returns
A copy of the target ArtboardPoint, with rhs_ origin and size objects subtracted from this origin and size objects
virtual Rect& hdi::core::Rect::operator-= ( const Rect rhs_)
virtual

Allows two rects to have their origin and size objects subtracted and assigned using the -= operator.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the -= operator
Returns
The lefthand side of the -= operator, with rhs_ origin and size objects subtracted from this origin and size objects
virtual Rect& hdi::core::Rect::operator= ( const Rect rhs_)
virtual

Sets a Rect object from another Rect object.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the = operator; Rect object to pull values from
Returns
The target ArtboardRect (lefthand side of the = operator) with its values updated
virtual bool hdi::core::Rect::operator== ( const Rect rhs_) const
virtual

Tests whether a given Rect object is the same as another.

Author
GW
Date
08/2013
Parameters
rhs_Rect to compare against (righthand side of equality operator)
Returns
true for the target and rhs_ being the same rect, false otherwise
virtual bool hdi::core::Rect::overlaps ( const Rect rect2_) const
virtual

Checks whether the target rect overlaps a given rect.

Author
GW
Date
08/2013
Parameters
rect2_Rect to compare against for overlapping boundaries
Returns
true if the target rect and the provided rect overlap
virtual double hdi::core::Rect::perimeter ( ) const
virtual

Gets the perimeter of the rect.

Author
GW
Date
08/2013
Returns
The perimeter of the rect
virtual void hdi::core::Rect::resize ( const double  w_,
const double  h_ 
)
virtual

Resizes a rect to a given width and height.

This is a convenience method to set both width and height in one call

Author
GW
Date
08/2013
Parameters
w_New rect width
h_New rect height
virtual Point hdi::core::Rect::topCenter ( ) const
virtual

Gets the top-center point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the top-center of the rect
Note
The point returned may not be the geometric top-center of the rect in the case of a negative width and/or height
virtual Point hdi::core::Rect::topLeft ( ) const
virtual

Gets the top-left point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the top-left of the rect
Note
The point returned may not be the geometric top-left of the rect in the case of a negative width and/or height
virtual Point hdi::core::Rect::topRight ( ) const
virtual

Gets the top-right point of the rect.

Author
GW
Date
08/2013
Returns
A Point object describing the top-right of the rect
Note
The point returned may not be the geometric top-right of the rect in the case of a negative width and/or height