protected function KML::parseGeometryCollection in geoPHP 8
Same name and namespace in other branches
- 7 geoPHP/lib/adapters/KML.class.php \KML::parseGeometryCollection()
File
- geoPHP/
lib/ adapters/ KML.class.php, line 155
Class
- KML
- PHP Geometry/KML encoder/decoder
Code
protected function parseGeometryCollection($xml) {
$components = array();
$geom_types = geoPHP::geometryList();
foreach ($xml->childNodes as $child) {
$nodeName = $child->nodeName == 'linearring' ? 'linestring' : $child->nodeName;
if (array_key_exists($nodeName, $geom_types)) {
$function = 'parse' . $geom_types[$nodeName];
$components[] = $this
->{$function}($child);
}
}
return new GeometryCollection($components);
}