Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
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 Member Functions

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

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
 
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
 

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

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

Detailed Description

Describes a rectangular area on the Illustrator artboard.

Constructor & Destructor Documentation

◆ ArtboardRect() [1/4]

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

◆ ArtboardRect() [2/4]

hdi::core::ArtboardRect::ArtboardRect ( const ArtboardRect rect_)

ArtboardRect copy constructor.

Author
GW
Date
08/2013
Parameters
rect_ArtboardRect object to copy values from

◆ ArtboardRect() [3/4]

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)

◆ ArtboardRect() [4/4]

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

◆ ~ArtboardRect()

virtual hdi::core::ArtboardRect::~ArtboardRect ( )
virtual

ArtboardRect destructor.

Author
GW
Date
08/2013

Member Function Documentation

◆ area()

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

◆ bottom()

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

◆ bottomCenter()

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

◆ bottomLeft()

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

◆ bottomRight()

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

◆ containsPoint()

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

◆ enclosePoint()

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

◆ enclosingEllipse()

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

◆ equalWithinTol()

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

◆ inset()

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)

◆ intersection()

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.

◆ left()

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

◆ LeftTopRightBottom()

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

◆ lineIntersectionPoints() [1/2]

virtual RectLineIntersectionType 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.

◆ lineIntersectionPoints() [2/2]

virtual RectLineIntersectionType 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.

◆ midCenter()

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

◆ midLeft()

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

◆ midRight()

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

◆ operator!=()

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

◆ operator=()

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_

◆ operator==()

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

◆ overlaps()

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

◆ perimeter()

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

◆ pointFromPinPoint()

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

◆ right()

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

◆ scale()

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

◆ setBottom()

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

◆ setLeft()

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)

◆ setRight()

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

◆ setTop()

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)

◆ top()

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

◆ topCenter()

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

◆ topLeft()

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

◆ topRight()

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

◆ unionRects()

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_

◆ XYWidthHeight()

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