boost::shared_ptr<Element> GeometryConverter::convertGeometryToElement(const Geometry* g, Status s, double circularError) { LOG_VART(g->getGeometryTypeId()); switch (g->getGeometryTypeId()) { case GEOS_POINT: return convertPointToNode(dynamic_cast<const Point*>(g), _map, s, circularError); case GEOS_LINESTRING: case GEOS_LINEARRING: return convertLineStringToWay(dynamic_cast<const LineString*>(g), _map, s, circularError); case GEOS_POLYGON: return convertPolygonToElement(dynamic_cast<const Polygon*>(g), _map, s, circularError); case GEOS_MULTILINESTRING: return convertMultiLineStringToElement( dynamic_cast<const MultiLineString*>(g), _map, s, circularError); case GEOS_MULTIPOLYGON: return convertMultiPolygonToRelation(dynamic_cast<const MultiPolygon*>(g), _map, s, circularError); case GEOS_GEOMETRYCOLLECTION: return convertGeometryCollection(dynamic_cast<const GeometryCollection*>(g), s, circularError); default: if (logWarnCount < Log::getWarnMessageLimit()) { LOG_WARN("Unsupported geometry type. Element will be removed from the map. " + g->toString()); } else if (logWarnCount == Log::getWarnMessageLimit()) { LOG_WARN(className() << ": " << Log::LOG_WARN_LIMIT_REACHED_MESSAGE); } logWarnCount++; return boost::shared_ptr<Element>(); } }
shared_ptr<Element> GeometryConverter::convertGeometryToElement(const Geometry* g, Status s, double circularError) { switch (g->getGeometryTypeId()) { case GEOS_LINESTRING: case GEOS_LINEARRING: return convertLineStringToWay(dynamic_cast<const LineString*>(g), _map, s, circularError); case GEOS_POLYGON: return convertPolygonToElement(dynamic_cast<const Polygon*>(g), _map, s, circularError); case GEOS_MULTILINESTRING: return convertMultiLineStringToElement(dynamic_cast<const MultiLineString*>(g), _map, s, circularError); case GEOS_MULTIPOLYGON: return convertMultiPolygonToRelation(dynamic_cast<const MultiPolygon*>(g), _map, s, circularError); case GEOS_GEOMETRYCOLLECTION: return convertGeometryCollection(dynamic_cast<const GeometryCollection*>(g), s, circularError); default: LOG_WARN(g->toString()); throw HootException("Unsupported geometry type."); } }