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

Describes a rectangular area on the Illustrator artboard. More...

#include <hdicoreArtboardRect.h>

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

Public Types

enum  LineIntersectionType { NoIntersectionsFound = 0, FirstIntersectionFound = 1, BothIntersectionsFound = 2 }
 Describes which points were found when checking for intersections between a rect and a line.
 

Public Member Functions

 ArtboardRect ()
 Default ArtboardRect constructor, sets the top-left to (0,0) and the width and height to 0. More...
 
 ArtboardRect (const ArtboardRect &rect_)
 ArtboardRect copy constructor. More...
 
 ArtboardRect (const ArtboardPoint &pt_, const Size &size_)
 Constructor to create an ArtboardRect from an ArtboardPoint object and Size object. More...
 
 ArtboardRect (const ArtboardPoint &tl_, const ArtboardPoint &br_)
 Constructor to create an ArtboardRect object from top-left and bottom-right ArtboardPoint objects. More...
 
virtual ~ArtboardRect ()
 ArtboardRect destructor. More...
 
virtual ArtboardRectoperator= (const ArtboardRect &rhs_)
 Allows one ArtboardRect object to be assigned from another. More...
 
virtual bool operator== (const ArtboardRect &rhs_) const
 Tests whether a given ArtboardRect object is the same as another. More...
 
virtual bool operator!= (const ArtboardRect &rhs_) const
 Tests whether a given ArtboardRect object is not the same as another. More...
 
virtual double left () const
 Gets the position of the left bounding edge of the rectangle along the x-axis. More...
 
virtual double top () const
 Gets the position of the top bounding edge of the rectangle along the y-axis. More...
 
virtual double right () const
 Gets the position of the right bounding edge of the rectangle along the x-axis. More...
 
virtual double bottom () const
 Gets the position of the bottom bounding edge of the rectangle along the y-axis. More...
 
virtual void setLeft (const double left_)
 Sets the position of the left bounding edge of the rectangle along the x-axis. More...
 
virtual void setTop (const double top_)
 Sets the position of the top bounding edge of the rectangle along the y-axis. More...
 
virtual void setRight (const double right_)
 Sets the position of the right bounding edge of the rectangle along the x-axis. More...
 
virtual void setBottom (const double bottom_)
 Sets the position of the bottom bounding edge of the rectangle along the y-axis. More...
 
virtual ArtboardRect 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 ArtboardPoint topLeft () const
 Gets the top-left point of the rect. More...
 
virtual ArtboardPoint topCenter () const
 Gets the top-center point of the rect. More...
 
virtual ArtboardPoint topRight () const
 Gets the top-right point of the rect. More...
 
virtual ArtboardPoint midLeft () const
 Gets the mid-left point of the rect. More...
 
virtual ArtboardPoint midCenter () const
 Gets the mid-center point of the rect. More...
 
virtual ArtboardPoint midRight () const
 Gets the mid-right point of the rect. More...
 
virtual ArtboardPoint bottomLeft () const
 Gets the bottom-left point of the rect. More...
 
virtual ArtboardPoint bottomCenter () const
 Gets the bottom-center point of the rect. More...
 
virtual ArtboardPoint bottomRight () const
 Gets the bottom-right point of the rect. More...
 
virtual ArtboardPoint pointFromPinPoint (const BoundsPinPointType pinPt_) const
 Gets a "pin point" from the rect bounds. 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 equalWithinTol (const ArtboardRect &compare_, const double tol_) const
 Gets whether a given rect is equal to the target rect, within a given tolerance. More...
 
virtual bool containsPoint (const ArtboardPoint &pt_) const
 Gets whether a given point lies inside the target rect. More...
 
virtual bool overlaps (const ArtboardRect &rect2_) const
 Checks whether the target rect overlaps a given rect. More...
 
virtual bool enclosePoint (const ArtboardPoint &pt_)
 Enlarges the target rect, if necessary, to enclose a given point. More...
 
