本文整理汇总了C++中WayPtr::getNodeId方法的典型用法代码示例。如果您正苦于以下问题:C++ WayPtr::getNodeId方法的具体用法?C++ WayPtr::getNodeId怎么用?C++ WayPtr::getNodeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WayPtr
的用法示例。
在下文中一共展示了WayPtr::getNodeId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _directConnect
bool WayMergeManipulation::_directConnect(const OsmMapPtr& map, WayPtr w) const
{
boost::shared_ptr<LineString> ls = ElementConverter(map).convertToLineString(w);
CoordinateSequence* cs = GeometryFactory::getDefaultInstance()->getCoordinateSequenceFactory()->
create(2, 2);
cs->setAt(map->getNode(w->getNodeId(0))->toCoordinate(), 0);
cs->setAt(map->getNode(w->getLastNodeId())->toCoordinate(), 1);
// create a straight line and buffer it
boost::shared_ptr<LineString> straight(GeometryFactory::getDefaultInstance()->createLineString(cs));
boost::shared_ptr<Geometry> g(straight->buffer(w->getCircularError()));
// is the way in question completely contained in the buffer?
return g->contains(ls.get());
}
示例2: verifyFullReadOutput
void verifyFullReadOutput(OsmMapPtr map)
{
//nodes
CPPUNIT_ASSERT_EQUAL(2, (int)map->getNodes().size());
HOOT_STR_EQUALS(true, map->containsNode(1));
NodePtr node = map->getNode(1);
CPPUNIT_ASSERT_EQUAL((long)1, node->getId());
CPPUNIT_ASSERT_EQUAL(38.4, node->getY());
CPPUNIT_ASSERT_EQUAL(-106.5, node->getX());
CPPUNIT_ASSERT_EQUAL(15.0, node->getCircularError());
CPPUNIT_ASSERT_EQUAL(2, node->getTags().size());
NodePtr node1 = map->getNode(2);
CPPUNIT_ASSERT_EQUAL((long)2, node1->getId());
CPPUNIT_ASSERT_EQUAL(38.0, node1->getY());
CPPUNIT_ASSERT_EQUAL(-104.0, node1->getX());
//ways
HOOT_STR_EQUALS(true, map->containsWay(1));
WayPtr way = map->getWay(1);
CPPUNIT_ASSERT_EQUAL((long)1, way->getId());
CPPUNIT_ASSERT_EQUAL(2, (int)way->getNodeCount());
CPPUNIT_ASSERT_EQUAL((long)1, way->getNodeId(0));
CPPUNIT_ASSERT_EQUAL((long)2, way->getNodeId(1));
CPPUNIT_ASSERT_EQUAL(15.0, way->getCircularError());
CPPUNIT_ASSERT_EQUAL(1, way->getTags().size());
//relations
HOOT_STR_EQUALS(true, map->containsRelation(1));
RelationPtr relation = map->getRelation(1);
CPPUNIT_ASSERT_EQUAL((long)1, relation->getId());
vector<RelationData::Entry> relationData = relation->getMembers();
CPPUNIT_ASSERT_EQUAL(2, (int)relation->getMembers().size());
HOOT_STR_EQUALS("wayrole", relationData[0].getRole());
HOOT_STR_EQUALS("noderole",relationData[1].getRole());
CPPUNIT_ASSERT_EQUAL(15.0, relation->getCircularError());
}
示例3: _removeSpans
void WayMergeManipulation::_removeSpans(OsmMapPtr map,
set<ElementId>& impactedElements) const
{
WayPtr left = map->getWay(_left);
WayPtr right = map->getWay(_right);
set<ElementId> impactedWaysTmp = impactedElements;
for (set<ElementId>::iterator it = impactedWaysTmp.begin(); it != impactedWaysTmp.end(); ++it)
{
ElementId eid = *it;
WayPtr w = map->getWay(eid.getId());
long first = w->getNodeId(0);
long last = w->getLastNodeId();
if ((left->hasNode(first) && right->hasNode(last)) ||
(left->hasNode(last) && right->hasNode(first)))
{
if (_directConnect(map, w))
{
RemoveWayOp::removeWay(map, eid.getId());
impactedElements.erase(eid);
}
}
}
}
示例4: randomSplitDistribution
vector<ElementPtr> PertyWaySplitVisitor::_split(ElementPtr element)
{
//randomly select elements and split them into two parts
boost::uniform_real<> randomSplitDistribution(0.0, 1.0);
const double randomSplitNum = randomSplitDistribution(*_rng);
if (randomSplitNum <= _waySplitProbability)
{
LOG_TRACE("element " << element->getElementId() << " *will* be split based on a split " <<
"probability of: " << _waySplitProbability << " and a randomly generated number: " <<
randomSplitNum << "\n");
_splitRecursionLevel++;
LOG_VART(_splitRecursionLevel);
const int numNodesBeforeSplit = _map->getNodes().size();
LOG_VART(numNodesBeforeSplit);
const int numWaysBeforeSplit = _map->getWays().size();
LOG_VART(numWaysBeforeSplit);
WayLocation waySplitPoint;
MultiLineStringLocation multiLineSplitPoint;
QList<long> nodeIdsBeforeSplit;
int segmentIndex = -1;
ElementId wayId;
//determine where to split the element
if (element->getElementType() == ElementType::Way)
{
WayPtr way = boost::dynamic_pointer_cast<Way>(element);
LOG_VART(way->getNodeCount());
nodeIdsBeforeSplit = QVector<long>::fromStdVector(way->getNodeIds()).toList();
LOG_VART(nodeIdsBeforeSplit);
waySplitPoint = _calcSplitPoint(way);
}
else
{
multiLineSplitPoint = _calcSplitPoint(boost::dynamic_pointer_cast<Relation>(element), wayId);
waySplitPoint = multiLineSplitPoint.getWayLocation();
}
const QString distanceMsgStrEnd =
QString("a minimum node spacing of ")
.append(QString::number(_minNodeSpacing))
.append(" meters");
if (!waySplitPoint.isValid())
{
_splitRecursionLevel--;
LOG_VART(_splitRecursionLevel);
LOG_TRACE("split point *will not* be used because *it violates* " << distanceMsgStrEnd);
//if it violates the min node spacing, return an empty element collection, which will end the
//recursive splitting on the current way
return vector<ElementPtr>();
}
else
{
LOG_TRACE("split point *will* be used because it *does not* violate " << distanceMsgStrEnd);
segmentIndex = waySplitPoint.getSegmentIndex();
LOG_VART(segmentIndex);
}
//split the element
vector<ElementPtr> newElementsAfterSplit;
if (element->getElementType() == ElementType::Way)
{
vector<WayPtr> newWaysAfterSplit =
WaySplitter::split(_map->shared_from_this(),
boost::dynamic_pointer_cast<Way>(element), waySplitPoint);
for (size_t i = 0; i < newWaysAfterSplit.size(); i++)
{
newElementsAfterSplit.push_back(newWaysAfterSplit.at(i));
}
}
else
{
ElementPtr match;
MultiLineStringSplitter().split(_map->shared_from_this(), multiLineSplitPoint, match);
newElementsAfterSplit.push_back(match);
}
const int numNodesAfterSplit = _map->getNodes().size();
LOG_VART(numNodesAfterSplit);
const int numNewNodesCreatedBySplit = numNodesAfterSplit - numNodesBeforeSplit;
LOG_VART(numNewNodesCreatedBySplit);
LOG_VART(_map->getWays().size());
if (numNewNodesCreatedBySplit > 0)
{
WayPtr way = boost::dynamic_pointer_cast<Way>(element);
//Its possible that the splitting of a relation could generate a new node. In that case,
//_updateNewNodeProperties does not need to be called b/c the MultiLineStringSplitter has
//already properly updated the new node's properties. when a way is split, however, the
//new node's properties must be updated by the call to _updateNewNodeProperties.
if (way != 0)
{
assert(nodeIdsBeforeSplit.size() > 0);
//update properties on any nodes added as a result of the way splitting (new ways created as a
//result of the splitting will already have had their parent's tags added by WaySplitter)
_updateNewNodeProperties(
_getNodeAddedBySplit(nodeIdsBeforeSplit, newElementsAfterSplit),
_map->getNode(way->getNodeId(segmentIndex)),
//.........这里部分代码省略.........