当前位置: 首页>>代码示例>>C++>>正文


C++ WayPtr::getTimestamp方法代码示例

本文整理汇总了C++中WayPtr::getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:C++ WayPtr::getTimestamp方法的具体用法?C++ WayPtr::getTimestamp怎么用?C++ WayPtr::getTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WayPtr的用法示例。


在下文中一共展示了WayPtr::getTimestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: runReadByBoundsTest

  void runReadByBoundsTest()
  {
    insertDataForBoundTest();

    OsmApiDb database;
    database.open(ServicesDbTestUtils::getOsmApiDbUrl());
    OsmApiDbReader reader;
    reader.open(ServicesDbTestUtils::getOsmApiDbUrl().toString());
    OsmMapPtr map(new OsmMap());

    reader.setBoundingBox("-88.1,28.91,-88.0,28.89");
    reader.read(map);

    //quick check to see if the element counts are off...consult the test output for more detail

    //All but two of the seven nodes should be returned.  There are five nodes outside of the
    //requested bounds, one of them is referenced by a way within the bounds and the other three by a
    //relation within the bounds.  The nodes not returned is outside of the requested bounds and not
    //reference by any other element.
    CPPUNIT_ASSERT_EQUAL(5, (int)map->getNodes().size());
    //Two of the five ways should be returned.  The ways not returned contain nodes
    //that are out of bounds.
    CPPUNIT_ASSERT_EQUAL(2, (int)map->getWays().size());
    //Two of the six relations should be returned.  The relations not returned contain all
    //members that are out of bounds.
    CPPUNIT_ASSERT_EQUAL(2, (int)map->getRelations().size());

    // Verify timestamps look OK
    WayPtr pWay = map->getWays().begin()->second;
    CPPUNIT_ASSERT(0 != pWay->getTimestamp());


    //Need to remove timestamps, otherwise they cause issues with the compare
    QList<ElementAttributeType> types;
    types.append(ElementAttributeType(ElementAttributeType::Timestamp));
    RemoveAttributesVisitor attrVis(types);
    map->visitRw(attrVis);

    TestUtils::mkpath("test-output/io/ServiceOsmApiDbReaderTest");
    MapProjector::projectToWgs84(map);
    OsmMapWriterFactory::write(map,
      "test-output/io/ServiceOsmApiDbReaderTest/runReadByBoundsTest.osm");
    HOOT_STR_EQUALS(
      TestUtils::readFile("test-files/io/ServiceOsmApiDbReaderTest/runReadByBoundsTest.osm"),
      TestUtils::readFile("test-output/io/ServiceOsmApiDbReaderTest/runReadByBoundsTest.osm"));

    //just want to make sure I can read against the same data twice in a row w/o crashing and also
    //make sure I don't get the same result again for a different bounds
    reader.setBoundingBox("-1,-1,1,1");
    map.reset(new OsmMap());
    reader.read(map);

    CPPUNIT_ASSERT_EQUAL(0, (int)map->getNodes().size());
    CPPUNIT_ASSERT_EQUAL(0, (int)map->getWays().size());
    CPPUNIT_ASSERT_EQUAL(0, (int)map->getRelations().size());

    reader.close();
  }
开发者ID:ngageoint,项目名称:hootenanny,代码行数:58,代码来源:ServiceOsmApiDbReaderTest.cpp


注:本文中的WayPtr::getTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。