summaryrefslogtreecommitdiff
path: root/src/mbgl/util
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-02-18 17:09:26 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-01 20:58:54 +0000
commitf3fc87261c2f2db71ac9d63b680417836885da13 (patch)
treeac96b0dda727b5a262b664c121ae5579f9c0d645 /src/mbgl/util
parent411a562061f404fa7174222f38a1a9a13a396fd9 (diff)
downloadqtlocation-mapboxgl-f3fc87261c2f2db71ac9d63b680417836885da13.tar.gz
[core] Coordinate is now GeometryCoordinate
Also introduced GeometryCoordinates (vector of GeometryCoordinate items), to better cope with GeometryCollection.
Diffstat (limited to 'src/mbgl/util')
-rw-r--r--src/mbgl/util/clip_lines.cpp8
-rw-r--r--src/mbgl/util/clip_lines.hpp2
-rw-r--r--src/mbgl/util/merge_lines.cpp10
-rw-r--r--src/mbgl/util/merge_lines.hpp4
4 files changed, 12 insertions, 12 deletions
diff --git a/src/mbgl/util/clip_lines.cpp b/src/mbgl/util/clip_lines.cpp
index 071e9d09bd..41965876cb 100644
--- a/src/mbgl/util/clip_lines.cpp
+++ b/src/mbgl/util/clip_lines.cpp
@@ -3,10 +3,10 @@
namespace mbgl {
namespace util {
-std::vector<std::vector<Coordinate>> clipLines(const std::vector<std::vector<Coordinate>> &lines,
+GeometryCollection clipLines(const GeometryCollection &lines,
const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2) {
- std::vector<std::vector<Coordinate>> clippedLines;
+ GeometryCollection clippedLines;
for (auto& line : lines) {
@@ -15,8 +15,8 @@ std::vector<std::vector<Coordinate>> clipLines(const std::vector<std::vector<Coo
auto end = line.end() - 1;
for (auto it = line.begin(); it != end; it++) {
- Coordinate p0 = *(it);
- Coordinate p1 = *(it + 1);
+ GeometryCoordinate p0 = *(it);
+ GeometryCoordinate p1 = *(it + 1);
if (p0.x < x1 && p1.x < x1) {
continue;
diff --git a/src/mbgl/util/clip_lines.hpp b/src/mbgl/util/clip_lines.hpp
index 6e49b48085..a4a5c5fb8a 100644
--- a/src/mbgl/util/clip_lines.hpp
+++ b/src/mbgl/util/clip_lines.hpp
@@ -10,7 +10,7 @@ namespace mbgl {
namespace util {
-std::vector<std::vector<Coordinate>> clipLines(const std::vector<std::vector<Coordinate>> &lines,
+GeometryCollection clipLines(const GeometryCollection &lines,
const int16_t x1, const int16_t y1, const int16_t x2, const int16_t y2);
} // end namespace util
diff --git a/src/mbgl/util/merge_lines.cpp b/src/mbgl/util/merge_lines.cpp
index 4ff1caaf76..ee930c113e 100644
--- a/src/mbgl/util/merge_lines.cpp
+++ b/src/mbgl/util/merge_lines.cpp
@@ -11,7 +11,7 @@ unsigned int mergeFromRight(std::vector<SymbolFeature> &features,
Index &rightIndex,
Index::iterator left,
size_t rightKey,
- std::vector<std::vector<Coordinate>> &geom) {
+ GeometryCollection &geom) {
unsigned int index = left->second;
rightIndex.erase(left);
@@ -27,7 +27,7 @@ unsigned int mergeFromLeft(std::vector<SymbolFeature> &features,
Index &leftIndex,
size_t leftKey,
Index::iterator right,
- std::vector<std::vector<Coordinate>> &geom) {
+ GeometryCollection &geom) {
unsigned int index = right->second;
leftIndex.erase(right);
@@ -41,8 +41,8 @@ unsigned int mergeFromLeft(std::vector<SymbolFeature> &features,
}
size_t
-getKey(const std::u32string& text, const std::vector<std::vector<Coordinate>>& geom, bool onRight) {
- const Coordinate& coord = onRight ? geom[0].back() : geom[0].front();
+getKey(const std::u32string& text, const GeometryCollection& geom, bool onRight) {
+ const GeometryCoordinate& coord = onRight ? geom[0].back() : geom[0].front();
auto hash = std::hash<std::u32string>()(text);
boost::hash_combine(hash, coord.x);
@@ -57,7 +57,7 @@ void mergeLines(std::vector<SymbolFeature> &features) {
for (unsigned int k = 0; k < features.size(); k++) {
SymbolFeature &feature = features[k];
- std::vector<std::vector<Coordinate>> &geometry = feature.geometry;
+ GeometryCollection &geometry = feature.geometry;
if (!feature.label.length()) {
continue;
diff --git a/src/mbgl/util/merge_lines.hpp b/src/mbgl/util/merge_lines.hpp
index 4460a0bcea..55ad79036e 100644
--- a/src/mbgl/util/merge_lines.hpp
+++ b/src/mbgl/util/merge_lines.hpp
@@ -13,13 +13,13 @@ unsigned int mergeFromRight(std::vector<SymbolFeature> &features,
std::map<std::string, unsigned int> &rightIndex,
std::map<std::string, unsigned int>::iterator left,
std::string &rightKey,
- std::vector<std::vector<Coordinate>> &geom);
+ GeometryCollection &geom);
unsigned int mergeFromLeft(std::vector<SymbolFeature> &features,
std::map<std::string, unsigned int> &leftIndex,
std::string &leftKey,
std::map<std::string, unsigned int>::iterator right,
- std::vector<std::vector<Coordinate>> &geom);
+ GeometryCollection &geom);
void mergeLines(std::vector<SymbolFeature> &features);