Skip to content

Commit 484fbf9

Browse files
Pol Dell'AieraPol Dell'Aiera
authored andcommitted
Fix some bugs in Geometry class.
1 parent d8a4e2b commit 484fbf9

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

lib/adapters/GPX.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ protected function parseTracks() {
128128
if ($components) {
129129
$line = new LineString($components);
130130
$line->registerMetadataProvider($tmd_provider);
131+
$line->registerMetadataProvider($ele_provider);
131132
$lines[] = $line;
132133
}
133134
}

lib/geometry/Collection.class.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,5 +290,14 @@ public function exteriorRing() { return NULL; }
290290
public function numInteriorRings() { return NULL; }
291291
public function interiorRingN($n) { return NULL; }
292292
public function pointOnSurface() { return NULL; }
293+
294+
public function metadata($key) {
295+
$metadatas = array();
296+
foreach ($this->components as $component) {
297+
$metadatas[] = $component->metadata($key);
298+
}
299+
return $metadatas;
300+
}
301+
293302
}
294303

lib/geometry/ElevationMetadataProvider.class.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ public function get($target, $key) {
1313
}
1414

1515
public function set($target, $key, $value) {
16-
$target->metadata[__CLASS__][$key] = $value;
17-
return TRUE;
16+
if ($key === 'ele') {
17+
$target->metadata[__CLASS__][$key] = $value;
18+
return TRUE;
19+
}
20+
return FALSE;
1821
}
1922

2023
public function id() {

lib/geometry/Geometry.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ public function metadata($key) {
356356
if ($metadata_provider->set($this, $key, $value)) {
357357
return TRUE;
358358
}
359-
return FALSE;
360359
}
360+
return FALSE;
361361
}
362362
}
363363
}

lib/geometry/TimeMetadataProvider.class.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ public function get($target, $key) {
1313
}
1414

1515
public function set($target, $key, $value) {
16-
$target->metadata[__CLASS__][$key] = $value;
17-
return TRUE;
16+
if ($key === 'time') {
17+
$target->metadata[__CLASS__][$key] = $value;
18+
return TRUE;
19+
}
20+
return FALSE;
1821
}
1922

2023
public function id() {

0 commit comments

Comments
 (0)