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_FLOATRECTANGLE_H
18 #define HERE_GRAPHIC_FLOATRECTANGLE_H
20 #include "common/HereMaps_global.h"
21 #include "base/BaseObject.h"
22 #include "graphic/FloatDimension.h"
23 #include "graphic/FloatPoint.h"
25 TIZEN_MAPS_BEGIN_NAMESPACE
29 class EXPORT_API FloatRectangle : public Object
33 * This is the default constructor for this class. @n
34 * It initializes an instance of %FloatRectangle with all its attributes set to @c 0.f.
38 * @remarks The attribute value is @c 0 when initialized.
43 * This is the copy constructor for the %FloatRectangle class.
47 * @param[in] rhs An instance of %FloatRectangle
49 FloatRectangle(const FloatRectangle& rhs);
52 * Initializes an instance of %FloatRectangle 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 FloatRectangle(float x, float y, float width, float height);
65 * Initializes an instance of %FloatRectangle 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 FloatRectangle(const FloatPoint& point, const FloatDimension& dim);
76 * This is the destructor for this class.
80 virtual ~FloatRectangle(void);
83 * This is the default assignment operator for this class.
87 * @param[in] rhs An instance of %FloatRectangle
89 FloatRectangle& operator=(const FloatRectangle& rhs);
92 * Checks whether the location and dimension of the current instance of %FloatRectangle match those of the
93 * specified instance of %FloatRectangle.
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 %FloatRectangle
101 bool operator==(const FloatRectangle& rhs) const;
104 * Checks whether the location and dimension of the current instance of %FloatRectangle do not match those of the
105 * specified instance of %FloatRectangle.
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 %FloatRectangle
113 bool operator!=(const FloatRectangle& rhs) const;
116 * Checks whether the specified point lies inside the current instance of %FloatRectangle.
120 * @return @c true if the location represented by @c point lies inside the current instance of %FloatRectangle, @n
122 * @param[in] point An instance of FloatPoint
124 bool Contains(const FloatPoint& point) const;
127 * Checks whether the value of the current instance of %FloatRectangle equals the value of the specified instance of
132 * @return @c true if the value of the current instance of %FloatRectangle equals the value of the specified instance of %FloatRectangle, @n
134 * @param[in] rhs An instance of %FloatRectangle
135 * @remarks The %FloatRectangle 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
146 * @remarks Two equal instances must return the same hash value. For better performance,
147 * the used hash function must generate a random distribution for all inputs.
149 virtual long GetHashCode(void) const;
152 * Gets the intersection of the current instance and the specified instance of %FloatRectangle. @n
153 * If the two instances of %FloatRectangle do not intersect, empty instance is returned.
157 * @param[in] rect An instance of %FloatRectangle
159 FloatRectangle GetIntersection(const FloatRectangle& rect) const;
162 * Checks whether the current instance of %FloatRectangle intersects with the specified instance of %FloatRectangle.
166 * @return @c true if the current instance of %FloatRectangle intersects with the specified instance of %FloatRectangle, @n
168 * @param[in] rect An instance of %FloatRectangle
171 bool IsIntersected(const FloatRectangle& rect) const;
174 * Gets the union of the current instance and the specified instance of %FloatRectangle.
178 * @return An instance of %FloatRectangle containing the union of the two rectangles
179 * @param[in] rect An instance of %FloatRectangle
181 FloatRectangle GetUnion(const FloatRectangle& rect) const;
184 * Gets the coordinates of the point at the bottom-right corner of the rectangle.
188 * @return The coordinates of the point at the bottom-right corner of the rectangle
190 FloatPoint GetBottomRight(void) const;
193 * Gets the coordinates of the point at the top-left corner of the rectangle.
197 * @return The coordinates of the point at the top-left corner of the rectangle
199 FloatPoint GetTopLeft(void) const;
202 * Checks whether this %FloatRectangle is empty. @n
203 * A %FloatRectangle is empty if its width or its height is less than or equal to @c 0.
207 * @return @c true if this rectangle is empty, @n
210 bool IsEmpty(void) const;
213 * Sets the size of this %FloatRectangle to match the specified FloatDimension.
217 * @param[in] dim The new size for FloatDimension
219 void SetSize(const FloatDimension& dim);
222 * Sets the size of this %FloatRectangle to match the specified dimension.
226 * @param[in] width The new width
227 * @param[in] height The new height
229 void SetSize(float width, float height);
232 * Sets the position of this %FloatRectangle to the specified point.
236 * @param[in] point The new position
238 void SetPosition(const FloatPoint& point);
241 * Sets the location of the current instance of %FloatRectangle with the specified values of the
242 * x and y coordinates of the top-left corner point.
246 * @param[in] x The new x-coordinate
247 * @param[in] y The new y-coordinate
249 void SetPosition(float x, float y);
252 * Sets the location and the dimensions of the current instance of %FloatRectangle with the specified x and y
253 * coordinates of the top-left corner point and the specified dimensions.
257 * @param[in] x The new x-coordinate
258 * @param[in] y The new y-coordinate
259 * @param[in] width The new width
260 * @param[in] height The new height
262 void SetBounds(float x, float y, float width, float height);
265 * Sets the location and the dimensions of the current instance of %FloatRectangle with the specified location and
270 * @param[in] point An instance of FloatPoint
271 * @param[in] dim An instance of FloatDimension
273 void SetBounds(const FloatPoint& point, const FloatDimension& dim);
276 * Translates this %FloatRectangle to the new point by the specified distance along the x-axis and y-axis.
280 * @param[in] deltaX The distance to move this %FloatRectangle along the x-axis
281 * @param[in] deltaY The distance to move this %FloatRectangle along the y-axis
283 void Translate(float deltaX, float deltaY);
287 * The x-coordinate of the top-left corner of the rectangle.
294 * The y-coordinate of the top-left corner of the rectangle.
301 * The width of this rectangle.
308 * The height of this rectangle.
315 friend class _FloatRectangleImpl;
318 // This variable is for internal use only.
319 // Using this variable can cause behavioral, security-related, and consistency-related issues in the application.
323 class _FloatRectangleImpl* __pImpl;
327 TIZEN_MAPS_END_NAMESPACE
329 #endif /* HERE_GRAPHIC_FLOATRECTANGLE_H */