本文整理汇总了C++中SUMOSAXAttributes::getStringVector方法的典型用法代码示例。如果您正苦于以下问题:C++ SUMOSAXAttributes::getStringVector方法的具体用法?C++ SUMOSAXAttributes::getStringVector怎么用?C++ SUMOSAXAttributes::getStringVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUMOSAXAttributes
的用法示例。
在下文中一共展示了SUMOSAXAttributes::getStringVector方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessError
void
RONetHandler::parseDistrict(const SUMOSAXAttributes& attrs) {
myCurrentEdge = 0;
bool ok = true;
myCurrentName = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
if (!ok) {
return;
}
ROEdge* sink = myEdgeBuilder.buildEdge(myCurrentName + "-sink", 0, 0, 0);
sink->setType(ROEdge::ET_DISTRICT);
myNet.addEdge(sink);
ROEdge* source = myEdgeBuilder.buildEdge(myCurrentName + "-source", 0, 0, 0);
source->setType(ROEdge::ET_DISTRICT);
myNet.addEdge(source);
if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
std::vector<std::string> desc = attrs.getStringVector(SUMO_ATTR_EDGES);
for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
ROEdge* edge = myNet.getEdge(*i);
// check whether the edge exists
if (edge == 0) {
throw ProcessError("The edge '" + *i + "' within district '" + myCurrentName + "' is not known.");
}
source->addFollower(edge);
edge->addFollower(sink);
}
}
}
示例2:
void
NIImporter_SUMO::addRoundabout(const SUMOSAXAttributes& attrs) {
if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
myRoundabouts.push_back(attrs.getStringVector(SUMO_ATTR_EDGES));
} else {
WRITE_ERROR("Empty edges in roundabout.");
}
}
示例3: InvalidArgument
void
NLHandler::addDistrict(const SUMOSAXAttributes& attrs) {
bool ok = true;
myCurrentIsBroken = false;
// get the id, report an error if not given or empty...
myCurrentDistrictID = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
if (!ok) {
myCurrentIsBroken = true;
return;
}
try {
MSEdge* sink = myEdgeControlBuilder.buildEdge(myCurrentDistrictID + "-sink", MSEdge::EDGEFUNCTION_DISTRICT);
if (!MSEdge::dictionary(myCurrentDistrictID + "-sink", sink)) {
delete sink;
throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "-sink' exists.");
}
sink->initialize(new std::vector<MSLane*>());
MSEdge* source = myEdgeControlBuilder.buildEdge(myCurrentDistrictID + "-source", MSEdge::EDGEFUNCTION_DISTRICT);
if (!MSEdge::dictionary(myCurrentDistrictID + "-source", source)) {
delete source;
throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "-source' exists.");
}
source->initialize(new std::vector<MSLane*>());
if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
std::vector<std::string> desc = attrs.getStringVector(SUMO_ATTR_EDGES);
for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
MSEdge* edge = MSEdge::dictionary(*i);
// check whether the edge exists
if (edge == 0) {
throw InvalidArgument("The edge '" + *i + "' within district '" + myCurrentDistrictID + "' is not known.");
}
source->addFollower(edge);
edge->addFollower(sink);
}
}
if (attrs.hasAttribute(SUMO_ATTR_SHAPE)) {
PositionVector shape = attrs.get<PositionVector>(SUMO_ATTR_SHAPE, myCurrentDistrictID.c_str(), ok);
if (shape.size() != 0) {
if (!myNet.getShapeContainer().addPolygon(myCurrentDistrictID, "taz", RGBColor::parseColor("1.0,.33,.33"), 0, 0, "", shape, false)) {
WRITE_WARNING("Skipping visualization of taz '" + myCurrentDistrictID + "', polygon already exists.");
}
}
}
} catch (InvalidArgument& e) {
WRITE_ERROR(e.what());
myCurrentIsBroken = true;
}
}
示例4:
void
NLHandler::addRoundabout(const SUMOSAXAttributes& attrs) {
if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
std::vector<std::string> edgeIDs = attrs.getStringVector(SUMO_ATTR_EDGES);
for (std::vector<std::string>::iterator it = edgeIDs.begin(); it != edgeIDs.end(); ++it) {
MSEdge* edge = MSEdge::dictionary(*it);
if (edge == 0) {
WRITE_ERROR("Unknown edge '" + (*it) + "' in roundabout");
} else {
edge->markAsRoundabout();
}
}
} else {
WRITE_ERROR("Empty edges in roundabout.");
}
}
示例5:
void
RONetHandler::parseDistrict(const SUMOSAXAttributes& attrs) {
myCurrentEdge = 0;
bool ok = true;
myCurrentName = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
if (!ok) {
return;
}
myNet.addDistrict(myCurrentName, myEdgeBuilder.buildEdge(myCurrentName + "-source", 0, 0, 0), myEdgeBuilder.buildEdge(myCurrentName + "-sink", 0, 0, 0));
if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
std::vector<std::string> desc = attrs.getStringVector(SUMO_ATTR_EDGES);
for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
myNet.addDistrictEdge(myCurrentName, *i, true);
myNet.addDistrictEdge(myCurrentName, *i, false);
}
}
}
示例6:
void
NIXMLEdgesHandler::addRoundabout(const SUMOSAXAttributes& attrs) {
if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
std::vector<std::string> edgeIDs = attrs.getStringVector(SUMO_ATTR_EDGES);
EdgeSet roundabout;
for (std::vector<std::string>::iterator it = edgeIDs.begin(); it != edgeIDs.end(); ++it) {
NBEdge* edge = myEdgeCont.retrieve(*it);
if (edge == 0) {
if (!myEdgeCont.wasIgnored(*it)) {
WRITE_ERROR("Unknown edge '" + (*it) + "' in roundabout");
}
} else {
roundabout.insert(edge);
}
}
myEdgeCont.addRoundabout(roundabout);
} else {
WRITE_ERROR("Empty edges in roundabout.");
}
}
示例7: InvalidArgument
void
NLHandler::addDistrict(const SUMOSAXAttributes& attrs) {
bool ok = true;
myCurrentIsBroken = false;
// get the id, report an error if not given or empty...
myCurrentDistrictID = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok);
if (!ok) {
myCurrentIsBroken = true;
return;
}
try {
MSEdge* sink = myEdgeControlBuilder.buildEdge(myCurrentDistrictID + "-sink", MSEdge::EDGEFUNCTION_DISTRICT);
if (!MSEdge::dictionary(myCurrentDistrictID + "-sink", sink)) {
delete sink;
throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "-sink' exists.");
}
sink->initialize(new std::vector<MSLane*>());
MSEdge* source = myEdgeControlBuilder.buildEdge(myCurrentDistrictID + "-source", MSEdge::EDGEFUNCTION_DISTRICT);
if (!MSEdge::dictionary(myCurrentDistrictID + "-source", source)) {
delete source;
throw InvalidArgument("Another edge with the id '" + myCurrentDistrictID + "-source' exists.");
}
source->initialize(new std::vector<MSLane*>());
if (attrs.hasAttribute(SUMO_ATTR_EDGES)) {
std::vector<std::string> desc = attrs.getStringVector(SUMO_ATTR_EDGES);
for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
MSEdge* edge = MSEdge::dictionary(*i);
// check whether the edge exists
if (edge == 0) {
throw InvalidArgument("The edge '" + *i + "' within district '" + myCurrentDistrictID + "' is not known.");
}
source->addFollower(edge);
edge->addFollower(sink);
}
}
} catch (InvalidArgument& e) {
WRITE_ERROR(e.what());
myCurrentIsBroken = true;
}
}