本文整理汇总了C++中OptionsCont::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionsCont::getString方法的具体用法?C++ OptionsCont::getString怎么用?C++ OptionsCont::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionsCont
的用法示例。
在下文中一共展示了OptionsCont::getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MESegment
void
MELoop::buildSegmentsFor(const MSEdge& e, const OptionsCont& oc) {
const SUMOReal length = e.getLength();
int no = numSegmentsFor(length, oc.getFloat("meso-edgelength"));
const SUMOReal slength = length / (SUMOReal)no;
const SUMOReal lengthGeometryFactor = e.getLanes()[0]->getLengthGeometryFactor();
MESegment* newSegment = 0;
MESegment* nextSegment = 0;
bool multiQueue = oc.getBool("meso-multi-queue");
bool junctionControl = oc.getBool("meso-junction-control");
for (int s = no - 1; s >= 0; s--) {
std::string id = e.getID() + ":" + toString(s);
newSegment =
new MESegment(id, e, nextSegment, slength,
e.getLanes()[0]->getSpeedLimit(), s,
string2time(oc.getString("meso-tauff")), string2time(oc.getString("meso-taufj")),
string2time(oc.getString("meso-taujf")), string2time(oc.getString("meso-taujj")),
oc.getFloat("meso-jam-threshold"), multiQueue, junctionControl,
lengthGeometryFactor);
multiQueue = false;
junctionControl = false;
nextSegment = newSegment;
}
while (e.getNumericalID() >= static_cast<int>(myEdges2FirstSegments.size())) {
myEdges2FirstSegments.push_back(0);
}
myEdges2FirstSegments[e.getNumericalID()] = newSegment;
}
示例2: loader
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods (interface in this case)
// ---------------------------------------------------------------------------
void
NIImporter_ArcView::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
if (!oc.isSet("shapefile-prefix")) {
return;
}
// check whether the correct set of entries is given
// and compute both file names
std::string dbf_file = oc.getString("shapefile-prefix") + ".dbf";
std::string shp_file = oc.getString("shapefile-prefix") + ".shp";
std::string shx_file = oc.getString("shapefile-prefix") + ".shx";
// check whether the files do exist
if (!FileHelpers::isReadable(dbf_file)) {
WRITE_ERROR("File not accessible: " + dbf_file);
}
if (!FileHelpers::isReadable(shp_file)) {
WRITE_ERROR("File not accessible: " + shp_file);
}
if (!FileHelpers::isReadable(shx_file)) {
WRITE_ERROR("File not accessible: " + shx_file);
}
if (MsgHandler::getErrorInstance()->wasInformed()) {
return;
}
// load the arcview files
NIImporter_ArcView loader(oc,
nb.getNodeCont(), nb.getEdgeCont(), nb.getTypeCont(),
dbf_file, shp_file, oc.getBool("speed-in-kmh"));
loader.load();
}
示例3:
void
MSFrame::setMSGlobals(OptionsCont& oc) {
// pre-initialise the network
// set whether empty edges shall be printed on dump
MSGlobals::gOmitEmptyEdgesOnDump = !oc.getBool("netstate-dump.empty-edges");
#ifdef HAVE_INTERNAL_LANES
// set whether internal lanes shall be used
MSGlobals::gUsingInternalLanes = !oc.getBool("no-internal-links");
#else
MSGlobals::gUsingInternalLanes = false;
#endif
// set the grid lock time
MSGlobals::gTimeToGridlock = string2time(oc.getString("time-to-teleport")) < 0 ? 0 : string2time(oc.getString("time-to-teleport"));
MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents");
MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors");
#ifdef HAVE_INTERNAL
MSGlobals::gStateLoaded = oc.isSet("load-state");
MSGlobals::gUseMesoSim = oc.getBool("mesosim");
MSGlobals::gMesoLimitedJunctionControl = oc.getBool("meso-junction-control.limited");
if (MSGlobals::gUseMesoSim) {
MSGlobals::gUsingInternalLanes = false;
}
#endif
#ifdef HAVE_SUBSECOND_TIMESTEPS
DELTA_T = string2time(oc.getString("step-length"));
#endif
if (oc.isSet("routeDist.maxsize")) {
MSRoute::setMaxRouteDistSize(oc.getInt("routeDist.maxsize"));
}
}
示例4:
// ===========================================================================
// method definitions
// ===========================================================================
PCTypeMap::PCTypeMap(const OptionsCont& oc) {
myDefaultType.id = oc.getString("type");
myDefaultType.color = RGBColor::parseColor(oc.getString("color"));
myDefaultType.layer = oc.getInt("layer");
myDefaultType.discard = oc.getBool("discard");
myDefaultType.allowFill = true;
myDefaultType.prefix = oc.getString("prefix");
}
示例5: writeHeader
void
NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec) {
std::map<const std::string, std::string> nameIDs;
OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_links_unsplitted.txt");
writeHeader(device, oc);
// write format specifier
device << "# LINK_ID\tNODE_ID_FROM\tNODE_ID_TO\tBETWEEN_NODE_ID\tLENGTH\tVEHICLE_TYPE\tFORM_OF_WAY\tBRUNNEL_TYPE\tFUNCTIONAL_ROAD_CLASS\tSPEED_CATEGORY\tNUMBER_OF_LANES\tSPEED_LIMIT\tSPEED_RESTRICTION\tNAME_ID1_REGIONAL\tNAME_ID2_LOCAL\tHOUSENUMBERS_RIGHT\tHOUSENUMBERS_LEFT\tZIP_CODE\tAREA_ID\tSUBAREA_ID\tTHROUGH_TRAFFIC\tSPECIAL_RESTRICTIONS\tEXTENDED_NUMBER_OF_LANES\tISRAMP\tCONNECTION\n";
// write edges
for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
NBEdge* e = (*i).second;
const int kph = speedInKph(e->getSpeed());
const std::string& betweenNodeID = (e->getGeometry().size() > 2) ? e->getID() : UNDEFINED;
std::string nameID = UNDEFINED;
if (oc.getBool("output.street-names")) {
const std::string& name = i->second->getStreetName();
if (name != "" && nameIDs.count(name) == 0) {
nameID = toString(nameIDs.size());
nameIDs[name] = nameID;
}
}
device << e->getID() << "\t"
<< e->getFromNode()->getID() << "\t"
<< e->getToNode()->getID() << "\t"
<< betweenNodeID << "\t"
<< getGraphLength(e) << "\t"
<< getAllowedTypes(e->getPermissions()) << "\t"
<< "3\t" // Speed Category 1-8 XXX refine this
<< UNDEFINED << "\t" // no special brunnel type (we don't know yet)
<< getRoadClass(e) << "\t"
<< getSpeedCategory(kph) << "\t"
<< getNavteqLaneCode(e->getNumLanes()) << "\t"
<< getSpeedCategoryUpperBound(kph) << "\t"
<< kph << "\t"
<< nameID << "\t" // NAME_ID1_REGIONAL XXX
<< UNDEFINED << "\t" // NAME_ID2_LOCAL XXX
<< UNDEFINED << "\t" // housenumbers_right
<< UNDEFINED << "\t" // housenumbers_left
<< UNDEFINED << "\t" // ZIP_CODE
<< UNDEFINED << "\t" // AREA_ID
<< UNDEFINED << "\t" // SUBAREA_ID
<< "1\t" // through_traffic (allowed)
<< UNDEFINED << "\t" // special_restrictions
<< UNDEFINED << "\t" // extended_number_of_lanes
<< UNDEFINED << "\t" // isRamp
<< "0\t" // connection (between nodes always in order)
<< "\n";
}
if (oc.getBool("output.street-names")) {
OutputDevice& namesDevice = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_names.txt");
writeHeader(namesDevice, oc);
// write format specifier
namesDevice << "# NAME_ID\tName\n" << nameIDs.size() << "\n";
for (std::map<const std::string, std::string>::const_iterator i = nameIDs.begin(); i != nameIDs.end(); ++i) {
namesDevice << i->second << "\t" << i->first << "\n";
}
}
}
示例6: builder
/**
* loads the net
* The net is in this meaning made up by the net itself and the dynamic
* weights which may be supplied in a separate file
*/
void
initNet(RONet& net, ROLoader& loader, OptionsCont& oc) {
// load the net
RODUAEdgeBuilder builder(oc.getBool("weights.expand"), oc.getBool("weights.interpolate"));
loader.loadNet(net, builder);
// load the weights when wished/available
if (oc.isSet("weight-files")) {
loader.loadWeights(net, "weight-files", oc.getString("weight-attribute"), false);
}
if (oc.isSet("lane-weight-files")) {
loader.loadWeights(net, "lane-weight-files", oc.getString("weight-attribute"), true);
}
}
示例7: writeHeader
void
NWWriter_DlrNavteq::writeConnectedLanes(const OptionsCont& oc, NBNodeCont& nc) {
OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_connected_lanes.txt");
writeHeader(device, oc);
// write format specifier
device << "#Lane connections related to LINK-IDs and NODE-ID.\n";
device << "#column format like pointcollection.\n";
device << "#NODE-ID\tVEHICLE-TYPE\tFROM_LANE\tTO_LANE\tTHROUGH_TRAFFIC\tLINK_IDs[2..*]\n";
// write record for every connection
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
NBNode* n = (*i).second;
const EdgeVector& incoming = n->getIncomingEdges();
for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
NBEdge* from = *j;
const SVCPermissions fromPerm = from->getPermissions();
const std::vector<NBEdge::Connection>& connections = from->getConnections();
for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
const NBEdge::Connection& c = *it_c;
device
<< n->getID() << "\t"
<< getAllowedTypes(fromPerm & c.toEdge->getPermissions()) << "\t"
<< c.fromLane + 1 << "\t" // one-based
<< c.toLane + 1 << "\t" // one-based
<< 1 << "\t" // no information regarding permissibility of through traffic
<< from->getID() << "\t"
<< c.toEdge->getID() << "\t"
<< "\n";
}
}
}
device.close();
}
示例8: provider
/**
* Computes the routes saving them
*/
void
computeRoutes(RONet& net, ROLoader& loader, OptionsCont& oc) {
// initialise the loader
loader.openRoutes(net);
// prepare the output
net.openOutput(oc);
// build the router
ROJTRRouter* router = new ROJTRRouter(oc.getBool("ignore-errors"), oc.getBool("accept-all-destinations"),
(int)(((double) net.getEdgeNumber()) * OptionsCont::getOptions().getFloat("max-edges-factor")),
oc.getBool("ignore-vclasses"), oc.getBool("allow-loops"));
RORouteDef::setUsingJTRR();
RORouterProvider provider(router, new PedestrianRouter<ROEdge, ROLane, RONode, ROVehicle>(),
new ROIntermodalRouter(RONet::adaptIntermodalRouter, 0));
loader.processRoutes(string2time(oc.getString("begin")), string2time(oc.getString("end")),
string2time(oc.getString("route-steps")), net, provider);
net.cleanup();
}
示例9: loader
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods (interface in this case)
// ---------------------------------------------------------------------------
void
NIImporter_Vissim::loadNetwork(const OptionsCont &oc, NBNetBuilder &nb) {
if (!oc.isSet("vissim")) {
return;
}
// load the visum network
NIImporter_Vissim loader(nb, oc.getString("vissim"));
loader.load(oc);
}
示例10: lr
void
ODMatrix::loadMatrix(OptionsCont& oc) {
std::vector<std::string> files = oc.getStringVector("od-matrix-files");
for (std::vector<std::string>::iterator i = files.begin(); i != files.end(); ++i) {
LineReader lr(*i);
if (!lr.good()) {
throw ProcessError("Could not open '" + (*i) + "'.");
}
std::string type = lr.readLine();
// get the type only
if (type.find(';') != std::string::npos) {
type = type.substr(0, type.find(';'));
}
// parse type-dependant
if (type.length() > 1 && type[1] == 'V') {
// process ptv's 'V'-matrices
if (type.find('N') != std::string::npos) {
throw ProcessError("'" + *i + "' does not contain the needed information about the time described.");
}
readV(lr, oc.getFloat("scale"), oc.getString("vtype"), type.find('M') != std::string::npos);
} else if (type.length() > 1 && type[1] == 'O') {
// process ptv's 'O'-matrices
if (type.find('N') != std::string::npos) {
throw ProcessError("'" + *i + "' does not contain the needed information about the time described.");
}
readO(lr, oc.getFloat("scale"), oc.getString("vtype"), type.find('M') != std::string::npos);
} else {
throw ProcessError("'" + *i + "' uses an unknown matrix type '" + type + "'.");
}
}
std::vector<std::string> amitranFiles = oc.getStringVector("od-amitran-files");
for (std::vector<std::string>::iterator i = amitranFiles.begin(); i != amitranFiles.end(); ++i) {
if (!FileHelpers::isReadable(*i)) {
throw ProcessError("Could not access matrix file '" + *i + "' to load.");
}
PROGRESS_BEGIN_MESSAGE("Loading matrix in Amitran format from '" + *i + "'");
ODAmitranHandler handler(*this, *i);
if (!XMLSubSys::runParser(handler, *i)) {
PROGRESS_FAILED_MESSAGE();
} else {
PROGRESS_DONE_MESSAGE();
}
}
}
示例11:
/**
* loads the net
* The net is in this meaning made up by the net itself and the dynamic
* weights which may be supplied in a separate file
*/
void
initNet(RONet &net, ROLoader &loader, OptionsCont &oc,
const std::vector<SUMOReal> &turnDefs) {
// load the net
ROJTREdgeBuilder builder;
loader.loadNet(net, builder);
// set the turn defaults
const std::map<std::string, ROEdge*> &edges = net.getEdgeMap();
for (std::map<std::string, ROEdge*>::const_iterator i=edges.begin(); i!=edges.end(); ++i) {
static_cast<ROJTREdge*>((*i).second)->setTurnDefaults(turnDefs);
}
// load the weights when wished/available
if (oc.isSet("weights")) {
loader.loadWeights(net, "weights", oc.getString("measure"), false);
}
if (oc.isSet("lane-weights")) {
loader.loadWeights(net, "lane-weights", oc.getString("measure"), true);
}
}
示例12: ProcessError
void
readDetectorFlows(RODFDetectorFlows& flows, OptionsCont& oc, RODFDetectorCon& dc) {
if (!oc.isSet("measure-files")) {
// ok, not given, return an empty container
return;
}
// check whether the file exists
std::vector<std::string> files = oc.getStringVector("measure-files");
for (std::vector<std::string>::const_iterator fileIt = files.begin(); fileIt != files.end(); ++fileIt) {
if (!FileHelpers::exists(*fileIt)) {
throw ProcessError("The measure-file '" + *fileIt + "' can not be opened.");
}
// parse
PROGRESS_BEGIN_MESSAGE("Loading flows from '" + *fileIt + "'");
RODFDetFlowLoader dfl(dc, flows, string2time(oc.getString("begin")), string2time(oc.getString("end")),
string2time(oc.getString("time-offset")), string2time(oc.getString("time-factor")));
dfl.read(*fileIt);
PROGRESS_DONE_MESSAGE();
}
}
示例13: idSupplier
void
NWWriter_DlrNavteq::writeProhibitedManoeuvres(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec) {
OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_prohibited_manoeuvres.txt");
writeHeader(device, oc);
// need to invent id for relation
std::set<std::string> reservedRelIDs;
if (oc.isSet("reserved-ids")) {
NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "rel:", reservedRelIDs);
}
std::vector<std::string> avoid = ec.getAllNames(); // already used for tls RELATREC_ID
avoid.insert(avoid.end(), reservedRelIDs.begin(), reservedRelIDs.end());
IDSupplier idSupplier("", avoid); // @note: use a global relRecIDsupplier if this is used more often
// write format specifier
device << "#No driving allowed from ID1 to ID2 or the complete chain from ID1 to IDn\n";
device << "#RELATREC_ID\tPERMANENT_ID_INFO\tVALIDITY_PERIOD\tTHROUGH_TRAFFIC\tVEHICLE_TYPE\tNAVTEQ_LINK_ID1\t[NAVTEQ_LINK_ID2 ...]\n";
// write record for every pair of incoming/outgoing edge that are not connected despite having common permissions
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
NBNode* n = (*i).second;
const EdgeVector& incoming = n->getIncomingEdges();
const EdgeVector& outgoing = n->getOutgoingEdges();
for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
NBEdge* inEdge = *j;
const SVCPermissions inPerm = inEdge->getPermissions();
for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); ++k) {
NBEdge* outEdge = *k;
const SVCPermissions outPerm = outEdge->getPermissions();
const SVCPermissions commonPerm = inPerm & outPerm;
if (commonPerm != 0 && commonPerm != SVC_PEDESTRIAN && !inEdge->isConnectedTo(outEdge)) {
device
<< idSupplier.getNext() << "\t"
<< 1 << "\t" // permanent id
<< UNDEFINED << "\t"
<< 1 << "\t"
<< getAllowedTypes(SVCAll) << "\t"
<< inEdge->getID() << "\t" << outEdge->getID() << "\n";
}
}
}
}
device.close();
}
示例14: toString
void
NWWriter_XML::writeNodes(const OptionsCont& oc, NBNodeCont& nc) {
const GeoConvHelper& gch = GeoConvHelper::getFinal();
bool useGeo = oc.exists("proj.plain-geo") && oc.getBool("proj.plain-geo");
if (useGeo && !gch.usingGeoProjection()) {
WRITE_WARNING("Ignoring option \"proj.plain-geo\" because no geo-conversion has been defined");
useGeo = false;
}
const bool geoAccuracy = useGeo || gch.usingInverseGeoProjection();
OutputDevice& device = OutputDevice::getDevice(oc.getString("plain-output-prefix") + ".nod.xml");
device.writeXMLHeader("nodes", NWFrame::MAJOR_VERSION + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/nodes_file.xsd\"");
// write network offsets and projection to allow reconstruction of original coordinates
if (!useGeo) {
NWWriter_SUMO::writeLocation(device);
}
// write nodes
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
NBNode* n = (*i).second;
device.openTag(SUMO_TAG_NODE);
device.writeAttr(SUMO_ATTR_ID, n->getID());
// write position
Position pos = n->getPosition();
if (useGeo) {
gch.cartesian2geo(pos);
}
if (geoAccuracy) {
device.setPrecision(GEO_OUTPUT_ACCURACY);
}
NWFrame::writePositionLong(pos, device);
if (geoAccuracy) {
device.setPrecision();
}
device.writeAttr(SUMO_ATTR_TYPE, toString(n->getType()));
if (n->isTLControlled()) {
const std::set<NBTrafficLightDefinition*>& tlss = n->getControllingTLS();
// set may contain multiple programs for the same id.
// make sure ids are unique and sorted
std::set<std::string> tlsIDs;
for (std::set<NBTrafficLightDefinition*>::const_iterator it_tl = tlss.begin(); it_tl != tlss.end(); it_tl++) {
tlsIDs.insert((*it_tl)->getID());
}
std::vector<std::string> sortedIDs(tlsIDs.begin(), tlsIDs.end());
sort(sortedIDs.begin(), sortedIDs.end());
device.writeAttr(SUMO_ATTR_TLID, sortedIDs);
}
device.closeTag();
}
device.close();
}
示例15: loader
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods (interface in this case)
// ---------------------------------------------------------------------------
void
NIImporter_VISUM::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
// check whether the option is set (properly)
if (!oc.isSet("visum-file")) {
return;
}
// build the handler
NIImporter_VISUM loader(nb, oc.getString("visum-file"),
NBCapacity2Lanes(oc.getFloat("lanes-from-capacity.norm")),
oc.getBool("visum.use-type-priority"));
loader.load();
}