2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #ifndef HERE_GRAPHIC_RECTANGLE_H
18 #define HERE_GRAPHIC_RECTANGLE_H
20 #include "common/HereMaps_global.h"
21 #include "base/BaseObject.h"
22 #include "graphic/Point.h"
23 #include "graphic/Dimension.h"
25 TIZEN_MAPS_BEGIN_NAMESPACE
29 class EXPORT_API Rectangle : public Object
33 * This is the default constructor for this class. @n
34 * It initializes an instance of %Rectangle with all its attributes set to @c 0.
38 * @remarks The attribute value is @c 0 when initialized.
43 * This is the copy constructor for the %Rectangle class.
47 * @param[in] rhs An instance of %Rectangle
49 Rectangle(const Rectangle& rhs);
52 * Initializes an instance of %Rectangle with the specified location and dimension.
56 * @param[in] x The x-coordinate of the top-left corner of the rectangle
57 * @param[in] y The y-coordinate of the top-left corner of the rectangle
58 * @param[in] width The width of the rectangle
59 * @param[in] height The height of the rectangle
62 Rectangle(int x, int y, int width, int height);
65 * Initializes an instance of %Rectangle at the location specified by @c point and
66 * with dimension specified by @c dim.
70 * @param[in] point The location of the top-left corner of the rectangle
71 * @param[in] dim The width and height of the rectangle
73 Rectangle(const Point& point, const Dimension& dim);
76 * This is the destructor for this class.
80 virtual ~Rectangle(void);
83 * Assigns the value of the specified instance to the current instance of %Rectangle.
87 * @param[in] rhs An instance of %Rectangle
89 Rectangle& operator =(const Rectangle& rhs);
92 * Checks whether the location and dimension of the current instance of %Rectangle match those of the
93 * specified instance of %Rectangle.
97 * @return @c true if the location and dimension of the current instance match those of the specified instance, @n
99 * @param[in] rhs An instance of %Rectangle
101 bool operator ==(const Rectangle& rhs) const;
104 * Checks whether the location and dimension of the current instance of %Rectangle do not match those of the
105 * specified instance of %Rectangle.
109 * @return @c true if the location and dimension of the current instance do not match those of the specified instance, @n
111 * @param[in] rhs An instance of %Rectangle
113 bool operator !=(const Rectangle& rhs) const;
116 * Checks whether the specified point lies inside the current instance of %Rectangle.
120 * @return @c true if the location represented by the specified @c point lies inside the current instance of %Rectangle, @n
122 * @param[in] point An instance of %Point
124 bool Contains(const Point& point) const;
127 * Checks whether the value of the current instance of %Rectangle equals the value of the specified instance of
132 * @return @c true if the value of the current instance of %Rectangle equals the value of the specified instance of %Rectangle, @n
134 * @param[in] rhs An instance of %Rectangle
135 * @remarks The %Rectangle class has a semantic value, which means that the Equals() method checks whether the
136 * two instances have the same location and size.
138 virtual bool Equals(const Object& rhs) const;
141 * Gets the hash value of the current instance.
145 * @return The hash value of the current instance
147 virtual long GetHashCode(void) const;
150 * Gets the intersection of the current instance and the specified instance of %Rectangle. @n
151 * If the two instances of %Rectangle do not intersect, an empty instance is returned.
155 * @param[in] rect An instance of %Rectangle
157 Rectangle GetIntersection(const Rectangle& rect) const;
160 * Checks whether the current instance of %Rectangle intersects with the specified instance of %Rectangle.
164 * @return @c true if the current instance of %Rectangle intersects with the specified instance of %Rectangle, @n
166 * @param[in] rect An instance of %Rectangle
169 bool IsIntersected(const Rectangle& rect) const;
172 * Gets the union of the current instance and the specified instance of %Rectangle.
176 * @return An instance of %Rectangle containing the union of the two rectangles
177 * @param[in] rect An instance of %Rectangle
179 Rectangle GetUnion(const Rectangle& rect) const;
182 * Gets the coordinates of the point at the bottom-right corner of the rectangle.
186 * @return The coordinates of the point at the bottom-right corner of the rectangle
188 Point GetBottomRight(void) const;
191 * Gets the coordinates of the point at the top-left corner of the rectangle.
195 * @return The coordinates of the point at the top-left corner of the rectangle
197 Point GetTopLeft(void) const;
200 * Checks whether this %Rectangle is empty. @n
201 * A %Rectangle is empty if its width or its height is less than or equal to @c 0.
205 * @return @c true if this rectangle is empty, @n
208 bool IsEmpty(void) const;
211 * Sets the size of this %Rectangle to match the specified Dimension.
215 * @param[in] dim The new size for the Dimension
217 void SetSize(const Dimension& dim);
220 * Sets the size of this %Rectangle to match the specified dimension.
224 * @param[in] width The new width
225 * @param[in] height The new height
227 void SetSize(int width, int height);
230 * Sets the position of this %Rectangle to the specified point.
234 * @param[in] point The new position
236 void SetPosition(const Point& point);
239 * Sets the location of the current instance of %Rectangle with the specified values of the
240 * x and y coordinates of the top-left corner point.
244 * @param[in] x The new x-coordinate
245 * @param[in] y The new y-coordinate
247 void SetPosition(int x, int y);
250 * Sets the location and the dimensions of the current instance of %Rectangle with the specified x and y
251 * coordinates of the top-left corner point and the specified dimensions.
255 * @param[in] x The new x coordinate
256 * @param[in] y The new y coordinate
257 * @param[in] width The new width
258 * @param[in] height The new height
260 void SetBounds(int x, int y, int width, int height);
263 * Sets the location and the dimensions of the current instance of %Rectangle with the specified location and
268 * @param[in] point An instance of Point
269 * @param[in] dim An instance of Dimension
271 void SetBounds(const Point& point, const Dimension& dim);
274 * Translates this %Rectangle to the new point by the specified distance along the x-axis and y-axis.
278 * @param[in] deltaX The distance to move this %Rectangle along the x-axis
279 * @param[in] deltaY The distance to move this %Rectangle along the y-axis
281 void Translate(int deltaX, int deltaY);
285 * The x-coordinate of the top-left corner of the rectangle.
292 * The y-coordinate of the top-left corner of the rectangle.
299 * The width of this rectangle.
306 * The height of this rectangle.
313 friend class _RectangleImpl;
316 // This variable is for internal use only.
317 // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
321 class _RectangleImpl * __pImpl;
325 TIZEN_MAPS_END_NAMESPACE
327 #endif /* HERE_GRAPHIC_RECTANGLE_H */