本文整理汇总了C++中TagMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ TagMap::end方法的具体用法?C++ TagMap::end怎么用?C++ TagMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagMap
的用法示例。
在下文中一共展示了TagMap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StoreRelation
void OsmXmlEncodeBase::StoreRelation(int64_t objId, const class MetaData &metaData, const TagMap &tags,
const std::vector<std::string> &refTypeStrs, const std::vector<int64_t> &refIds,
const std::vector<std::string> &refRoles)
{
if(refTypeStrs.size() != refIds.size() || refTypeStrs.size() != refRoles.size())
throw std::invalid_argument("Length of ref vectors must be equal");
stringstream ss;
ss << " <relation id=\""<<objId<<"\"";
this->EncodeMetaData(metaData, ss);
if(tags.size() == 0 && refTypeStrs.size() == 0)
ss <<" />" << endl;
else
{
ss <<">" << endl;
//Write node IDs
for(size_t i=0; i<refTypeStrs.size(); i++)
ss << " <member type=\""<<escapexml(refTypeStrs[i])<<"\" ref=\""<<refIds[i]<<"\" role=\""<<escapexml(refRoles[i])<<"\" />" << endl;
//Write tags
for(TagMap::const_iterator it=tags.begin(); it!=tags.end(); it++)
ss << " <tag k=\""<<escapexml(it->first)<<"\" v=\""<<escapexml(it->second)<<"\" />" << endl;
ss << " </relation>" << endl;
}
*this << ss.str();
}
示例2: EncodeZigzag
void O5mEncodeBase::StoreNode(int64_t objId, const class MetaData &metaData,
const TagMap &tags, double latIn, double lonIn)
{
this->write("\x10",1);
//Object ID
std::stringstream tmpStream;
int64_t deltaId = objId - this->lastObjId;
tmpStream << EncodeZigzag(deltaId);
this->lastObjId = objId;
this->EncodeMetaData(metaData, tmpStream);
//Position
int64_t lon = round(lonIn * 1e7);
int64_t deltaLon = lon - this->lastLon;
tmpStream << EncodeZigzag(deltaLon);
this->lastLon = lon;
int64_t lat = round(latIn * 1e7);
int64_t deltaLat = lat - this->lastLat;
tmpStream << EncodeZigzag(deltaLat);
this->lastLat = lat;
for (TagMap::const_iterator it=tags.begin(); it != tags.end(); it++)
this->WriteStringPair(it->first, it->second, tmpStream);
std::string binData = tmpStream.str();
std::string len = EncodeVarint(binData.size());
*this << len;
*this << binData;
}
示例3: PrintTagMap
void PrintTagMap(const TagMap &tagMap)
{
for(TagMap::const_iterator it = tagMap.begin(); it != tagMap.end(); it++)
{
std::cout << it->first << "=" << it->second << std::endl;
}
}
示例4: extractTag
std::string PipelineReaderJSON::extractTag(Json::Value& node, TagMap& tags)
{
std::string tag;
if (node.isMember("tag"))
{
Json::Value& val = node["tag"];
if (!val.isNull())
{
if (val.isString())
{
tag = val.asString();
if (tags.find(tag) != tags.end())
throw pdal_error("JSON pipeline: duplicate tag '" +
tag + "'.");
}
else
throw pdal_error("JSON pipeline: tag must be "
"specified as a string.");
}
node.removeMember("tag");
if (node.isMember("tag"))
throw pdal_error("JSON pipeline: found duplicate 'tag' "
"entry in stage definition.");
std::string::size_type pos = 0;
if (!Stage::parseTagName(tag, pos) || pos != tag.size())
throw pdal_error("JSON pipeline: Invalid tag name '" + tag + "'. "
"Must start with letter. Remainder can be letters, "
"digits or underscores.");
}
return tag;
}
示例5: pdal_error
std::vector<Stage *> PipelineReaderJSON::extractInputs(Json::Value& node,
TagMap& tags)
{
std::vector<Stage *> inputs;
std::string filename;
if (node.isMember("inputs"))
{
Json::Value& val = node["filename"];
if (!val.isNull())
{
for (const Json::Value& input : node["inputs"])
{
if (input.isString())
{
std::string tag = input.asString();
auto ii = tags.find(tag);
if (ii == tags.end())
throw pdal_error("JSON pipeline: Invalid pipeline: "
"undefined stage tag '" + tag + "'.");
else
inputs.push_back(ii->second);
}
else
throw pdal_error("JSON pipeline: 'inputs' tag must "
" be specified as a string.");
}
}
node.removeMember("inputs");
if (node.isMember("inputs"))
throw pdal_error("JSON pipeline: found duplicate 'inputs' "
"entry in stage definition.");
}
return inputs;
}
示例6: extractTag
std::string PipelineReaderJSON::extractTag(Json::Value& node, TagMap& tags)
{
std::string tag;
if (node.isMember("tag"))
{
Json::Value& val = node["tag"];
if (!val.isNull())
{
if (val.isString())
{
tag = val.asString();
if (tags.find(tag) != tags.end())
throw pdal_error("JSON pipeline: duplicate tag '" +
tag + "'.");
}
else
throw pdal_error("JSON pipeline: 'tag' must be "
"specified as a string.");
}
node.removeMember("tag");
if (node.isMember("tag"))
throw pdal_error("JSON pipeline: found duplicate 'tag' "
"entry in stage definition.");
}
return tag;
}
示例7: Evaluate
bool TagIsInCondition::Evaluate(const TagMap& tagMap) const
{
auto t=tagMap.find(tag);
if (t==tagMap.end()) {
return false;
}
return tagValues.find(t->second)!=tagValues.end();
}
示例8: handleInputTag
void PipelineReaderJSON::handleInputTag(const std::string& tag,
const TagMap& tags, std::vector<Stage *>& inputs)
{
auto ii = tags.find(tag);
if (ii == tags.end())
throw pdal_error("JSON pipeline: Invalid pipeline: "
"undefined stage tag '" + tag + "'.");
else
inputs.push_back(ii->second);
}
示例9: WriteStart
void OsmXmlEncodeBase::WriteStart(const TagMap &customAttribs)
{
*this << "<?xml version='1.0' encoding='UTF-8'?>\n";
*this << "<osm";
TagMap::const_iterator it = customAttribs.find("version");
if(it != customAttribs.end())
{
*this << " version=\"";
*this << escapexml(it->second);
*this << "\"";
}
else
*this << " version=\"0.6\"";
it = customAttribs.find("generator");
if(it != customAttribs.end())
{
*this << " generator=\"";
*this << escapexml(it->second);
*this << "\"";
}
else
*this << " generator=\"cppo5m\"";
for(it = customAttribs.begin(); it != customAttribs.end(); it++)
{
if(it->first == "version" || it->first == "generator")
continue;
if(it->second.length() == 0)
continue;
*this << " ";
*this << escapexml(it->first);
*this <<"=\"";
*this << escapexml(it->second);
*this <<"\"";
}
*this << ">\n";
}
示例10: if
bool Preprocess::Callback::IsTurnRestriction(const TagMap& tags,
TurnRestriction::Type& type) const
{
auto typeValue=tags.find(typeConfig->tagType);
if (typeValue==tags.end()) {
return false;
}
if (typeValue->second!="restriction") {
return false;
}
auto restrictionValue=tags.find(typeConfig->tagRestriction);
if (restrictionValue==tags.end()) {
return false;
}
type=TurnRestriction::Allow;
if (restrictionValue->second=="only_left_turn" ||
restrictionValue->second=="only_right_turn" ||
restrictionValue->second=="only_straight_on") {
type=TurnRestriction::Allow;
return true;
}
else if (restrictionValue->second=="no_left_turn" ||
restrictionValue->second=="no_right_turn" ||
restrictionValue->second=="no_straight_on" ||
restrictionValue->second=="no_u_turn") {
type=TurnRestriction::Forbit;
return true;
}
return false;
}
示例11: GetName
std::string ImportErrorReporter::GetName(const ObjectOSMRef& object,
const TagMap& tags) const
{
std::stringstream buffer;
buffer << object.GetName();
if (nameTagId!=tagIgnore) {
const auto entry=tags.find(nameTagId);
if (entry!=tags.end()) {
buffer << " \"" << entry->second << "\"";
}
}
return buffer.str();
}
示例12:
bool Preprocess::Callback::IsMultipolygon(const TagMap& tags,
TypeInfoRef& type)
{
type=typeConfig->GetRelationType(tags);
if (type!=typeConfig->typeInfoIgnore &&
type->GetIgnore()) {
return false;
}
bool isArea=type!=typeConfig->typeInfoIgnore &&
type->GetMultipolygon();
if (!isArea) {
auto typeTag=tags.find(typeConfig->tagType);
isArea=typeTag!=tags.end() && typeTag->second=="multipolygon";
}
return isArea;
}
示例13: Tags
// ---------------------------------------------------------------------------
// EnvelopeReader Find
// ---------------------------------------------------------------------------
// May return NULL if no reader with the specified owner and index
// is found.
//
const EnvelopeReader *
EnvelopeReader::Find( INSDS * owner, int idx )
{
TagMap & readers = Tags();
TagMap::iterator it = readers.find( Tag( owner, idx ) );
if ( it != readers.end() )
{
#ifdef DEBUG_LORISGENS
std::cerr << "** found EnvelopeReader with owner " << owner << " and index " << idx;
std::cerr << " having " << it->second->size() << " envelopes." << std::endl;
#endif
return it->second;
}
else
{
#ifdef DEBUG_LORISGENS
std::cerr << "** could not find EnvelopeReader with owner " << owner << " and index " << idx << std::endl;
#endif
return NULL;
}
}
示例14: StoreNode
void OsmXmlEncodeBase::StoreNode(int64_t objId, const class MetaData &metaData,
const TagMap &tags, double lat, double lon)
{
stringstream ss;
ss.precision(9);
ss << " <node id=\""<<objId<<"\"";
this->EncodeMetaData(metaData, ss);
ss << fixed << " lat=\""<<lat<<"\" lon=\""<<lon<<"\"";
if(tags.size() == 0)
ss <<" />" << endl;
else
{
ss <<">" << endl;
//Write tags
for(TagMap::const_iterator it=tags.begin(); it!=tags.end(); it++)
{
ss << " <tag k=\""<<escapexml(it->first)<<"\" v=\""<<escapexml(it->second)<<"\" />" << endl;
}
ss << " </node>" << endl;
}
*this << ss.str();
}
示例15: StoreWay
void OsmXmlEncodeBase::StoreWay(int64_t objId, const class MetaData &metaData,
const TagMap &tags, const std::vector<int64_t> &refs)
{
stringstream ss;
ss << " <way id=\""<<objId<<"\"";
this->EncodeMetaData(metaData, ss);
if(tags.size() == 0 && refs.size() == 0)
ss <<" />" << endl;
else
{
ss <<">" << endl;
//Write node IDs
for(size_t i=0; i<refs.size(); i++)
ss << " <nd ref=\""<<refs[i]<<"\" />" << endl;
//Write tags
for(TagMap::const_iterator it=tags.begin(); it!=tags.end(); it++)
ss << " <tag k=\""<<escapexml(it->first)<<"\" v=\""<<escapexml(it->second)<<"\" />" << endl;
ss << " </way>" << endl;
}
*this << ss.str();
}