virtual ArtboardRect unionRects (const ArtboardRect &rect2_) const
 Unions two rects, forming a rect that has bounds sufficient to enclose both initial rects. More...
 
virtual ArtboardRect scale (const double xScaler_, const double yScaler_) const
 Scales the width and height of a rect by given amounts on the x- and y- axes. More...
 
virtual bool intersection (const ArtboardRect &rect2_, ArtboardRect &iRect__) const
 Gets the intersection between two rects. More...
 
virtual void enclosingEllipse (double &width__, double &height__) const
 Gets the width and height of an ellipse that would enclose the rect. More...
 
virtual LineIntersectionType lineIntersectionPoints (const ArtboardPoint &a_, const ArtboardPoint &b_, ArtboardPoint &iPt1__, ArtboardPoint &iPt2__) const
 Finds the intersection points on a rectangle that a line has with it. More...
 
virtual LineIntersectionType lineIntersectionPoints (const ArtboardPoint &a_, const ArtboardPoint &b_, const Angle &angle_, ArtboardPoint &iPt1__, ArtboardPoint &iPt2__) const
 Finds the intersection points on a rectangle, were it rotated, that a line has with it. More...
 

Static Public Member Functions

static ArtboardRect XYWidthHeight (const double x_, const double y_, const double width_, const double height_)
 "Named constructor" to create an ArtboardRect from an (x,y) top-left point and a width and height More...
 
static ArtboardRect LeftTopRightBottom (const double left_, const double top_, const double right_, const double bottom_)
 "Named constructor" to create an ArtboardRect from the values of its bounding edges More...
 

Public Attributes

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

Friends

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

Detailed Description

Describes a rectangular area on the Illustrator artboard.

Constructor & Destructor Documentation

hdi::core::ArtboardRect::ArtboardRect ( )

Default ArtboardRect constructor, sets the top-left to (0,0) and the width and height to 0.

Author
GW
Date
08/2013
hdi::core::ArtboardRect::ArtboardRect ( const ArtboardRect rect_)

ArtboardRect copy constructor.

Author
GW
Date
08/2013
Parameters
rect_ArtboardRect object to copy values from
hdi::core::ArtboardRect::ArtboardRect ( const ArtboardPoint pt_,
const Size size_ 
)

Constructor to create an ArtboardRect from an ArtboardPoint object and Size object.

Author
GW
Date
08/2013
Parameters
pt_Top-left point of the rectangle
size_Size (width and height of the rectangle)
hdi::core::ArtboardRect::ArtboardRect ( const ArtboardPoint tl_,
const ArtboardPoint br_ 
)

Constructor to create an ArtboardRect object from top-left and bottom-right ArtboardPoint objects.

Author
GW
Date
08/2013
Parameters
tl_Top-left point of the rectangle
br_Bottom-right point of the rectangle
virtual hdi::core::ArtboardRect::~ArtboardRect ( )
virtual

ArtboardRect destructor.

Author
GW
Date
08/2013

Member Function Documentation

virtual double hdi::core::ArtboardRect::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 double hdi::core::ArtboardRect::bottom ( ) const
virtual

Gets the position of the bottom bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Returns
The position of the bottom side of the rectangle
virtual ArtboardPoint hdi::core::ArtboardRect::bottomCenter ( ) const
virtual

Gets the bottom-center point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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 ArtboardPoint hdi::core::ArtboardRect::bottomLeft ( ) const
virtual

Gets the bottom-left point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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 ArtboardPoint hdi::core::ArtboardRect::bottomRight ( ) const
virtual

