62 #ifdef CHECK_MEMORY_LEAKS 64 #endif // CHECK_MEMORY_LEAKS 71 FXIMPLEMENT(
GNELane, FXDelegator, 0, 0)
88 myParentEdge(*static_cast<
GNEEdge*>(0)),
98 (*i)->removeLaneReference();
127 glTranslated(end.
x(), end.
y(), 0);
128 glRotated(rot, 0, 0, 1);
133 for (std::vector<NBEdge::Connection>::const_iterator i = edgeCons.begin(); i != edgeCons.end(); ++i) {
134 if ((*i).fromLane ==
myIndex) {
176 glTranslated(0, 5, 0);
178 glTranslated(0, -5, 0);
196 for (std::vector<NBEdge::Connection>::iterator it = connections.begin(); it != connections.end(); it++) {
210 glColor3d(.4, .4, .4);
213 glColor3d(.7, .4, .4);
216 glColor3d(.7, .7, .7);
219 glColor3d(.7, .7, 1);
221 glColor3d(.75, .5, 0.25);
226 const Position& endPos = it->toEdge->getLaneShape(it->toLane)[0];
228 glVertex2f(startPos.
x(), startPos.
y());
229 glVertex2f(endPos.
x(), endPos.
y());
246 }
else if (selected) {
248 }
else if (selectedEdge) {
261 if (s.
scale * exaggeration < 1.) {
271 const SUMOReal halfRailWidth = 0.725 * exaggeration;
279 glTranslated(0, 0, .1);
282 drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
294 if (exaggeration == 1) {
317 int e = (int)
getShape().size() - 1;
318 for (
int i = 0; i < e; ++i) {
326 glVertex2d(-mw, -t - length);
327 glVertex2d(halfWidth * 0.5 * scale, -t - length);
328 glVertex2d(halfWidth * 0.5 * scale, -t);
337 glTranslated(0, 0, 0.2);
384 new FXMenuCommand(ret,
"Select state for all links from this edge:", 0, 0, 0);
386 for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); it++) {
388 FXMenuRadio* mc =
new FXMenuRadio(ret, (*it).c_str(),
this, FXDataTarget::ID_OPTION + state);
394 FXMenuCommand* mc =
new FXMenuCommand(ret,
"Additional options available in 'Inspect Mode'", 0, 0, 0);
395 mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
398 new FXMenuSeparator(ret);
401 new FXMenuCommand(ret, (
"Shape pos: " +
toString(pos)).c_str(), 0, 0, 0);
403 new FXMenuCommand(ret, (
"Height: " +
toString(height)).c_str(), 0, 0, 0);
408 (
dynamic_cast<GNEViewNet&
>(parent)).markPopupPosition();
439 const std::vector<SUMOReal>&
445 const std::vector<SUMOReal>&
463 int segments = (int)
getShape().size() - 1;
467 for (
int i = 0; i < segments; ++i) {
476 (*i)->updateGeometry();
480 (*i)->updateGeometry();
536 if (*i == additional) {
545 const std::vector<GNEAdditional*>&
555 if ((*i) == additionalSet) {
569 if ((*i) == additionalSet) {
579 const std::vector<GNEAdditionalSet*>&
637 return canParse<SUMOReal>(value);
642 return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) ==
NBEdge::UNSPECIFIED_WIDTH);
644 return canParse<SUMOReal>(value);
691 switch (activeScheme) {
705 const size_t activeScheme = c.
getActive();
707 switch (activeScheme) {
709 for (PositionVector::const_iterator ii =
getShape().begin(); ii !=
getShape().end() - 1; ++ii) {
714 for (
int ii = 1; ii < (int)
getShape().size(); ++ii) {
728 switch (activeScheme) {
730 switch (myPermissions) {
793 glTranslated(0, 0, 0.1);
794 int e = (int)
getShape().size() - 1;
795 for (
int i = 0; i < e; ++i) {
801 glVertex2d(-halfWidth, -t);
802 glVertex2d(-halfWidth, -t - length);
803 glVertex2d(halfWidth, -t - length);
804 glVertex2d(halfWidth, -t);
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
The link is a partial left direction.
const PositionVector & getLaneShape(unsigned int i) const
Returns the shape of the nth lane.
SUMOReal endOffset
This lane's offset to the intersection begin.
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
const std::string & getParentName() const
Returns the name of the parent object (if any)
const std::vector< SUMOReal > & getShapeRotations() const
returns the vector with the shape rotations
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
float laneWidthExaggeration
The lane exaggeration (upscale thickness)
PositionVector shape
The lane's shape.
Copy edge name (for lanes only)
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
GNETLSEditorFrame * myTLSEditor
the tls-editor for setting multiple links in TLS-mode
static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v)
Converts the given hsv-triplet to rgb.
AdditionalVector myAdditionals
list with the additonals vinculated with this lane
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void drawMarkings(const bool &selectedEdge, SUMOReal scale) const
draw lane markings
SUMOReal getSpeed() const
returns the current speed of lane
const RGBColor * mySpecialColor
optional special color
static const RGBColor selectedLaneColor
color of selected lane
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
SUMOReal getPositionRelativeToShapeLenght(SUMOReal position) const
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
GUIColorer laneColorer
The lane colorer.
Stores the information about how to visualize structures.
This is an uncontrolled, minor link, has to stop.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, int steps=8)
Draws an unfilled circle around (0,0)
bool showRails
Information whether rails shall be drawn.
The link is a 180 degree turn.
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width, int cornerDetail=0, SUMOReal offset=0)
Draws thick lines.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width, SUMOReal offset=0)
Draws a thick line.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
int editMode
the current NETEDIT mode (temporary)
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
This is an uncontrolled, right-before-left link.
void drawTLSLinkNo() const
draw TLS Link Number
void handleMultiChange(GNELane *lane, FXObject *obj, FXSelector sel, void *data)
update phase definition for the current traffic light and phase
const SUMOReal SUMO_const_laneOffset
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
unsigned int getIndex() const
returns the index of the lane
An Element wich group additionalSet elements.
The link is controlled by a tls which is off, not blinking, may pass.
SUMOReal x() const
Returns the x-position.
This is an uncontrolled, all-way stop link.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
Boundary getBoundary() const
returns the boundry (including lanes)
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
GUIGlID getGlID() const
Returns the numerical id of the object.
static void drawTriangleAtEnd(const Position &p1, const Position &p2, SUMOReal tLength, SUMOReal tWidth)
Draws a triangle at the end of the given line.
A class that stores a 2D geometrical boundary.
int myIndex
The index of this lane.
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
static OptionsCont & getOptions()
Retrieves the options.
SUMOReal scale
information about a lane's width (temporary, used for a single view)
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
std::vector< std::string > getStrings() const
The link is a straight direction.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
SUMOReal selectionScale
the current selection scaling in NETEDIT (temporary)
void drawLane2LaneConnections() const
draw lane to lane connections
void drawArrows() const
draw arrows
int getPriority() const
Returns the priority of the edge.
std::string getLaneID(unsigned int lane) const
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
GNEEdge & getParentEdge()
Returns underlying parent edge.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
SUMOReal getLaneParametricLenght() const
returns the parameteric length of the lane
SUMOReal getPositionRelativeToParametricLenght(SUMOReal position) const
This is an uncontrolled, minor link, has to brake.
A point in 2D or 3D with translation and scaling methods.
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some lane function
bool isLogicValid()
whether this junction has a valid logic
std::vector< SUMOReal > myShapeRotations
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
friend class GNEChange_Attribute
declare friend class
AdditionalSetVector myAdditionalSets
list with the additonalSets vinculated with this lane
SUMOReal z() const
Returns the z-position.
int getNumLanes() const
Returns the number of lanes.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
const T getColor(const SUMOReal value) const
The link is a (hard) right direction.
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
bool removeAdditionalSet(GNEAdditionalSet *additionalSet)
remove GNEAdditionalSet from this lane
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
bool removeAdditional(GNEAdditional *additional)
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
std::vector< Connection > myConnections
List of connections to following edges.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
The link is a partial right direction.
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
vehicle is a passenger car (a "normal" car)
void updateGeometry()
update pre-computed geometry information
static SUMOReal naviDegree(const SUMOReal angle)
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads
bool addAdditionalSet(GNEAdditionalSet *additionalSet)
add GNEAdditionalSet to this lane
bool canParseVehicleClasses(const std::string &classes)
Checks whether the given string contains only known vehicle classes.
std::string getAttribute(SumoXMLAttr key) const
A road/street connecting two junctions (netedit-version)
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void drawLinkRules() const
draw link rules
GNEEdge & myParentEdge
The Edge that to which this lane belongs.
SUMOReal length() const
Returns the length.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
NBNode * getToNode() const
Returns the destination node of the edge.
const PositionVector & getShape() const
returns the shape of the lane
SUMOReal getLaneShapeLenght() const
returns the length of the lane's shape
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
An Element which don't belongs to GNENet but has influency in the simulation.
The link is controlled by a tls which is off and blinks, has to brake.
const std::vector< GNEAdditional * > & getAdditionals() const
method to obtain a list of additional elements associated to this lane
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
SUMOReal y() const
Returns the y-position.
void setSpecialColor(const RGBColor *Color2)
const std::vector< SUMOReal > & getShapeLengths() const
returns the vector with the shape lengths
This is an uncontrolled, major link, may pass.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEJunction * getDest() const
returns the destination-junction
SUMOReal getLaneSpeed(unsigned int lane) const
static const StringBijection< FXuint > LinkStateNames
long names for link states
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Represents a single node (junction) during network building.
T get(const std::string &str) const
Lane & getLaneStruct(unsigned int lane)
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
The link is a 180 degree turn (left-hand network)
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
void addAdditional(GNEAdditional *additional)
static const RGBColor selectionColor
color of selection
mode for connecting lanes
void setIndex(unsigned int index)
const std::vector< GNEAdditionalSet * > & getAdditionalSets()
return list of additionalSets associated with this lane
mode for creating new edges
bool isValid(SumoXMLAttr key, const std::string &value)
NBEdge * getNBEdge()
returns the internal NBEdge
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
void drawLinkNo() const
draw link Number
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
A window containing a gl-object's parameter.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
SUMOReal width
This lane's width.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
SUMOReal getLength() const
Returns the computed length of the edge.
SUMOReal getColorValue(size_t activeScheme) const
return value for lane coloring according to the given scheme
The link has no direction (is a dead end link)
static RGBColor getColor()
gets the gl-color