GUIParameterTableWindow* GUILane::getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView&) { GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this, 5); // add items ret->mkItem("maxspeed [m/s]", false, getSpeedLimit()); ret->mkItem("length [m]", false, myLength); ret->mkItem("street name", false, myEdge->getStreetName()); ret->mkItem("stored traveltime [s]", true, new FunctionBinding<GUILane, SUMOReal>(this, &GUILane::getStoredEdgeTravelTime)); ret->mkItem("allowed vehicle class", false, getVehicleClassNames(myPermissions)); ret->mkItem("disallowed vehicle class", false, getVehicleClassNames(~myPermissions)); // close building ret->closeBuilding(); return ret; }
void writePreferences(OutputDevice& into, SVCPermissions preferred) { if (preferred == SVCAll || preferred == 0) { return; } else { into.writeAttr(SUMO_ATTR_PREFER, getVehicleClassNames(preferred)); } }
std::string GNEClosingReroute::getAttribute(SumoXMLAttr key) const { switch (key) { case SUMO_ATTR_ID: return getAdditionalID(); case SUMO_ATTR_EDGE: return myClosedEdge->getID(); case SUMO_ATTR_ALLOW: return getVehicleClassNames(myPermissions); case SUMO_ATTR_DISALLOW: return getVehicleClassNames(invertPermissions(myPermissions)); case GNE_ATTR_PARENT: return getAdditionalParents().at(0)->getID(); case GNE_ATTR_GENERIC: return getGenericParametersStr(); default: throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'"); } }
void writePermissions(OutputDevice& into, SVCPermissions permissions) { if (permissions == SVCAll) { return; } else if (permissions == 0) { into.writeAttr(SUMO_ATTR_DISALLOW, "all"); return; } else { int num_allowed = 0; for (int mask = 1; mask <= SUMOVehicleClass_MAX; mask = mask << 1) { if ((mask & permissions) == mask) { ++num_allowed; } } if (num_allowed <= (SumoVehicleClassStrings.size() - num_allowed) && num_allowed > 0) { into.writeAttr(SUMO_ATTR_ALLOW, getVehicleClassNames(permissions)); } else { into.writeAttr(SUMO_ATTR_DISALLOW, getVehicleClassNames(~permissions)); } } }
std::string GNELane::getAttribute(SumoXMLAttr key) const { const NBEdge* edge = myParentEdge.getNBEdge(); switch (key) { case SUMO_ATTR_ID: return getMicrosimID(); case SUMO_ATTR_SPEED: return toString(edge->getLaneSpeed(myIndex)); case SUMO_ATTR_ALLOW: // return all allowed classes (may differ from the written attributes) return getVehicleClassNames(edge->getPermissions(myIndex)); case SUMO_ATTR_DISALLOW: // return all disallowed classes (may differ from the written attributes) return getVehicleClassNames(~(edge->getPermissions(myIndex))); case SUMO_ATTR_WIDTH: return toString(edge->getLaneStruct(myIndex).width); case SUMO_ATTR_ENDOFFSET: return toString(edge->getLaneStruct(myIndex).endOffset); case SUMO_ATTR_INDEX: return toString(myIndex); default: throw InvalidArgument("lane attribute '" + toString(key) + "' not allowed"); } }
void NBTypeCont::writeTypes(OutputDevice& into) const { for (TypesCont::const_iterator i = myTypes.begin(); i != myTypes.end(); ++i) { into.openTag(SUMO_TAG_TYPE); into.writeAttr(SUMO_ATTR_ID, i->first); const NBTypeCont::TypeDefinition& type = i->second; if (type.attrs.count(SUMO_ATTR_PRIORITY) > 0) { into.writeAttr(SUMO_ATTR_PRIORITY, type.priority); } if (type.attrs.count(SUMO_ATTR_NUMLANES) > 0) { into.writeAttr(SUMO_ATTR_NUMLANES, type.numLanes); } if (type.attrs.count(SUMO_ATTR_SPEED) > 0) { into.writeAttr(SUMO_ATTR_SPEED, type.speed); } if (type.attrs.count(SUMO_ATTR_DISALLOW) > 0 || type.attrs.count(SUMO_ATTR_ALLOW) > 0) { writePermissions(into, type.permissions); } if (type.attrs.count(SUMO_ATTR_ONEWAY) > 0) { into.writeAttr(SUMO_ATTR_ONEWAY, type.oneWay); } if (type.attrs.count(SUMO_ATTR_DISCARD) > 0) { into.writeAttr(SUMO_ATTR_DISCARD, type.discard); } if (type.attrs.count(SUMO_ATTR_WIDTH) > 0) { into.writeAttr(SUMO_ATTR_WIDTH, type.width); } if (type.attrs.count(SUMO_ATTR_SIDEWALKWIDTH) > 0) { into.writeAttr(SUMO_ATTR_SIDEWALKWIDTH, type.sidewalkWidth); } if (type.attrs.count(SUMO_ATTR_BIKELANEWIDTH) > 0) { into.writeAttr(SUMO_ATTR_BIKELANEWIDTH, type.bikeLaneWidth); } for (std::map<SUMOVehicleClass, SUMOReal>::const_iterator j = type.restrictions.begin(); j != type.restrictions.end(); ++j) { into.openTag(SUMO_TAG_RESTRICTION); into.writeAttr(SUMO_ATTR_VCLASS, getVehicleClassNames(j->first)); into.writeAttr(SUMO_ATTR_SPEED, j->second); into.closeTag(); } into.closeTag(); } if (!myTypes.empty()) { into.lf(); } }