121 for (
int i = 0; i < (int)positionVector.size(); ++i) {
131 for (
int i = 0; i < (int)vector.size(); i++) {
132 pv.push_back(
Position(vector[i].x, vector[i].y));
150 return RGBColor((
unsigned char)c.
r, (
unsigned char)c.
g, (
unsigned char)c.
b, (
unsigned char)c.
a);
166 p.
set(tpos.
x, tpos.
y, tpos.
z);
174 throw TraCIException(
"Referenced edge '" + edgeID +
"' is not known.");
185 if (laneIndex < 0 || laneIndex >= (
int)edge->
getLanes().size()) {
189 if (pos < 0 || pos > lane->
getLength()) {
195 std::pair<MSLane*, double>
198 std::pair<MSLane*, double> result;
199 std::vector<std::string> allEdgeIds;
200 double minDistance = std::numeric_limits<double>::max();
203 for (std::vector<std::string>::iterator itId = allEdgeIds.begin(); itId != allEdgeIds.end(); itId++) {
205 for (std::vector<MSLane*>::const_iterator itLane = allLanes.begin(); itLane != allLanes.end(); itLane++) {
206 const double newDistance = (*itLane)->getShape().distance2D(pos);
207 if (newDistance < minDistance) {
208 minDistance = newDistance;
209 result.first = (*itLane);
214 result.second = result.first->getShape().nearest_offset_to_point2D(pos,
false);
double z() const
Returns the z-position.
static void init()
Initialises the xml-subsystem.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
double x() const
Returns the x-position.
static TraCIColor makeTraCIColor(const RGBColor &color)
static MSEdge * getEdge(const std::string &edgeID)
const SubscribedValues & getSubscriptionResults() const
double getLength() const
Returns the lane's length.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static void load(const std::vector< std::string > &args)
load a simulation with the given arguments
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
void set(double x, double y)
set positions x and y
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
unsigned char blue() const
Returns the blue-amount of the color.
A road/street connecting two junctions.
std::map< std::string, SubscribedValues > SubscribedContextValues
std::map< std::string, TraCIValues > SubscribedValues
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
static PositionVector makePositionVector(const TraCIPositionVector &vector)
A point in 2D or 3D with translation and scaling methods.
void close()
Connects to the specified SUMO server.
unsigned char alpha() const
Returns the alpha-amount of the color.
double y() const
Returns the y-position.
std::map< int, TraCIValue > TraCIValues
{object->{variable->value}}
const SubscribedContextValues & getContextSubscriptionResults() const
static std::pair< MSLane *, double > convertCartesianToRoadMap(Position pos)
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
SubscribedContextValues mySubscribedContextValues
static Position makePosition(const TraCIPosition &position)
static TraCIPosition makeTraCIPosition(const Position &position)
unsigned char green() const
Returns the green-amount of the color.
MSEdgeControl & getEdgeControl()
Returns the edge control.
void simulationStep()
Performs a single simulation step.
static RGBColor makeRGBColor(const TraCIColor &color)
unsigned char red() const
Returns the red-amount of the color.
Representation of a lane in the micro simulation.
static void simulationStep(const SUMOTime time=0)
Advances by one step (or up to the given time)
SubscribedValues mySubscribedValues