2 * Copyright (C) 2013 HERE Global B.V. All rights reserved.
3 * This software, including documentation, is protected by copyright controlled by
4 * HERE Global B.V. (“Software”). All rights are reserved. Copying, including reproducing,
5 * storing, adapting or translating, any or all of this material requires the prior
6 * written consent of HERE Global B.V. You may use this
7 * Software in accordance with the terms and conditions defined in the
8 * HERE Location Platform Services Terms and Conditions, available at
9 * http://developer.here.com/terms-conditions-base
11 * As an additional permission to the above, you may distribute Software,
12 * in object code format as part of an Application, according to, and subject to, terms and
13 * conditions defined in the Tizen Software Development kit (“SDK”) License Agreement.
14 * You may distribute such object code format Application under terms of your choice,
15 * provided that the header and source files of the Software have not been modified.
18 #ifndef MAPOBJECTPOLYGON_H
19 #define MAPOBJECTPOLYGON_H
21 #include "common/HereMaps_global.h"
22 #include "maps/GeoMapObject.h"
23 #include "common/GeoCoordinates.h"
24 #include <tr1/functional>
26 #ifdef TIZEN_MIGRATION
27 #include "graphic/Color.h"
29 namespace Tizen { namespace Graphics { class Color; } }
32 HERE_MAPS_BEGIN_NAMESPACE
35 * This class encapsulates a map polygon object. A polygon is a closed polyline,
36 * therefore, in addition to a polyline, its properties include a fill color.
40 class EXPORT_API GeoMapObjectPolygon : public GeoMapObject
45 * This method is the default constructor.
47 GeoMapObjectPolygon();
50 * This method is the (virtual) destructor.
52 virtual ~GeoMapObjectPolygon();
55 * This method sets the path of the polygon, which is a list of locations
56 * that the path (line) connects.
58 * @param path A constant reference to an object containing a list of
59 * locations defined in terms of their geographic coordinates.
60 * Paths representing self-intersecting polygons are not supported.
61 * Such paths are not rendered on the map.
63 void SetPath(const GeoCoordinateList& path);
66 * This method appends the location of a new vertex to the polyline path.
68 * Note that self-intersecting polygons are not supported, therefore, if the
69 * given polygon should become self-intersecting as a result of this
70 * operation, it cannot be rendered on the map.
72 * @param rCoord A constant reference to an object specifying the geographic
73 * coordinates of a new vertex to be added to the path.
75 void AppendToPath(const GeoCoordinates& rCoord);
78 * This method retrieves the path of the polygon, which is a list of
79 * objects containing the geographic coordinates of its vertices.
81 * @return A reference to an object containing a list of vertices defined
82 * in terms of their geographic coordinates.
84 GeoCoordinateList GetPath() const;
87 * This typedef defines a function object as a type. The function object can
88 * be called when the path of the polygon has changed. A function object of
89 * this type returns <code>void</code> and receives a constant reference to
90 * a <code>GeoMapObject</code> as an argument.
92 typedef std::tr1::function<void (const GeoMapObject&)> PathChangedFunctor;
95 * This method sets a callback to be invoked when the polygon path has
98 * @param pathChanged A function object to be called when the path has
101 void SetPathChangedNotifier(PathChangedFunctor pathChanged);
104 * This method retrieves the bounding box of the polygon.
106 * @return An object encapsulating the bounding box of the given polygon
109 GeoBoundingBox GetBoundingBox() const;
112 * This method retrieves the current value of the polygon fill color.
114 * @return An object encapsulating the fill color.
116 Tizen::Maps::Color GetFillColor() const;
119 * This method sets the current value of the polygon fill color.
121 * @param fillColor An object encapsulating the fill color.
123 void SetFillColor(const Tizen::Maps::Color& fillColor);
126 * This typedef defines a fill-color-changed function object as a
127 * type. The function object can be called when the polygon fill color
128 * has changed. A function object of this type returns <code>void</code> and
129 * receives a constant reference to a <code>GeoMapObject</code> as an
132 typedef std::tr1::function<void (const GeoMapObject&)> FillColorChangedFunctor;
135 * This method sets a callback to be invoked when the polygon fill color
138 * @param fillColorChanged A function object to be called when the polygon
139 * fill color has changed.
141 void SetFillColorChangedNotifier(FillColorChangedFunctor fillColorChanged);
144 * This method retrieves the object type of the given polygon.
146 * @return A member of the enumerated data type indicating the type of the
147 * given polygon object.
149 Type GetType() const;
152 * This method sets a flag to indicate if the given object is visible.
154 * @return visible A Boolean, <code>true</code> if the object is visible,
155 * otherwise <code>false</code>.
157 virtual void SetVisible(bool visible);
160 * This method checks if the object can be rendered on the map.
162 * @return A Boolean, <code>true</code> if the object can be rendered,
163 * otherwise <code>false</code>.
165 virtual bool IsValid() const;
168 HERE_MAPS_NO_COPY_NO_ASSIGN(GeoMapObjectPolygon);
170 class GeoMapObjectPolygonImpl;
171 GeoMapObjectPolygonImpl* m_impl;
174 HERE_MAPS_END_NAMESPACE