Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreRect.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_RECT__
8#define __HDI_CORE_RECT__
9
10#include "hdicorePoint.h"
11#include "hdicoreSize.h"
12
13namespace hdi
14{
15 #if defined(HDI_CORE_AIP_MODE)
16 namespace aip
17 {
18 class Rect;
19 }
20 #elif defined(HDI_CORE_PSP_MODE)
21 namespace psp
22 {
23 class Rect;
24 }
25 #endif
26
27 namespace core
28 {
33 class Rect
34 {
35 public:
40
45
52
63 Rect(const double x_, const double y_, const double width_, const double height_);
64
73 Rect(const Point& pt_, const Size& size_);
74
82 Rect(const Rect& rect_);
83
89 virtual ~Rect();
90
99 virtual Rect& operator=(const Rect& rhs_);
100
109 virtual bool operator==(const Rect& rhs_) const;
110
119 virtual bool operator!=(const Rect& rhs_) const;
120
129 virtual Rect operator+(const Rect& rhs_) const;
130
139 virtual Rect& operator+=(const Rect& rhs_);
140
150 virtual Rect operator-(const Rect& rhs_) const;
151
161 virtual Rect& operator-=(const Rect& rhs_);
162
175 virtual void offset(const double tx_, const double ty_);
176
186 virtual void resize(const double w_, const double h_);
187
199 virtual Rect inset(const double x_, const double y_) const;
200
211 virtual Point topLeft() const;
212
223 virtual Point topCenter() const;
224
235 virtual Point topRight() const;
236
247 virtual Point midLeft() const;
248
256 virtual Point midCenter() const;
257
268 virtual Point midRight() const;
269
280 virtual Point bottomLeft() const;
281
292 virtual Point bottomCenter() const;
293
304 virtual Point bottomRight() const;
305
314 virtual Point pointFromPinPoint(const BoundsPinPointType pinPt_) const;
315
323 virtual double left() const;
324
332 virtual double top() const;
333
341 virtual double right() const;
342
350 virtual double bottom() const;
351
362 virtual void setLeft(const double left_);
363
374 virtual void setTop(const double top_);
375
385 virtual void setRight(const double right_);
386
396 virtual void setBottom(const double bottom_);
397
407 virtual double area() const;
408
416 virtual double perimeter() const;
417
426 virtual bool containsPoint(const Point& pt_) const;
427
436 virtual bool overlaps(const Rect& rect2_) const;
437
446 virtual bool enclosePoint(const Point& pt_);
447
456 virtual Rect unionRects(const Rect& rect2_) const;
457
467 virtual Rect scale(const double xScaler_, const double yScaler_) const;
468
481 virtual bool intersection(const Rect& rect2_, Rect& iRect__) const;
482
493 virtual void enclosingEllipse(double& width__, double& height__) const;
494
509 const Point& a_,
510 const Point& b_,
511 Point& iPt1__,
512 Point& iPt2__
513 ) const;
514
530 const Point& a_,
531 const Point& b_,
532 const Angle& angle_,
533 Point& iPt1__,
534 Point& iPt2__
535 ) const;
536
537
538 private:
539 #if defined(HDI_CORE_AIP_MODE)
540 friend aip::Rect* __accessImpl(const Rect&);
541 friend Rect __accessCtor(const aip::Rect&);
542
546 aip::Rect* __impl;
547
553 Rect(const aip::Rect&);
554 #elif defined(HDI_CORE_PSP_MODE)
555 friend psp::Rect* __accessImpl(const Rect&);
556 friend Rect __accessCtor(const psp::Rect&);
557
561 psp::Rect* __impl;
562
568 Rect(const psp::Rect&);
569 #endif
570 };
571
572 typedef std::unique_ptr<Rect> RectUP;
573 typedef std::shared_ptr<Rect> RectSP;
574 typedef std::weak_ptr<Rect> RectWP;
575
576 #if defined(HDI_CORE_AIP_MODE)
577 extern aip::Rect* __accessImpl(const Rect&);
578 extern Rect __accessCtor(const aip::Rect&);
579 #elif defined(HDI_CORE_PSP_MODE)
580 extern psp::Rect* __accessImpl(const Rect&);
581 extern Rect __accessCtor(const psp::Rect&);
582 #endif
583 }
584}
585
586#endif
587// __HDI_CORE_RECT__
Describes an angle, and allows for easy conversion between various units.
Definition: hdicoreAngle.h:26
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:38
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:34
virtual void setBottom(const double bottom_)
Sets the position of the bottom bounding edge of the rectangle along the y-axis.
virtual void offset(const double tx_, const double ty_)
Offsets a rect along the x- and y-axes by given amounts.
virtual Point pointFromPinPoint(const BoundsPinPointType pinPt_) const
Gets a "pin point" from the rect bounds.
virtual RectLineIntersectionType lineIntersectionPoints(const Point &a_, const Point &b_, Point &iPt1__, Point &iPt2__) const
Finds the intersection points on a rectangle that a line has with it.
virtual Rect operator+(const Rect &rhs_) const
Allows two rects to have their origin and size objects added using the + operator.
virtual Point topRight() const
Gets the top-right point of the rect.
virtual void setRight(const double right_)
Sets the position of the right bounding edge of the rectangle along the x-axis.
virtual bool enclosePoint(const Point &pt_)
Enlarges the target rect, if necessary, to enclose a given point.
virtual void enclosingEllipse(double &width__, double &height__) const
Gets the width and height of an ellipse that would enclose the rect.
Point origin
Origin point for the rect (top-left, when size.width and size.height are positive)
Definition: hdicoreRect.h:39
virtual RectLineIntersectionType lineIntersectionPoints(const Point &a_, const Point &b_, const Angle &angle_, Point &iPt1__, Point &iPt2__) const
Finds the intersection points on a rectangle, were it rotated, that a line has with it.
virtual Rect & operator+=(const Rect &rhs_)
Allows two rects to have their origin and size objects added and assigned using the += operator.
virtual bool intersection(const Rect &rect2_, Rect &iRect__) const
Gets the intersection between two rects.
virtual Point midLeft() const
Gets the mid-left point of the rect.
virtual Rect unionRects(const Rect &rect2_) const
Unions two rects, forming a rect that has bounds sufficient to enclose both initial rects.
virtual bool containsPoint(const Point &pt_) const
Gets whether a given point lies inside the target rect.
virtual double area() const
Gets the area of the rect.
virtual Point bottomCenter() const
Gets the bottom-center point of the rect.
virtual void setLeft(const double left_)
Sets the position of the left 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 double perimeter() const
Gets the perimeter of the rect.
virtual Point midRight() const
Gets the mid-right point of the rect.
virtual Rect operator-(const Rect &rhs_) const
Allows two rects to have their origin and size objects subtracted using the - operator.
virtual bool overlaps(const Rect &rect2_) const
Checks whether the target rect overlaps a given rect.
virtual ~Rect()
Rect destructor.
virtual double right() const
Gets the position of the right 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 Rect 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 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)
virtual Point bottomRight() const
Gets the bottom-right point of the rect.
virtual Point topLeft() const
Gets the top-left point of the rect.
virtual Point topCenter() const
Gets the top-center point of the rect.
virtual bool operator==(const Rect &rhs_) const
Tests whether a given Rect object is the same as another.
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.
virtual Rect & operator-=(const Rect &rhs_)
Allows two rects to have their origin and size objects subtracted and assigned using the -= operator.
virtual Rect & operator=(const Rect &rhs_)
Sets a Rect object from another Rect object.
Rect()
Default Rect constructor; calls the default constructors for the origin and size.
Rect(const Point &pt_, const Size &size_)
Rect constructor, taking Point and Size arguments.
virtual Point midCenter() const
Gets the mid-center point of the rect.
virtual void setTop(const double top_)
Sets the position of the top bounding edge of the rectangle along the y-axis.
Rect(const Rect &rect_)
Rect copy constructor.
Size size
Dimensions of the rect.
Definition: hdicoreRect.h:44
virtual Point bottomLeft() const
Gets the bottom-left point of the rect.
virtual double left() const
Gets the position of the left bounding edge of the rectangle along the x-axis.
virtual void resize(const double w_, const double h_)
Resizes a rect to a given width and height.
virtual bool operator!=(const Rect &rhs_) const
Tests whether a given Rect object is not the same as another.
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:25
Header file for describing 2D points.
Header file for describing 2D dimensions (width and height)
BoundsPinPointType
These allow for simpler art transformation/bounds metadata access.
Definition: hdicoreTypes.h:794
RectLineIntersectionType
Describes which points were found when checking for intersections between a rect and a line.
Definition: hdicoreTypes.h:812