110 for (
int i = 0; i < (int)positionVector.size(); ++i) {
120 for (
int i = 0; i < (int)vector.size(); i++) {
121 pv.push_back(
Position(vector[i].x, vector[i].y));
139 return RGBColor((
unsigned char)c.
r, (
unsigned char)c.
g, (
unsigned char)c.
b, (
unsigned char)c.
a);
155 p.
set(tpos.
x, tpos.
y, tpos.
z);
163 throw TraCIException(
"Referenced edge '" + edgeID +
"' is not known.");
174 if (laneIndex < 0 || laneIndex >= (
int)edge->
getLanes().size()) {
178 if (pos < 0 || pos > lane->
getLength()) {
184 std::pair<MSLane*, double>
187 std::pair<MSLane*, double> result;
188 std::vector<std::string> allEdgeIds;
192 for (std::vector<std::string>::iterator itId = allEdgeIds.begin(); itId != allEdgeIds.end(); itId++) {
194 for (std::vector<MSLane*>::const_iterator itLane = allLanes.begin(); itLane != allLanes.end(); itLane++) {
195 const double newDistance = (*itLane)->getShape().distance2D(pos);
196 if (newDistance < minDistance) {
197 minDistance = newDistance;
198 result.first = (*itLane);
203 result.second = result.first->getShape().nearest_offset_to_point2D(pos,
false);
double z() const
Returns the z-position.
unsigned char alpha() const
Returns the alpha-amount of the color.
static TraCIColor makeTraCIColor(const RGBColor &color)
double y() const
Returns the y-position.
static MSEdge * getEdge(const std::string &edgeID)
double x() const
Returns the x-position.
static std::vector< std::string > myLoadArgs
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
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
double getLength() const
Returns the lane's length.
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...
unsigned char blue() const
Returns the blue-amount of the color.
void set(double x, double y)
set positions x and y
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
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.
const SubscribedContextValues & getContextSubscriptionResults() const
std::map< int, TraCIValue > TraCIValues
{object->{variable->value}}
static std::pair< MSLane *, double > convertCartesianToRoadMap(Position pos)
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
unsigned char green() const
Returns the green-amount of the color.
SubscribedContextValues mySubscribedContextValues
static Position makePosition(const TraCIPosition &position)
unsigned char red() const
Returns the red-amount of the color.
static TraCIPosition makeTraCIPosition(const Position &position)
MSEdgeControl & getEdgeControl()
Returns the edge control.
const SubscribedValues & getSubscriptionResults() const
static RGBColor makeRGBColor(const TraCIColor &color)
Representation of a lane in the micro simulation.
SubscribedValues mySubscribedValues