本文整理汇总了C++中OptionsCont::getBool方法的典型用法代码示例。如果您正苦于以下问题:C++ OptionsCont::getBool方法的具体用法?C++ OptionsCont::getBool怎么用?C++ OptionsCont::getBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OptionsCont
的用法示例。
在下文中一共展示了OptionsCont::getBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nodesHandler
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// static methods
// ---------------------------------------------------------------------------
void
NIImporter_MATSim::loadNetwork(const OptionsCont& oc, NBNetBuilder& nb) {
// check whether the option is set (properly)
if (!oc.isSet("matsim-files")) {
return;
}
/* Parse file(s)
* Each file is parsed twice: first for nodes, second for edges. */
std::vector<std::string> files = oc.getStringVector("matsim-files");
// load nodes, first
NodesHandler nodesHandler(nb.getNodeCont());
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
// nodes
if (!FileHelpers::isReadable(*file)) {
WRITE_ERROR("Could not open matsim-file '" + *file + "'.");
return;
}
nodesHandler.setFileName(*file);
PROGRESS_BEGIN_MESSAGE("Parsing nodes from matsim-file '" + *file + "'");
if (!XMLSubSys::runParser(nodesHandler, *file)) {
return;
}
PROGRESS_DONE_MESSAGE();
}
// load edges, then
EdgesHandler edgesHandler(nb.getNodeCont(), nb.getEdgeCont(), oc.getBool("matsim.keep-length"),
oc.getBool("matsim.lanes-from-capacity"), NBCapacity2Lanes(oc.getFloat("lanes-from-capacity.norm")));
for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
// edges
edgesHandler.setFileName(*file);
PROGRESS_BEGIN_MESSAGE("Parsing edges from matsim-file '" + *file + "'");
XMLSubSys::runParser(edgesHandler, *file);
PROGRESS_DONE_MESSAGE();
}
}
示例2: 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;
}
示例3: buildOnRamp
// ===========================================================================
// method definitions
// ===========================================================================
// ---------------------------------------------------------------------------
// NBRampsComputer
// ---------------------------------------------------------------------------
void
NBRampsComputer::computeRamps(NBNetBuilder& nb, OptionsCont& oc) {
SUMOReal minHighwaySpeed = oc.getFloat("ramps.min-highway-speed");
SUMOReal maxRampSpeed = oc.getFloat("ramps.max-ramp-speed");
SUMOReal rampLength = oc.getFloat("ramps.ramp-length");
bool dontSplit = oc.getBool("ramps.no-split");
std::set<NBEdge*> incremented;
// check whether on-off ramps shall be guessed
if (oc.getBool("ramps.guess")) {
NBNodeCont& nc = nb.getNodeCont();
NBEdgeCont& ec = nb.getEdgeCont();
NBDistrictCont& dc = nb.getDistrictCont();
std::set<NBNode*> potOnRamps;
std::set<NBNode*> potOffRamps;
for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
NBNode* cur = (*i).second;
if (mayNeedOnRamp(cur, minHighwaySpeed, maxRampSpeed)) {
potOnRamps.insert(cur);
}
if (mayNeedOffRamp(cur, minHighwaySpeed, maxRampSpeed)) {
potOffRamps.insert(cur);
}
}
for (std::set<NBNode*>::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) {
buildOnRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
}
for (std::set<NBNode*>::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) {
buildOffRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
}
}
// check whether on-off ramps shall be guessed
if (oc.isSet("ramps.set")) {
std::vector<std::string> edges = oc.getStringVector("ramps.set");
NBNodeCont& nc = nb.getNodeCont();
NBEdgeCont& ec = nb.getEdgeCont();
NBDistrictCont& dc = nb.getDistrictCont();
for (std::vector<std::string>::iterator i = edges.begin(); i != edges.end(); ++i) {
NBEdge* e = ec.retrieve(*i);
if (e == 0) {
WRITE_WARNING("Can not build on ramp on edge '" + *i + "' - the edge is not known.");
continue;
}
NBNode* from = e->getFromNode();
if (from->getIncomingEdges().size() == 2 && from->getOutgoingEdges().size() == 1) {
buildOnRamp(from, nc, ec, dc, rampLength, dontSplit, incremented);
}
// load edge again to check offramps
e = ec.retrieve(*i);
if (e == 0) {
WRITE_WARNING("Can not build off ramp on edge '" + *i + "' - the edge is not known.");
continue;
}
NBNode* to = e->getToNode();
if (to->getIncomingEdges().size() == 1 && to->getOutgoingEdges().size() == 2) {
buildOffRamp(to, nc, ec, dc, rampLength, dontSplit, incremented);
}
}
}
}
示例4:
// ===========================================================================
// method definitions
// ===========================================================================
PCTypeMap::PCTypeMap(const OptionsCont& oc) {
myDefaultType.id = oc.getString("type");
myDefaultType.color = RGBColor::parseColor(oc.getString("color"));
myDefaultType.layer = oc.getFloat("layer");
myDefaultType.discard = oc.getBool("discard");
myDefaultType.allowFill = oc.getBool("fill");
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: 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();
}
示例8: loader
void
loadJTRDefinitions(RONet& net, OptionsCont& oc) {
// load the turning definitions (and possible sink definition)
if (oc.isSet("turn-ratio-files")) {
ROJTRTurnDefLoader loader(net);
std::vector<std::string> ratio_files = oc.getStringVector("turn-ratio-files");
for (std::vector<std::string>::const_iterator i = ratio_files.begin(); i != ratio_files.end(); ++i) {
if (!XMLSubSys::runParser(loader, *i)) {
throw ProcessError();
}
}
}
if (MsgHandler::getErrorInstance()->wasInformed() && oc.getBool("ignore-errors")) {
MsgHandler::getErrorInstance()->clear();
}
// parse sink edges specified at the input/within the configuration
if (oc.isSet("sink-edges")) {
std::vector<std::string> edges = oc.getStringVector("sink-edges");
for (std::vector<std::string>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
ROJTREdge* edge = static_cast<ROJTREdge*>(net.getEdge(*i));
if (edge == 0) {
throw ProcessError("The edge '" + *i + "' declared as a sink is not known.");
}
edge->setSink();
}
}
}
示例9: 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();
}
示例10: 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();
}
示例11: 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();
}
示例12: SUMOSAXHandler
// ===========================================================================
// method definitions
// ===========================================================================
NIXMLEdgesHandler::NIXMLEdgesHandler(NBNodeCont& nc,
NBEdgeCont& ec,
NBTypeCont& tc,
NBDistrictCont& dc,
OptionsCont& options)
: SUMOSAXHandler("xml-edges - file"),
myOptions(options),
myNodeCont(nc), myEdgeCont(ec), myTypeCont(tc), myDistrictCont(dc),
myCurrentEdge(0), myHaveReportedAboutOverwriting(false),
myHaveWarnedAboutDeprecatedLaneId(false),
myKeepEdgeShape(!options.getBool("plain.extend-edge-shape"))
{}
示例13:
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"));
}
}
示例14: router
/**
* Computes the routes saving them
*/
void
computeRoutes(RONet &net, ROLoader &loader, OptionsCont &oc) {
// initialise the loader
loader.openRoutes(net);
// prepare the output
try {
net.openOutput(oc.getString("output"), false);
} catch (IOError &e) {
throw e;
}
// build the router
ROJTRRouter router(net, oc.getBool("continue-on-unbuild"),
oc.getBool("accept-all-destinations"));
// the routes are sorted - process stepwise
if (!oc.getBool("unsorted")) {
loader.processRoutesStepWise(string2time(oc.getString("begin")), string2time(oc.getString("end")), net, router);
}
// the routes are not sorted: load all and process
else {
loader.processAllRoutes(string2time(oc.getString("begin")), string2time(oc.getString("end")), net, router);
}
// end the processing
net.closeOutput();
}
示例15: Position
bool
GeoConvHelper::init(OptionsCont& oc) {
std::string proj = "!"; // the default
double scale = oc.getFloat("proj.scale");
double rot = oc.getFloat("proj.rotate");
Position offset = Position(oc.getFloat("offset.x"), oc.getFloat("offset.y"));
bool inverse = oc.exists("proj.inverse") && oc.getBool("proj.inverse");
bool flatten = oc.exists("flatten") && oc.getBool("flatten");
if (oc.getBool("simple-projection")) {
proj = "-";
}
#ifdef PROJ_API_FILE
if (oc.getBool("proj.inverse") && oc.getString("proj") == "!") {
WRITE_ERROR("Inverse projection works only with explicit proj parameters.");
return false;
}
unsigned numProjections = oc.getBool("simple-projection") + oc.getBool("proj.utm") + oc.getBool("proj.dhdn") + oc.getBool("proj.dhdnutm") + (oc.getString("proj").length() > 1);
if (numProjections > 1) {
WRITE_ERROR("The projection method needs to be uniquely defined.");
return false;
}
if (oc.getBool("proj.utm")) {
proj = "UTM";
} else if (oc.getBool("proj.dhdn")) {
proj = "DHDN";
} else if (oc.getBool("proj.dhdnutm")) {
proj = "DHDN_UTM";
} else if (!oc.isDefault("proj")) {
proj = oc.getString("proj");
}
#endif
myProcessing = GeoConvHelper(proj, offset, Boundary(), Boundary(), scale, rot, inverse, flatten);
myFinal = myProcessing;
return true;
}