44 const std::string
id = inputStorage.
readString();
47 if (!libsumo::Polygon::handleVariable(
id, variable, &server, &inputStorage)) {
61 std::string warning =
"";
68 "Change Polygon State: unsupported variable " +
toHex(variable, 2) +
" specified", outputStorage);
79 libsumo::Polygon::setColor(
id,
StoHelp::readTypedColor(inputStorage,
"The color must be given using an according type."));
82 libsumo::Polygon::setShape(
id,
StoHelp::readTypedPolygon(inputStorage,
"The shape must be given using an according type."));
85 libsumo::Polygon::setFilled(
id,
StoHelp::readTypedInt(inputStorage,
"'fill' must be defined using an integer.") != 0);
88 libsumo::Polygon::setLineWidth(
id,
StoHelp::readTypedDouble(inputStorage,
"'lineWidth' must be defined using a double."));
91 const int parameterCount =
StoHelp::readCompound(inputStorage, -1,
"A compound object is needed for adding a new polygon.");
92 if (parameterCount != 5 && parameterCount != 6) {
97 const bool fill =
StoHelp::readBool(inputStorage,
"The third polygon parameter must be 'fill' encoded as ubyte.");
98 const int layer =
StoHelp::readTypedInt(inputStorage,
"The fourth polygon parameter must be the layer encoded as int.");
100 double lineWidth = 1.;
101 if (parameterCount == 6) {
102 lineWidth =
StoHelp::readTypedDouble(inputStorage,
"The sixth polygon parameter must be the lineWidth encoded as double.");
104 libsumo::Polygon::add(
id, tp, col, fill, type, layer, lineWidth);
111 int itemNo = inputStorage.
readInt();
115 const std::string trackedID =
StoHelp::readTypedString(inputStorage,
"The first parameter for adding polygon dynamics must be ID of the tracked object as a string ('' to disregard tracking).");
116 const std::vector<double> timeSpan =
StoHelp::readTypedDoubleList(inputStorage,
"The second parameter for adding polygon dynamics must be the timespan of the animation (length=0 to disregard animation).");
117 const std::vector<double> alphaSpan =
StoHelp::readTypedDoubleList(inputStorage,
"The third parameter for adding polygon dynamics must be the alphaSpanStr of the animation (length=0 to disregard alpha animation).");
118 const bool looped =
StoHelp::readBool(inputStorage,
"The fourth parameter for adding polygon dynamics must be boolean indicating whether the animation should be looped.");
119 const bool rotate =
StoHelp::readBool(inputStorage,
"The fifth parameter for adding polygon dynamics must be boolean indicating whether the tracking polygon should be rotated.");
120 libsumo::Polygon::addDynamics(
id, trackedID, timeSpan, alphaSpan, looped, rotate);
124 libsumo::Polygon::remove(
id,
StoHelp::readTypedInt(inputStorage,
"The layer must be given using an int."));
128 StoHelp::readCompound(inputStorage, 2,
"A compound object of size 2 is needed for setting a parameter.");
129 const std::string name =
StoHelp::readTypedString(inputStorage,
"The name of the parameter must be given as a string.");
130 const std::string value =
StoHelp::readTypedString(inputStorage,
"The value of the parameter must be given as a string.");
131 libsumo::Polygon::setParameter(
id, name, value);
std::string toHex(const T i, std::streamsize numDigits=0)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc8: Change Polygon State)
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa8: Get Polygon Variable)
TraCI server used to control sumo by a remote TraCI client.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
tcpip::Storage & getWrapperStorage()
void initWrapper(const int domainID, const int variable, const std::string &objID)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
static int readCompound(tcpip::Storage &ret, int expectedSize=-1, const std::string &error="")
static bool readBool(tcpip::Storage &ret, const std::string &error="")
static int readTypedInt(tcpip::Storage &ret, const std::string &error="")
static std::vector< double > readTypedDoubleList(tcpip::Storage &ret, const std::string &error="")
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
static const libsumo::TraCIPositionVector readTypedPolygon(tcpip::Storage &ret, const std::string &error="")
static const libsumo::TraCIColor readTypedColor(tcpip::Storage &ret, const std::string &error="")
static double readTypedDouble(tcpip::Storage &ret, const std::string &error="")
An error which allows to continue.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int RESPONSE_GET_POLYGON_VARIABLE
TRACI_CONST int TYPE_COMPOUND
TRACI_CONST int VAR_MOVE_TO
TRACI_CONST int CMD_SET_POLYGON_VARIABLE
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_WIDTH
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
TRACI_CONST int VAR_SHAPE
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_ADD_DYNAMICS
TRACI_CONST int CMD_GET_POLYGON_VARIABLE