本文整理汇总了C++中ConstElementPtr::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstElementPtr::getId方法的具体用法?C++ ConstElementPtr::getId怎么用?C++ ConstElementPtr::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstElementPtr
的用法示例。
在下文中一共展示了ConstElementPtr::getId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Handle<Value> ElementJs::getId(const Arguments& args) {
HandleScope scope;
ConstElementPtr e = ObjectWrap::Unwrap<ElementJs>(args.This())->getConstElement();
return scope.Close(v8::Integer::New(e->getId()));
}
示例2: visit
void PertyRemoveRandomElementVisitor::visit(const ConstElementPtr& e)
{
boost::uniform_real<> uni(0.0, 1.0);
if (uni(*_rng) <= _p)
{
RecursiveElementRemover(ElementId(e->getElementType(), e->getId())).apply(_map->shared_from_this());
}
}
示例3: _getUpdateValuesWayOrRelationStr
QString OsmApiDbSqlChangesetFileWriter::_getUpdateValuesWayOrRelationStr(ConstElementPtr element) const
{
return
QString("changeset_id=%2, visible=%3, \"timestamp\"=%5, version=%4 WHERE id=%1;\n")
.arg(element->getId())
.arg(element->getChangeset())
.arg(_getVisibleStr(element->getVisible()))
.arg(element->getVersion())
.arg(OsmApiDb::TIMESTAMP_FUNCTION);
}
示例4: visit
void FindIntersectionsVisitor::visit(const ConstElementPtr& e)
{
shared_ptr<NodeToWayMap> n2w = _map->getIndex().getNodeToWayMap();
long id = e->getId();
const set<long>& wids = n2w->getWaysByNode(id);
// find all ways that are highways (ie roads)
set<long> hwids;
for (set<long>::const_iterator it = wids.begin(); it != wids.end(); ++it)
{
shared_ptr<Way> w = _map->getWay(*it);
if (OsmSchema::getInstance().isLinearHighway(w->getTags(), w->getElementType()))
{
hwids.insert(*it);
}
}
if (hwids.size() >= 3) // two or more roads intersting
{
// keep it
_ids.push_back(id);
_map->getNode(id)->setTag("IntersectionWayCount", QString::number(hwids.size()));
vector<Radians> angles = NodeMatcher::calculateAngles(_map, id, hwids, 10);
vector<double> v;
for (uint i = 0; i < angles.size(); i++)
{
v.push_back(toDegrees(angles[i])+180);
}
sort(v.begin(), v.end());
double minAngle = 360.;
double maxAngle = 0.;
for (uint i = 0; i < v.size(); i++)
{
double a = (i == 0) ? (v[i] + 360 - v[v.size()-1]) : v[i] - v[i-1];
if (a < minAngle)
{
minAngle = a;
}
if (a > maxAngle)
{
maxAngle = a;
}
}
_map->getNode(id)->setTag("MinAngle", QString::number(minAngle));
_map->getNode(id)->setTag("MaxAngle", QString::number(maxAngle));
}
}
示例5: visit
void DecomposeBuildingRelationsVisitor::visit(const ConstElementPtr& e)
{
if (e->getElementType() == ElementType::Relation)
{
const shared_ptr<Relation>& r = _map->getRelation(e->getId());
if (r->getType() == "building")
{
_decomposeBuilding(r);
}
}
}
示例6: _getInsertValuesWayOrRelationStr
QString OsmApiDbSqlChangesetFileWriter::_getInsertValuesWayOrRelationStr(ConstElementPtr element) const
{
return
QString("changeset_id, visible, \"timestamp\", "
"version) VALUES (%1, %2, %3, %5, %4);\n")
.arg(element->getId())
.arg(element->getChangeset())
.arg(_getVisibleStr(element->getVisible()))
.arg(element->getVersion())
.arg(OsmApiDb::TIMESTAMP_FUNCTION);
}
示例7: visit
void KeepBuildingsVisitor::visit(const ConstElementPtr& e)
{
ElementType type = e->getElementType();
long id = e->getId();
if (type != ElementType::Node)
{
boost::shared_ptr<Element> ee = _map->getElement(type, id);
if (BuildingCriterion().isSatisfied(ee->getTags(), type) == false)
{
RemoveElementOp::removeElementNoCheck(_map->shared_from_this(), e->getElementId());
}
}
}
示例8: visit
void KeepBuildingsVisitor::visit(const ConstElementPtr& e)
{
ElementType type = e->getElementType();
long id = e->getId();
if (type != ElementType::Node)
{
shared_ptr<Element> ee = _map->getElement(type, id);
if (OsmSchema::getInstance().isBuilding(ee->getTags(), type) == false)
{
// @todo This could do bad things if the element is in use.
_map->removeElementNoCheck(type, id);
}
}
}
示例9: visit
void RemoveElementsVisitor::visit(const ConstElementPtr& e)
{
assert(_filter);
ElementType type = e->getElementType();
long id = e->getId();
const shared_ptr<Element>& ee = _map->getElement(type, id);
if (_filter->isSatisfied(ee))
{
if (_recursive)
{
RecursiveElementRemover(ee->getElementId()).apply(_map->shared_from_this());
}
else
{
_map->removeElement(ElementId(type, id));
}
}
}
示例10: IllegalArgumentException
void RemoveRef2Visitor::visit(const ConstElementPtr& e)
{
if (!_criterion)
{
throw IllegalArgumentException("You must specify a criterion before calling "
"RemoveRef2Visitor.");
}
ElementType type = e->getElementType();
long id = e->getId();
ElementPtr ee = _map->getElement(ElementId(type, id));
// if e has a REF2 and meets the criterion
if (_hasRef2Tag(ee) && _criterion->isSatisfied(ee))
{
// go through each REF2 and evaluate for deletion
for (int i = 0; i < _ref2Keys.size(); i++)
{
_checkAndDeleteRef2(ee, _ref2Keys[i]);
}
}
}
示例11: _deleteExistingElement
void OsmApiDbSqlChangesetFileWriter::_deleteExistingElement(ConstElementPtr element)
{
const QString elementIdStr = QString::number(element->getId());
const QString elementTypeStr = element->getElementType().toString().toLower();
ElementPtr changeElement = _getChangeElement(element);
const long currentVersion = changeElement->getVersion();
const long newVersion = currentVersion + 1;
changeElement->setVersion(newVersion);
changeElement->setVisible(false);
changeElement->setChangeset(_changesetId);
LOG_TRACE("Deleting: " << changeElement->getElementId());
QString note = "";
LOG_VART(changeElement->getId());
LOG_VART(note);
LOG_VART(changeElement->getVersion());
QString commentStr = "/* delete " + elementTypeStr + " " + QString::number(changeElement->getId());
commentStr += "*/\n";
_outputSql.write((commentStr).toUtf8());
//OSM API DB keeps history for all elements, so the existing element in the master table is not
//modified and a new record is added with the updated version and visible set to false
_outputSql.write(("INSERT INTO " + elementTypeStr + "s (" + elementTypeStr + "_id, " +
_getInsertValuesStr(changeElement)).toUtf8());
_deleteCurrentTags(changeElement->getElementId());
switch (changeElement->getElementType().getEnum())
{
case ElementType::Node:
_outputSql.write(
("DELETE FROM " + ApiDb::getCurrentWayNodesTableName() +
" WHERE node_id=" + elementIdStr + ";\n").toUtf8());
_outputSql.write(
("DELETE FROM " + ApiDb::getCurrentRelationMembersTableName() +
" WHERE member_type = 'Node' AND member_id = " +
elementIdStr + ";\n").toUtf8());
break;
case ElementType::Way:
//all of its entries in current way nodes are removed
_outputSql.write(
("DELETE FROM " + ApiDb::getCurrentWayNodesTableName() +
" WHERE way_id=" + elementIdStr + ";\n").toUtf8());
_outputSql.write(
("DELETE FROM " + ApiDb::getCurrentRelationMembersTableName() +
" WHERE member_type = 'Way' AND member_id = " +
elementIdStr + ";\n").toUtf8());
break;
case ElementType::Relation:
_outputSql.write(
("DELETE FROM " + ApiDb::getCurrentRelationMembersTableName() +
" WHERE relation_id=" + elementIdStr + ";\n").toUtf8());
_outputSql.write(
("DELETE FROM " + ApiDb::getCurrentRelationMembersTableName() +
" WHERE member_type = 'Relation' AND member_id = " +
elementIdStr + ";\n").toUtf8());
break;
default:
throw HootException("Unknown element type");
}
//in the current table, the element isn't deleted but set to be invisible
const QString values =
QString("changeset_id=%1, visible=%2, version=%3 WHERE id=%4;\n")
.arg(changeElement->getChangeset())
.arg(_getVisibleStr(changeElement->getVisible()))
.arg(changeElement->getVersion())
.arg(changeElement->getId());
_outputSql.write(("UPDATE current_" + elementTypeStr + "s SET " + values).toUtf8());
}