Gets the bottom-right point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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::ArtboardRect::containsPoint ( const ArtboardPoint 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 bool hdi::core::ArtboardRect::enclosePoint ( const ArtboardPoint pt_)
virtual

Enlarges the target rect, if necessary, to enclose a given point.

Author
GW
Date
08/2013
Parameters
pt_Point the rect should enclose
Returns
true if the rect was enlarged, false otherwise
virtual void hdi::core::ArtboardRect::enclosingEllipse ( double &  width__,
double &  height__ 
) const
virtual

Gets the width and height of an ellipse that would enclose the rect.

Author
GW
Date
08/2013
Parameters
width__Return-by-reference for the ellipse width
height__Return-by-reference for the ellipse height
Note
The ellipse will have the same proportions as the rect
virtual bool hdi::core::ArtboardRect::equalWithinTol ( const ArtboardRect compare_,
const double  tol_ 
) const
virtual

Gets whether a given rect is equal to the target rect, within a given tolerance.

Author
GW
Date
08/2013
Parameters
compare_Rect to compare to the target
tol_Tolerance about the sides of the rect
Returns
true if the rects are equal within tol_, false otherwise
virtual ArtboardRect hdi::core::ArtboardRect::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 ArtboardRect, with its coordinates adjusted for the inset
Note
A positive value causes an inset, while a negative value causes an "outset" (expansion)
virtual bool hdi::core::ArtboardRect::intersection ( const ArtboardRect rect2_,
ArtboardRect iRect__ 
) const
virtual

Gets the intersection between two rects.

Author
GW
Date
08/2013
Parameters
rect2_Second rect to test for an intersection with the target rect
iRect__Return-by-reference for the intersection rect
Returns
true if an intersection exists, false otherwise
Note
iRect__ will be the rect that describes the intersecting area between rect2_ and the target rect.
virtual double hdi::core::ArtboardRect::left ( ) const
virtual

Gets the position of the left bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Returns
The position of the left side of the rectangle
static ArtboardRect hdi::core::ArtboardRect::LeftTopRightBottom ( const double  left_,
const double  top_,
const double  right_,
const double  bottom_ 
)
static

"Named constructor" to create an ArtboardRect from the values of its bounding edges

Author
GW
Date
08/2013
Parameters
left_Position of the left of the rect along the x-axis
top_Position of the top of the rect along the y-axis
right_Position of the right of the rect along the x-axis
bottom_Position of the bottom of the rect along the y-axis
virtual LineIntersectionType hdi::core::ArtboardRect::lineIntersectionPoints ( const ArtboardPoint a_,
const ArtboardPoint b_,
ArtboardPoint iPt1__,
ArtboardPoint iPt2__ 
) const
virtual

Finds the intersection points on a rectangle that a line has with it.

Author
GW
Date
08/2013
Parameters
a_Start point for the line
b_End point for the line
iPt1__Return-by-reference for the first intersection point found
iPt2__Return-by-reference for the second intersection point found
Returns
An enum describing which intersection points were found, if any
Note
For reference, this function always checks clockwise from the left of the rectangle.
virtual LineIntersectionType hdi::core::ArtboardRect::lineIntersectionPoints ( const ArtboardPoint a_,
const ArtboardPoint b_,
const Angle angle_,
ArtboardPoint iPt1__,
ArtboardPoint iPt2__ 
) const
virtual

Finds the intersection points on a rectangle, were it rotated, that a line has with it.

Author
GW
Date
08/2013
Parameters
a_Start point for the line
b_End point for the line
angle_Amount the rectangle is rotated
iPt1__Return-by-reference for the first intersection point found
iPt2__Return-by-reference for the second intersection point found
Returns
An enum describing which intersection points were found, if any
Note
For reference, this function always checks clockwise from the left of the rectangle.
virtual ArtboardPoint hdi::core::ArtboardRect::midCenter ( ) const
virtual

Gets the mid-center point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint object describing the mid-center of the rect
virtual ArtboardPoint hdi::core::ArtboardRect::midLeft ( ) const
virtual

Gets the mid-left point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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 ArtboardPoint hdi::core::ArtboardRect::midRight ( ) const
virtual

Gets the mid-right point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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 bool hdi::core::ArtboardRect::operator!= ( const ArtboardRect rhs_) const
virtual

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

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

Allows one ArtboardRect object to be assigned from another.

Author
GW
Date
08/2013
Parameters
rhs_Righthand side of the = operator; the object to copy values from
Returns
The target ArtboardRect object, but with its value updated to match that of rhs_
virtual bool hdi::core::ArtboardRect::operator== ( const ArtboardRect rhs_) const
virtual

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

Author
GW
Date
08/2013
Parameters
rhs_ArtboardRect 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::ArtboardRect::overlaps ( const ArtboardRect 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::ArtboardRect::perimeter ( ) const
virtual

Gets the perimeter of the rect.

Author
GW
Date
08/2013
Returns
The perimeter of the rect
virtual ArtboardPoint hdi::core::ArtboardRect::pointFromPinPoint ( const BoundsPinPointType  pinPt_) const
virtual

Gets a "pin point" from the rect bounds.

Author
GW
Date
08/2013
Parameters
pinPt_Pin point which will be turned into an absolute point from the rect
Returns
An ArtboardPoint object for the given pin point
virtual double hdi::core::ArtboardRect::right ( ) const
virtual

Gets the position of the right bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Returns
The position of the right side of the rectangle
virtual ArtboardRect hdi::core::ArtboardRect::scale ( const double  xScaler_,
const double  yScaler_ 
) const
virtual

Scales the width and height of a rect by given amounts on the x- and y- axes.

Author
GW
Date
08/2013
Parameters
xScaler_Multiplier for scaling horizontally (e.g. 0.75 is 75% of the current size)
yScaler_Multiplier for scaling vertically (e.g. 0.75 is 75% of the current size)
Returns
A copy of the target ArtboardRect that is scaled as specified
virtual void hdi::core::ArtboardRect::setBottom ( const double  bottom_)
virtual

Sets the position of the bottom bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Parameters
bottom_New bottom edge of the rect
Note
The top edge will be unaffected
virtual void hdi::core::ArtboardRect::setLeft ( const double  left_)
virtual

Sets the position of the left bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Parameters
left_New left edge of the rect
Note
The right edge will be unaffected (e.g. the width will automatically be adjusted such that the right bounding edge stays at the same position)
virtual void hdi::core::ArtboardRect::setRight ( const double  right_)
virtual

Sets the position of the right bounding edge of the rectangle along the x-axis.

Author
GW
Date
08/2013
Parameters
right_New right edge of the rect
Note
The left edge will be unaffected
virtual void hdi::core::ArtboardRect::setTop ( const double  top_)
virtual

Sets the position of the top bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Parameters
top_New top edge of the rect
Note
The bottom edge will be unaffected (e.g. the height will automatically be adjusted such that the bottom bounding edge stays at the same position)
virtual double hdi::core::ArtboardRect::top ( ) const
virtual

Gets the position of the top bounding edge of the rectangle along the y-axis.

Author
GW
Date
08/2013
Returns
The position of the top side of the rectangle
virtual ArtboardPoint hdi::core::ArtboardRect::topCenter ( ) const
virtual

Gets the top-center point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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 ArtboardPoint hdi::core::ArtboardRect::topLeft ( ) const
virtual

Gets the top-left point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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 ArtboardPoint hdi::core::ArtboardRect::topRight ( ) const
virtual

Gets the top-right point of the rect.

Author
GW
Date
08/2013
Returns
An ArtboardPoint 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
virtual ArtboardRect hdi::core::ArtboardRect::unionRects ( const ArtboardRect rect2_) const
virtual

Unions two rects, forming a rect that has bounds sufficient to enclose both initial rects.

Author
GW
Date
08/2013
Parameters
rect2_Second rect to consider in the union
Returns
A new ArtboardRect large enough to enclose both the target rect and rect2_
static ArtboardRect hdi::core::ArtboardRect::XYWidthHeight ( const double  x_,
const double  y_,
const double  width_,
const double  height_ 
)
static

"Named constructor" to create an ArtboardRect from an (x,y) top-left point 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