48std::vector<std::string>
49Junction::getIDList() {
50 std::vector<std::string> ids;
57Junction::getIDCount() {
58 return (
int)getIDList().size();
63Junction::getPosition(
const std::string& junctionID,
const bool includeZ) {
69Junction::getShape(
const std::string& junctionID) {
74const std::vector<std::string>
75Junction::getIncomingEdges(
const std::string& junctionID) {
76 std::vector<std::string> result;
77 for (
const MSEdge* edge : getJunction(junctionID)->getIncoming()) {
78 result.push_back(edge->getID());
84const std::vector<std::string>
85Junction::getOutgoingEdges(
const std::string& junctionID) {
86 std::vector<std::string> result;
87 for (
const MSEdge* edge : getJunction(junctionID)->getOutgoing()) {
88 result.push_back(edge->getID());
95Junction::getJunction(
const std::string&
id) {
98 throw TraCIException(
"Junction '" +
id +
"' is not known");
105Junction::getParameter(
const std::string& junctionID,
const std::string& param) {
106 return getJunction(junctionID)->
getParameter(param,
"");
114Junction::setParameter(
const std::string& junctionID,
const std::string& name,
const std::string& value) {
115 getJunction(junctionID)->setParameter(name, value);
124 if (myTree ==
nullptr) {
128 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
129 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
130 myTree->Insert(cmin, cmax, i.second);
144 shape.push_back(getJunction(
id)->getPosition());
148std::shared_ptr<VariableWrapper>
149Junction::makeWrapper() {
150 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
155Junction::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
158 return wrapper->wrapStringList(objID, variable, getIDList());
160 return wrapper->wrapInt(objID, variable, getIDCount());
163 return wrapper->wrapPosition(objID, variable, getPosition(objID, variable ==
VAR_POSITION3D));
165 return wrapper->wrapPositionVector(objID, variable, getShape(objID));
168 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
170 return wrapper->wrapStringList(objID, variable, getIncomingEdges(objID));
172 return wrapper->wrapStringList(objID, variable, getOutgoingEdges(objID));
175 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
A class that stores a 2D geometrical boundary.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
C++ TraCI client API implementation.
A road/street connecting two junctions.
The base class for an intersection.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSJunctionControl & getJunctionControl()
Returns the junctions control.
T get(const std::string &id) const
Retrieves an item.
void insertIDs(std::vector< std::string > &into) const
A RT-tree for efficient storing of SUMO's Named objects.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int TRACI_ID_LIST
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_POSITION
TRACI_CONST int OUTGOING_EDGES
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_SHAPE
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_POSITION3D
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int INCOMING_EDGES