Hot Door CORE  0.7.0
Adobe® Illustrator® Plug-in Library
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 
13 namespace hdi
14 {
15  namespace plugin
16  {
17  class Rect;
18  }
19 
20  namespace core
21  {
26  class Rect
27  {
28  public:
33 
38 
44  Rect();
45 
56  Rect(const double x_, const double y_, const double width_, const double height_);
57 
66  Rect(const Point& pt_, const Size& size_);
67 
75  Rect(const Rect& rect_);
76 
82  virtual ~Rect();
83 
92  virtual Rect& operator=(const Rect& rhs_);
93 
102  virtual bool operator==(const Rect& rhs_) const;
103 
112  virtual bool operator!=(const Rect& rhs_) const;
113 
122  virtual Rect operator+(const Rect& rhs_) const;
123 
132  virtual Rect& operator+=(const Rect& rhs_);
133 
143  virtual Rect operator-(const Rect& rhs_) const;
144 
154  virtual Rect& operator-=(const Rect& rhs_);
155 
168  virtual void offset(const double tx_, const double ty_);
169 
179  virtual void resize(const double w_, const double h_);
180 
192  virtual Rect inset(const double x_, const double y_) const;
193 
204  virtual Point topLeft() const;
205 
216  virtual Point topCenter() const;
217 
228  virtual Point topRight() const;
229 
240  virtual Point midLeft() const;
241 
249  virtual Point midCenter() const;
250 
261  virtual Point midRight() const;
262 
273  virtual Point bottomLeft() const;
274 
285  virtual Point bottomCenter() const;
286 
297  virtual Point bottomRight() const;
298 
308  virtual double area() const;
309 
317  virtual double perimeter() const;
318 
327  virtual bool containsPoint(const Point& pt_) const;
328 
337  virtual bool overlaps(const Rect& rect2_) const;
338 
339 
340  private:
341  friend plugin::Rect* __accessImpl(const Rect&);
342  friend Rect __accessCtor(const plugin::Rect&);
343 
347  plugin::Rect* __impl;
348 
354  Rect(const plugin::Rect&);
355  };
356 
357  typedef std::auto_ptr<Rect> RectAP;
358 
359  extern plugin::Rect* __accessImpl(const Rect&);
360  extern Rect __accessCtor(const plugin::Rect&);
361  }
362 }
363 
364 #endif
365 // __HDI_CORE_RECT__
virtual bool overlaps(const Rect &rect2_) const
Checks whether the target rect overlaps a given rect.
Rect()
Default Rect constructor; calls the default constructors for the origin and size. ...
Describes a point in the 2-dimensional (x,y) coordinate system, typically in an Illustrator document ...
Definition: hdicorePoint.h:26
virtual bool containsPoint(const Point &pt_) const
Gets whether a given point lies inside the target rect.
Point origin
Origin point for the rect (top-left, when size.width and size.height are positive) ...
Definition: hdicoreRect.h:32
virtual Point bottomCenter() const
Gets the bottom-center point of the rect.
virtual Rect operator+(const Rect &rhs_) const
Allows two rects to have their origin and size objects added using the + operator.
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 bottomLeft() const
Gets the bottom-left point of the rect.
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:26
Size size
Dimensions of the rect.
Definition: hdicoreRect.h:37
virtual double perimeter() const
Gets the perimeter of the rect.
Header file for describing 2D dimensions (width and height)
virtual void offset(const double tx_, const double ty_)
Offsets a rect along the x- and y-axes by given amounts.
virtual bool operator!=(const Rect &rhs_) const
Tests whether a given Rect object is not the same as another.
virtual Point topLeft() const
Gets the top-left point of the rect.
Contains a width and height for a rectangular shape.
Definition: hdicoreSize.h:24
Header file for describing 2D points.
Definition: hdicoreaiArray.h:12
virtual Point midCenter() const
Gets the mid-center point of the rect.
virtual Point bottomRight() const
Gets the bottom-right point of the rect.
virtual void resize(const double w_, const double h_)
Resizes a rect to a given width and height.
virtual Point midLeft() const
Gets the mid-left point of the rect.
virtual bool operator==(const Rect &rhs_) const
Tests whether a given Rect object is the same as another.
virtual Point topRight() const
Gets the top-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 Point midRight() const
Gets the mid-right point of the rect.
virtual double area() const
Gets the area of the rect.
virtual Point topCenter() const
Gets the top-center point of the rect.
virtual Rect & operator+=(const Rect &rhs_)
Allows two rects to have their origin and size objects added and assigned using the += operator...
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.
virtual ~Rect()
Rect destructor.