本文整理汇总了C++中SUMOSAXAttributes::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ SUMOSAXAttributes::getInt方法的具体用法?C++ SUMOSAXAttributes::getInt怎么用?C++ SUMOSAXAttributes::getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SUMOSAXAttributes
的用法示例。
在下文中一共展示了SUMOSAXAttributes::getInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: busL
void
AGActivityGenHandler::parseBusLine(const SUMOSAXAttributes& attrs) {
try {
myCurrentObject = "busLine";
AGBusLine busL(attrs.getString(SUMO_ATTR_ID));
busL.setMaxTripTime(attrs.getInt(AGEN_ATTR_MAX_TRIP_DURATION));
myCity.busLines.push_front(busL);
currentBusLine = &*myCity.busLines.begin();
} catch (const std::exception& e) {
WRITE_ERROR("Error while parsing the element " +
SUMOXMLDefinitions::Tags.getString(AGEN_TAG_BUSLINE) + ": " +
e.what());
throw ProcessError();
}
}
示例2: posi
void
AGActivityGenHandler::parseBusStation(const SUMOSAXAttributes& attrs) {
try {
std::string edge = attrs.getString(SUMO_ATTR_EDGE);
SUMOReal positionOnEdge = attrs.getFloat(SUMO_ATTR_POSITION);
int id = attrs.getInt(SUMO_ATTR_ID);
AGPosition posi(myCity.getStreet(edge), positionOnEdge);
myCity.statData.busStations.insert(std::pair<int, AGPosition>(id, posi));
} catch (const std::exception& e) {
WRITE_ERROR("Error while parsing the element " +
SUMOXMLDefinitions::Tags.getString(AGEN_TAG_BUSSTATION) + ": " +
e.what());
throw ProcessError();
}
}
示例3: iss
void
MSStateHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) {
MSVehicleControl& vc = MSNet::getInstance()->getVehicleControl();
switch (element) {
case SUMO_TAG_SNAPSHOT: {
myTime = attrs.getInt(SUMO_ATTR_TIME);
const std::string& version = attrs.getString(SUMO_ATTR_VERSION);
if (version != VERSION_STRING) {
WRITE_WARNING("State was written with sumo version " + version + " (present: " + VERSION_STRING + ")!");
}
break;
}
case SUMO_TAG_DELAY: {
vc.setState(attrs.getInt(SUMO_ATTR_NUMBER), attrs.getInt(SUMO_ATTR_END),
attrs.getFloat(SUMO_ATTR_DEPART), attrs.getFloat(SUMO_ATTR_TIME));
break;
}
case SUMO_TAG_ROUTE: {
const std::string id = attrs.getString(SUMO_ATTR_ID);
if (MSRoute::dictionary(id) == 0) {
MSEdgeVector edges;
MSEdge::parseEdgesList(attrs.getString(SUMO_ATTR_EDGES), edges, id);
MSRoute* r = new MSRoute(id, edges, attrs.getBool(SUMO_ATTR_STATE),
0, std::vector<SUMOVehicleParameter::Stop>());
MSRoute::dictionary(id, r);
}
break;
}
case SUMO_TAG_ROUTE_DISTRIBUTION: {
const std::string id = attrs.getString(SUMO_ATTR_ID);
if (MSRoute::dictionary(id) == 0) {
RandomDistributor<const MSRoute*>* dist = new RandomDistributor<const MSRoute*>();
std::vector<std::string> routeIDs;
std::istringstream iss(attrs.getString(SUMO_ATTR_PROBS));
SUMOSAXAttributes::parseStringVector(attrs.getString(SUMO_ATTR_ROUTES), routeIDs);
for (std::vector<std::string>::const_iterator it = routeIDs.begin(); it != routeIDs.end(); ++it) {
SUMOReal prob;
iss >> prob;
const MSRoute* r = MSRoute::dictionary(*it);
assert(r != 0);
dist->add(prob, r, false);
r->addReference();
}
MSRoute::dictionary(id, dist, attrs.getBool(SUMO_ATTR_STATE));
}
break;
}
case SUMO_TAG_VTYPE: {
myCurrentVType = SUMOVehicleParserHelper::beginVTypeParsing(attrs, getFileName());
break;
}
case SUMO_TAG_VTYPE_DISTRIBUTION: {
const std::string id = attrs.getString(SUMO_ATTR_ID);
if (vc.getVType(id) == 0) {
RandomDistributor<MSVehicleType*>* dist = new RandomDistributor<MSVehicleType*>();
std::vector<std::string> typeIDs;
std::istringstream iss(attrs.getString(SUMO_ATTR_PROBS));
SUMOSAXAttributes::parseStringVector(attrs.getString(SUMO_ATTR_VTYPES), typeIDs);
for (std::vector<std::string>::const_iterator it = typeIDs.begin(); it != typeIDs.end(); ++it) {
SUMOReal prob;
iss >> prob;
MSVehicleType* t = vc.getVType(*it);
assert(t != 0);
dist->add(prob, t, false);
}
vc.addVTypeDistribution(id, dist);
}
break;
}