Skip to content

Commit 81e37c2

Browse files
matthias1231bmarchant
authored andcommitted
Generalize building clusters into built-up areas (#3177)
* Framework for polygon cluster geo modifier * PolyClusterGeoModifier work * Simple ClosePointHash based clustering without extra distance check * Change Geometry Modifier filtering to use TagAdvancedCriterion * Modified all Geo Modifier rules and docs to use Feature Filtering format * Check all nodes instead of just centroid for clustering * Clustering by node with distance check, work in progress * Clustering by node with distance check, missing file * Recursive approach to cluster logic * Implement the use of the AlphaShape class to create a cluster polygon * AlphaShape geometry generation, in progress * Split long edges, add more debug logic * PolyClusterGeoModifier work * Parameter option support for PolyClusterGeomModifier * Fixed if () spacing in all C++ modules * fixed for () and foreach () spacing in all C++ modules * Fixed while () spacing in all C++ modules * Added class comment , cleanup * Added option to check for intersections * Added test for poly_cluster geo modifier * cleanup * Copyright update * Replaced boost shared_ptr with std * Minor updates to formatting and spelling
1 parent 86f88f3 commit 81e37c2

File tree

65 files changed

+1258
-659
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1258
-659
lines changed

conf/core/ConfigOptions.asciidoc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -980,25 +980,35 @@ hoot::GeometryModifierOp.
980980
==== Rule File Format
981981
-----
982982
{
983-
"way_to_poly": // command: way_to_poly, collapse_poly, etc.,
984-
// see implementations of GeometryModifierAction
983+
"way_to_poly": // Command: way_to_poly, collapse_poly, etc.
984+
// See implementations of GeometryModifierAction
985985
{
986-
"filter": // filter for matching elements to process, element must
987-
// have all tags with matching keys/values to be processed
986+
"filter": // Filter for limiting the elements to process. The modifier uses the
987+
// Feature Filtering logic as used for conflation (FeatureFiltering.asciidoc)
988988
{
989-
"aeroway": "runway"
989+
"must":
990+
[
991+
{
992+
"tag": "aeroway=runway"
993+
}
994+
]
990995
},
991-
"arguments": // arguments specific to the selected command
996+
"arguments": // Arguments specific to the selected command
992997
{
993998
"default_width_m": 10,
994999
"width_tag_m" : "width"
9951000
}
9961001
},
997-
"collapse_poly": // next command: all commands defined are processed in sequence
1002+
"collapse_poly": // Next command: all commands defined are processed in sequence
9981003
{
9991004
"filter":
10001005
{
1001-
"building": "yes"
1006+
"must":
1007+
[
1008+
{
1009+
"tag": "building=yes"
1010+
}
1011+
]
10021012
},
10031013
"arguments":
10041014
{

conf/core/GeometryModifierRules.json

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
{
44
"filter":
55
{
6-
"aeroway": "runway"
6+
"must":
7+
[
8+
{
9+
"tag": "aeroway=runway"
10+
}
11+
]
712
},
813
"arguments":
914
{
@@ -15,7 +20,12 @@
1520
{
1621
"filter":
1722
{
18-
"aeroway": "taxiway"
23+
"must":
24+
[
25+
{
26+
"tag": "aeroway=taxiway"
27+
}
28+
]
1929
},
2030
"arguments":
2131
{
@@ -27,8 +37,13 @@
2737
{
2838
"filter":
2939
{
30-
"building": "yes"
31-
},
40+
"must":
41+
[
42+
{
43+
"tag": "building=yes"
44+
}
45+
]
46+
},
3247
"arguments":
3348
{
3449
"max_area_in_m": 15000
@@ -38,7 +53,12 @@
3853
{
3954
"filter":
4055
{
41-
"bridge": "yes"
56+
"must":
57+
[
58+
{
59+
"tag": "bridge=yes"
60+
}
61+
]
4262
},
4363
"arguments":
4464
{

hoot-core-test/src/test/cpp/hoot/core/index/ClosePointHashTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ClosePointHashTest : public HootTestFixture
7777

7878
int count = 0;
7979
cph.resetIterator();
80-
while(cph.next())
80+
while (cph.next())
8181
{
8282
const vector<long>& v = cph.getMatch();
8383
count++;
@@ -126,7 +126,7 @@ class ClosePointHashTest : public HootTestFixture
126126

127127
int count = 0;
128128
cph.resetIterator();
129-
while(cph.next())
129+
while (cph.next())
130130
{
131131
const vector<long>& v = cph.getMatch();
132132

hoot-core-test/src/test/cpp/hoot/core/io/ServiceHootApiDbTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class ServiceHootApiDbTest : public HootTestFixture
246246
int ctr = 0;
247247
while (nodeResultIterator->next())
248248
{
249-
for(int j = 0; j < 10; j++) { LOG_TRACE("VALUE = "+nodeResultIterator->value(j).toString()); }
249+
for (int j = 0; j < 10; j++) { LOG_TRACE("VALUE = " + nodeResultIterator->value(j).toString()); }
250250

251251
HOOT_STR_EQUALS(nodeId, nodeResultIterator->value(0).toLongLong());
252252
HOOT_STR_EQUALS(38.0, nodeResultIterator->value(1).toDouble());

hoot-core-test/src/test/cpp/hoot/core/io/ServicesDbTestUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ void ServicesDbTestUtils::deleteUser(QString email)
155155

156156
int ServicesDbTestUtils::findIndex(const QList<QString>& keys, const QString& key)
157157
{
158-
for(int i=0;i<keys.size();i++)
158+
for (int i = 0; i < keys.size(); i++)
159159
{
160-
if(keys[i]==key) return i;
160+
if (keys[i] == key) return i;
161161
}
162162

163163
// didn't find a match so return -1

hoot-core/src/main/cpp/hoot/core/algorithms/FrechetDistance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,10 @@ vector<frechet_subline> FrechetDistance::matchingSublines(Meters maxDistance)
277277
if (_matrix[r][c] < maxDistance)
278278
{
279279
// Check above and left to eliminate starting points that lie along a path already started
280-
if( (r > 0 && _matrix[r - 1][c] < maxDistance) ||
280+
if ((r > 0 && _matrix[r - 1][c] < maxDistance) ||
281281
(c > 0 && _matrix[r][c - 1] < maxDistance) ||
282282
(r > 0 && c > 0 && _matrix[r - 1][c - 1] < maxDistance)
283-
)
283+
)
284284
continue;
285285
starts.push_back(vertex_match(r, c));
286286
}

hoot-core/src/main/cpp/hoot/core/algorithms/LongestCommonNodeString.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int LongestCommonNodeString::apply()
4949
_i1 = -1;
5050
_i2 = -1;
5151

52-
if(_w1->getNodeCount() == 0 || _w2->getNodeCount() == 0)
52+
if (_w1->getNodeCount() == 0 || _w2->getNodeCount() == 0)
5353
{
5454
return 0;
5555
}
@@ -62,17 +62,17 @@ int LongestCommonNodeString::apply()
6262
int *swap = 0;
6363
int maxSubstr = 0;
6464

65-
for(size_t i = 0; i < str1.size(); ++i)
65+
for (size_t i = 0; i < str1.size(); ++i)
6666
{
67-
for(size_t j = 0; j < str2.size(); ++j)
67+
for (size_t j = 0; j < str2.size(); ++j)
6868
{
69-
if(str1[i] != str2[j])
69+
if (str1[i] != str2[j])
7070
{
7171
curr[j] = 0;
7272
}
7373
else
7474
{
75-
if(i == 0 || j == 0)
75+
if (i == 0 || j == 0)
7676
{
7777
curr[j] = 1;
7878
}

hoot-core/src/main/cpp/hoot/core/algorithms/alpha-shape/AlphaShape.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ inline double distance(double x1, double x2, double y1, double y2)
151151
AlphaShape::AlphaShape(double alpha)
152152
{
153153
_alpha = alpha;
154-
_dt.reset(new Tgs::DelaunayTriangulation);
154+
_pDelauneyTriangles.reset(new Tgs::DelaunayTriangulation);
155155
}
156156

157157
WayPtr AlphaShape::_addFaceAsWay(const Face* face, const std::shared_ptr<OsmMap>& map)
@@ -330,7 +330,7 @@ void AlphaShape::insert(const vector<pair<double, double>>& points)
330330
{
331331
PROGRESS_TRACE("Progress: " << i << " of " << randomized.size() - 1 << " ");
332332
}
333-
_dt->insert(randomized[i].first, randomized[i].second);
333+
_pDelauneyTriangles->insert(randomized[i].first, randomized[i].second);
334334
}
335335
LOG_TRACE("Progress: " << randomized.size() - 1 << " of " << randomized.size() - 1 << " ");
336336
}
@@ -359,7 +359,7 @@ std::shared_ptr<Geometry> AlphaShape::toGeometry()
359359
Envelope e;
360360
double preUnionArea = 0.0;
361361
int i = 0;
362-
for (FaceIterator fi = _dt->getFaceIterator(); fi != _dt->getFaceEnd(); fi++)
362+
for (FaceIterator fi = _pDelauneyTriangles->getFaceIterator(); fi != _pDelauneyTriangles->getFaceEnd(); fi++)
363363
{
364364
const Face& f = *fi;
365365
i++;
@@ -480,7 +480,7 @@ std::shared_ptr<Geometry> AlphaShape::toGeometry()
480480
QString AlphaShape::toString()
481481
{
482482
QString result;
483-
Edge start = _dt->getStartingEdge();
483+
Edge start = _pDelauneyTriangles->getStartingEdge();
484484
Edge e = start;
485485

486486
do

hoot-core/src/main/cpp/hoot/core/algorithms/alpha-shape/AlphaShape.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class AlphaShape
8484

8585
double _alpha;
8686

87-
std::shared_ptr<Tgs::DelaunayTriangulation> _dt;
87+
std::shared_ptr<Tgs::DelaunayTriangulation> _pDelauneyTriangles;
8888
std::set<std::pair<double, double>> _outsidePoint;
8989

9090
std::shared_ptr<hoot::Way> _addFaceAsWay(const Tgs::Face* face, const std::shared_ptr<OsmMap>& map);

hoot-core/src/main/cpp/hoot/core/algorithms/subline-matching/MaximalNearestSubline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ MaximalNearestSubline::MaximalNearestSubline(const ConstOsmMapPtr& map,
7272
Meters MaximalNearestSubline::_calculateIntervalLength()
7373
{
7474
Meters result = -1;
75-
if(_maxInterval[0].isValid() && _maxInterval[1].isValid())
75+
if (_maxInterval[0].isValid() && _maxInterval[1].isValid())
7676
{
7777
Meters d0 = _maxInterval[0].calculateDistanceOnWay();
7878
Meters d1 = _maxInterval[1].calculateDistanceOnWay();

0 commit comments

Comments
 (0)