Exemplo n.º 1
0
shared_ptr<Relation> GeometryConverter::convertPolygonToRelation(const Polygon* polygon,
  const shared_ptr<OsmMap>& map, Status s, double circularError)
{
  shared_ptr<Relation> r(new Relation(s, map->createNextRelationId(), circularError,
    Relation::MULTIPOLYGON));
  convertPolygonToRelation(polygon, map, r, s, circularError);
  map->addRelation(r);

  return r;
}
Exemplo n.º 2
0
RelationPtr GeometryConverter::convertPolygonToRelation(const Polygon* polygon,
  const OsmMapPtr& map, Status s, double circularError)
{
  RelationPtr r(new Relation(s, map->createNextRelationId(), circularError,
    MetadataTags::RelationMultiPolygon()));
  convertPolygonToRelation(polygon, map, r, s, circularError);
  map->addRelation(r);

  return r;
}
Exemplo n.º 3
0
shared_ptr<Relation> GeometryConverter::convertMultiPolygonToRelation(const MultiPolygon* mp,
  const shared_ptr<OsmMap>& map, Status s, double circularError)
{
  shared_ptr<Relation> r(new Relation(s, map->createNextRelationId(), circularError,
    Relation::MULTIPOLYGON));
  for (size_t i = 0; i < mp->getNumGeometries(); i++)
  {
    convertPolygonToRelation(dynamic_cast<const Polygon*>(mp->getGeometryN(i)), map, r, s,
      circularError);
  }
  map->addRelation(r);
  return r;
}
Exemplo n.º 4
0
RelationPtr GeometryConverter::convertMultiPolygonToRelation(const MultiPolygon* mp,
  const OsmMapPtr& map, Status s, double circularError)
{
  RelationPtr r(
    new Relation(
      s, map->createNextRelationId(), circularError, MetadataTags::RelationMultiPolygon()));
  for (size_t i = 0; i < mp->getNumGeometries(); i++)
  {
    convertPolygonToRelation(
      dynamic_cast<const Polygon*>(mp->getGeometryN(i)), map, r, s, circularError);
  }
  map->addRelation(r);
  return r;
}
Exemplo n.º 5
0
shared_ptr<Element> GeometryConverter::convertPolygonToElement(const Polygon* polygon,
  const shared_ptr<OsmMap>& map, Status s, double circularError)
{
  // if the geometry is empty.
  if (polygon->isEmpty())
  {
    return shared_ptr<Element>();
  }
  else if (polygon->getNumInteriorRing() == 0)
  {
    shared_ptr<Way> result = convertLineStringToWay(polygon->getExteriorRing(), map, s, circularError);
    result->getTags()["area"] = "yes";
    return result;
  }
  else
  {
    return convertPolygonToRelation(polygon, map, s, circularError);
  }
}