void GNEDetectorE1::setAttribute(SumoXMLAttr key, const std::string& value) { switch (key) { case SUMO_ATTR_ID: setAdditionalID(value); break; case SUMO_ATTR_LANE: changeLane(myViewNet->getNet()->retrieveLane(value)); break; case SUMO_ATTR_POSITION: myPosition = Position(parse<SUMOReal>(value), 0); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_FREQUENCY: myFreq = parse<SUMOReal>(value); break; case SUMO_ATTR_FILE: myFilename = value; break; case SUMO_ATTR_SPLIT_VTYPE: mySplitByType = parse<bool>(value); break; default: throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); } }
void GNEDetectorEntry::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) { if (value == getAttribute(key)) { return; //avoid needless changes, later logic relies on the fact that attributes have changed } switch (key) { case SUMO_ATTR_ID: setAdditionalID(value); break; case SUMO_ATTR_LANE: changeLane(myViewNet->getNet()->retrieveLane(value)); break; case SUMO_ATTR_POSITION: undoList->p_add(new GNEChange_Attribute(this, key, value)); updateGeometry(); break; default: throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); } }
void GNEVariableSpeedSignal::setAttribute(SumoXMLAttr key, const std::string& value) { switch (key) { case SUMO_ATTR_ID: setAdditionalID(value); break; case SUMO_ATTR_LANES: { // Declare variables std::vector<std::string> laneIds; std::vector<GNELane*> lanes; GNELane* lane; SUMOSAXAttributes::parseStringVector(value, laneIds); // Iterate over parsed lanes and obtain pointer to lanes for (int i = 0; i < (int)laneIds.size(); i++) { lane = myViewNet->getNet()->retrieveLane(laneIds.at(i), false); if (lane) { lanes.push_back(lane); } } // Set new childs setLaneChilds(lanes); break; } case SUMO_ATTR_POSITION: bool ok; myPosition = GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false)[0]; updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_FILE: myFilename = value; break; case GNE_ATTR_BLOCK_MOVEMENT: myBlocked = parse<bool>(value); getViewNet()->update(); break; default: throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); } }
void GNEDetectorEntry::setAttribute(SumoXMLAttr key, const std::string& value) { switch (key) { case SUMO_ATTR_ID: setAdditionalID(value); break; case SUMO_ATTR_LANE: changeLane(value); break; case SUMO_ATTR_POSITION: myPosition = Position(parse<SUMOReal>(value), 0); updateGeometry(); getViewNet()->update(); break; case GNE_ATTR_BLOCK_MOVEMENT: myBlocked = parse<bool>(value); getViewNet()->update(); break; default: throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); } }
void GNEContainerStop::setAttribute(SumoXMLAttr key, const std::string& value) { switch (key) { case SUMO_ATTR_ID: setAdditionalID(value); break; case SUMO_ATTR_LANE: changeLane(value); break; case SUMO_ATTR_STARTPOS: myStartPos = parse<SUMOReal>(value); updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_ENDPOS: if (parse<SUMOReal>(value) > myLane->getLaneParametricLenght()) { myEndPos = myLane->getLaneParametricLenght(); } else { myEndPos = parse<SUMOReal>(value); } updateGeometry(); getViewNet()->update(); break; case SUMO_ATTR_LINES: myLines.clear(); SUMOSAXAttributes::parseStringVector(value, myLines); getViewNet()->update(); break; case GNE_ATTR_BLOCK_MOVEMENT: myBlocked = parse<bool>(value); getViewNet()->update(); break; default: throw InvalidArgument(toString(getType()) + " attribute '" + toString(key) + "' not allowed"); } }