Пример #1
0
    void runJavaScriptTranslateTest()
    {
      OgrReader uut;

      Progress progress("runBasicTest");
      shared_ptr<OsmMap> map(new OsmMap());
      uut.setTranslationFile("translations/cloudmade.js");
      uut.read("test-files/jakarta_raya_coastline.shp", "", map, progress);

      CPPUNIT_ASSERT_EQUAL(604, map->getNodeMap().size());
      CPPUNIT_ASSERT_EQUAL(6, (int)map->getWays().size());

      int shoreline = 0;
      int water = 0;
      for (WayMap::const_iterator it = map->getWays().begin(); it != map->getWays().end(); ++it)
      {
        shared_ptr<Way> w = it->second;
        if (w->getTags()["natural"] == "shoreline")
        {
          shoreline++;
        }
        if (w->getTags()["natural"] == "water")
        {
          water++;
        }
      }
      CPPUNIT_ASSERT_EQUAL(5, shoreline);
      CPPUNIT_ASSERT_EQUAL(1, water);
    }
Пример #2
0
void BaseCommand::loadMap(shared_ptr<OsmMap> map, QString path, bool useFileId,
                          Status defaultStatus)
{
  if (path.endsWith(".geonames"))
  {
    GeoNamesReader reader;
    reader.setDefaultStatus(defaultStatus);
    reader.read(path, map);
  }
  else
  {
    QStringList pathLayer = path.split(";");
    QString justPath = pathLayer[0];
    if (OgrReader::isReasonablePath(justPath))
    {
      OgrReader reader;
      Progress progress(getName());
      reader.setDefaultStatus(defaultStatus);
      reader.read(justPath, pathLayer.size() > 1 ? pathLayer[1] : "", map, progress);
    }
    else
    {
      OsmMapReaderFactory::read(map, path, useFileId, defaultStatus);
    }
  }
}
Пример #3
0
    void runBasicTest()
    {
      OgrReader uut;

      Progress progress("runBasicTest");
      shared_ptr<OsmMap> map(new OsmMap());
      uut.read("test-files/jakarta_raya_coastline.shp", "", map, progress);

      CPPUNIT_ASSERT_EQUAL(604, map->getNodeMap().size());
      CPPUNIT_ASSERT_EQUAL(6, (int)map->getWays().size());
    }
Пример #4
0
void IoUtils::loadMap(OsmMapPtr map, QString path, bool useFileId, Status defaultStatus)
{
  QStringList pathLayer = path.split(";");
  QString justPath = pathLayer[0];
  if (OgrReader::isReasonablePath(justPath))
  {
    OgrReader reader;
    Progress progress("OsmUtils");
    reader.setDefaultStatus(defaultStatus);
    reader.read(justPath, pathLayer.size() > 1 ? pathLayer[1] : "", map, progress);
  }
  else
  {
    OsmMapReaderFactory::read(map, path, useFileId, defaultStatus);
  }
}