Ejemplo n.º 1
0
void ServicesDbReader::read(shared_ptr<OsmMap> map)
{
  LOG_DEBUG("IN ServicesDbReader::read()...");
  //LOG_DEBUG("bounding box key=");
  //LOG_DEBUG(_bbox);

  if(_osmElemId > -1 && _osmElemType != ElementType::Unknown)
  {
    _read(map, _osmElemType);
  }
  else if(_bbox == "") // process SELECT ALL
  {
    for (int ctr = ElementType::Node; ctr != ElementType::Unknown; ctr++)
    {
      ElementType::Type elementType = static_cast<ElementType::Type>(ctr);
      _read(map, elementType);
    }
  }
  else // process BOUNDED REGION
  {
    for (int ctr = ElementType::Node; ctr != ElementType::Unknown; ctr++)
    {
        LOG_DEBUG("About to call bounded with element");
        LOG_DEBUG(ctr);
      ElementType::Type elementType = static_cast<ElementType::Type>(ctr);
      _readBounded(map, elementType);
    }
  }
}
Ejemplo n.º 2
0
void OsmApiDbReader::read(shared_ptr<OsmMap> map)
{
  LOG_DEBUG("IN OsmApiDbReader::read()...");

  if(_osmElemId > -1 && _osmElemType != ElementType::Unknown)
  {
    _read(map, _osmElemType);
  }
  else if(_bbox == "") // process SELECT ALL
  {
    for (int ctr = ElementType::Node; ctr != ElementType::Unknown; ctr++)
    {
      ElementType::Type elementType = static_cast<ElementType::Type>(ctr);
      _read(map, elementType);
    }
  }
  else // process BOUNDED REGION
  {
    QStringList bboxParts = _bbox.split(",");
    double minLat = bboxParts[1].toDouble();
    double minLon = bboxParts[0].toDouble();
    double maxLat = bboxParts[3].toDouble();
    double maxLon = bboxParts[2].toDouble();

    Envelope env(minLon, maxLon, minLat, maxLat);

    //select all elements in the bounding box
    for (int ctr = ElementType::Node; ctr != ElementType::Unknown; ctr++)
    {
      LOG_DEBUG("About to call bounded with element");
      LOG_DEBUG(ctr);
      ElementType::Type elementType = static_cast<ElementType::Type>(ctr);
      _readBounded(map, elementType, env);
    }

    //crop the map
    MapCropper::crop(map, env);
  }
}