64 #ifdef CHECK_MEMORY_LEAKS 66 #endif // CHECK_MEMORY_LEAKS 73 FXIMPLEMENT(
GNELane, FXDelegator, 0, 0)
90 myParentEdge(*static_cast<
GNEEdge*>(0)),
125 glTranslated(end.
x(), end.
y(), 0);
126 glRotated(rot, 0, 0, 1);
131 for (std::vector<NBEdge::Connection>::const_iterator i = edgeCons.begin(); i != edgeCons.end(); ++i) {
132 if ((*i).fromLane ==
myIndex) {
174 glTranslated(0, 5, 0);
176 glTranslated(0, -5, 0);
194 for (std::vector<NBEdge::Connection>::iterator it = connections.begin(); it != connections.end(); it++) {
208 glColor3d(.4, .4, .4);
211 glColor3d(.7, .4, .4);
214 glColor3d(.7, .7, .7);
217 glColor3d(.7, .7, 1);
219 glColor3d(.75, .5, 0.25);
224 const Position& endPos = it->toEdge->getLaneShape(it->toLane)[0];
226 glVertex2d(startPos.
x(), startPos.
y());
227 glVertex2d(endPos.
x(), endPos.
y());
273 glGetFloatv(GL_CURRENT_COLOR, color);
277 }
else if (s.
scale * exaggeration < 1.) {
289 const SUMOReal halfRailWidth = 0.725 * exaggeration;
301 glTranslated(0, 0, .1);
307 drawCrossties(0.3 * exaggeration, 1 * exaggeration, 1 * exaggeration);
320 if (exaggeration == 1) {
334 double iconWidth = 1;
349 glRotated(90, 0, 0, 1);
377 int e = (int)
getShape().size() - 1;
378 for (
int i = 0; i < e; ++i) {
386 glVertex2d(-mw, -t - length);
387 glVertex2d(halfWidth * 0.5 * scale, -t - length);
388 glVertex2d(halfWidth * 0.5 * scale, -t);
397 glTranslated(0, 0, 0.2);
444 FXMenuPane* addSpecialLanes =
new FXMenuPane(ret);
446 FXMenuPane* removeSpecialLanes =
new FXMenuPane(ret);
448 FXMenuPane* transformSlanes =
new FXMenuPane(ret);
464 new FXMenuCascade(ret,
"add special lanes", 0, addSpecialLanes);
465 new FXMenuCascade(ret,
"remove special lanes", 0, removeSpecialLanes);
466 new FXMenuCascade(ret,
"transform to special lanes", 0, transformSlanes);
474 FXMenuPane* addSpecialLanes =
new FXMenuPane(ret);
476 FXMenuPane* removeSpecialLanes =
new FXMenuPane(ret);
478 FXMenuPane* transformSlanes =
new FXMenuPane(ret);
481 FXMenuCommand* addSidewalk =
new FXMenuCommand(addSpecialLanes,
"Sidewalk", pedestrianIcon, &parent,
MID_GNE_ADD_LANE_SIDEWALK);
482 FXMenuCommand* addBikelane =
new FXMenuCommand(addSpecialLanes,
"Bikelane", bikeIcon, &parent,
MID_GNE_ADD_LANE_BIKE);
483 FXMenuCommand* addBuslane =
new FXMenuCommand(addSpecialLanes,
"Buslane", busIcon, &parent,
MID_GNE_ADD_LANE_BUS);
485 FXMenuCommand* removeSidewalk =
new FXMenuCommand(removeSpecialLanes,
"Sidewalk", pedestrianIcon, &parent,
MID_GNE_REMOVE_LANE_SIDEWALK);
486 removeSidewalk->disable();
487 FXMenuCommand* removeBikelane =
new FXMenuCommand(removeSpecialLanes,
"Bikelane", bikeIcon, &parent,
MID_GNE_REMOVE_LANE_BIKE);
488 removeBikelane->disable();
489 FXMenuCommand* removeBuslane =
new FXMenuCommand(removeSpecialLanes,
"Buslane", busIcon, &parent,
MID_GNE_REMOVE_LANE_BUS);
490 removeBuslane->disable();
493 FXMenuCommand* transformLaneToBikelane =
new FXMenuCommand(transformSlanes,
"Bikelane", bikeIcon, &parent,
MID_GNE_TRANSFORM_LANE_BIKE);
494 FXMenuCommand* transformLaneToBuslane =
new FXMenuCommand(transformSlanes,
"Buslane", busIcon, &parent,
MID_GNE_TRANSFORM_LANE_BUS);
495 FXMenuCommand* revertTransformation =
new FXMenuCommand(transformSlanes,
"revert transformation", 0, &parent,
MID_GNE_REVERT_TRANSFORMATION);
497 FXMenuCascade* cascadeAddSpecialLane =
new FXMenuCascade(ret,
"add special lane", 0, addSpecialLanes);
498 FXMenuCascade* cascadeRemoveSpecialLane =
new FXMenuCascade(ret,
"remove special lane", 0, removeSpecialLanes);
499 new FXMenuCascade(ret,
"transform to special lane", 0, transformSlanes);
501 if (edgeHasSidewalk) {
502 transformLaneToSidewalk->disable();
503 addSidewalk->disable();
504 removeSidewalk->enable();
506 if (edgeHasBikelane) {
507 transformLaneToBikelane->disable();
508 addBikelane->disable();
509 removeBikelane->enable();
511 if (edgeHasBuslane) {
512 transformLaneToBuslane->disable();
513 addBuslane->disable();
514 removeBuslane->enable();
517 if (edgeHasSidewalk && edgeHasBikelane && edgeHasBuslane) {
518 cascadeAddSpecialLane->disable();
520 if (!edgeHasSidewalk && !edgeHasBikelane && !edgeHasBuslane) {
521 cascadeRemoveSpecialLane->disable();
525 revertTransformation->enable();
527 revertTransformation->disable();
533 new FXMenuCommand(ret,
"Select state for all links from this edge:", 0, 0, 0);
535 for (std::vector<std::string>::const_iterator it = names.begin(); it != names.end(); it++) {
537 FXMenuRadio* mc =
new FXMenuRadio(ret, (*it).c_str(),
this, FXDataTarget::ID_OPTION + state);
543 FXMenuCommand* mc =
new FXMenuCommand(ret,
"Additional options available in 'Inspect Mode'", 0, 0, 0);
544 mc->handle(&parent, FXSEL(SEL_COMMAND, FXWindow::ID_DISABLE), 0);
547 new FXMenuSeparator(ret);
550 new FXMenuCommand(ret, (
"Shape pos: " +
toString(pos)).c_str(), 0, 0, 0);
552 new FXMenuCommand(ret, (
"Height: " +
toString(height)).c_str(), 0, 0, 0);
557 (
dynamic_cast<GNEViewNet&
>(parent)).markPopupPosition();
588 const std::vector<SUMOReal>&
594 const std::vector<SUMOReal>&
617 int segments = (int)
getShape().size() - 1;
621 for (
int i = 0; i < segments; ++i) {
630 (*i)->updateGeometry();
634 (*i)->updateGeometry();
640 for (std::vector<GNEConnection*>::iterator i = incomingConnections.begin(); i != incomingConnections.end(); i++) {
641 (*i)->updateGeometry();
645 for (std::vector<GNEConnection*>::iterator i = outGoingConnections.begin(); i != outGoingConnections.end(); i++) {
646 (*i)->updateGeometry();
708 if (*i == additional) {
709 throw ProcessError(
"additional element with ID='" + additional->
getID() +
"' was already inserted in lane with ID='" +
getID() +
"'");
726 throw ProcessError(
"additional element with ID='" + additional->
getID() +
"' doesn't exist in lane with ID='" +
getID() +
"'");
733 const std::vector<GNEAdditional*>&
743 if ((*i) == additionalSet) {
757 if ((*i) == additionalSet) {
767 const std::vector<GNEAdditionalSet*>&
779 }
else if (vclass ==
SVC_BUS) {
839 return canParse<SUMOReal>(value);
844 return canParse<SUMOReal>(value) && (isPositive<SUMOReal>(value) || parse<SUMOReal>(value) ==
NBEdge::UNSPECIFIED_WIDTH);
846 return canParse<SUMOReal>(value);
897 switch (activeScheme) {
913 switch (activeScheme) {
915 for (PositionVector::const_iterator ii =
getShape().begin(); ii !=
getShape().end() - 1; ++ii) {
920 for (
int ii = 1; ii < (int)
getShape().size(); ++ii) {
934 switch (activeScheme) {
936 switch (myPermissions) {
999 glTranslated(0, 0, 0.1);
1000 int e = (int)
getShape().size() - 1;
1001 for (
int i = 0; i < e; ++i) {
1007 glVertex2d(-halfWidth, -t);
1008 glVertex2d(-halfWidth, -t - length);
1009 glVertex2d(halfWidth, -t - length);
1010 glVertex2d(halfWidth, -t);
1022 glColor3d(0.3, 0.3, 0.3);
1025 int e = (int)
getShape().size() - 1;
1026 for (
int i = 0; i < e; ++i) {
1032 glBegin(GL_TRIANGLES);
1033 glVertex2d(0, -t - length);
1034 glVertex2d(-width * 0.25, -t);
1035 glVertex2d(+width * 0.25, -t);
1066 std::vector<GNEConnection*>
1069 std::vector<GNEConnection*> incomingConnections;
1072 if (junctionSource) {
1075 for (std::vector<GNEEdge*>::iterator i = incomingEdges.begin(); i != incomingEdges.end(); i++) {
1077 for (std::vector<GNEConnection*>::const_iterator j = (*i)->getGNEConnections().begin(); j != (*i)->getGNEConnections().end(); j++) {
1078 if ((*j)->getNBEdgeConnection().fromLane ==
getIndex()) {
1079 incomingConnections.push_back(*j);
1084 return incomingConnections;
1088 std::vector<GNEConnection*>
1092 std::vector<GNEConnection*> outcomingConnections;
1094 for (std::vector<GNEConnection*>::const_iterator i = edgeConnections.begin(); i != edgeConnections.end(); i++) {
1095 if ((*i)->getNBEdgeConnection().fromLane ==
getIndex()) {
1096 outcomingConnections.push_back(*i);
1099 return outcomingConnections;
The link is a partial left direction.
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and some lane function ...
SUMOReal endOffset
This lane's offset to the intersection begin.
void drawLane2LaneConnections() const
draw lane to lane connections
LinkState getLinkState(const NBEdge *incoming, NBEdge *outgoing, int fromLane, int toLane, bool mayDefinitelyPass, const std::string &tlID) const
bool isRestricted(SUMOVehicleClass vclass) const
check if this lane is restricted
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
PositionVector shape
The lane's shape.
GNENet * myNet
the net to inform about updates
void drawTLSLinkNo() const
draw TLS Link Number
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.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
const RGBColor * mySpecialColor
optional special color
static const RGBColor selectedLaneColor
color of selected lane
Copy edge name (for lanes only)
SUMOReal length() const
Returns the length.
void setLaneWidth(int lane, SUMOReal width)
set lane specific width (negative lane implies set for all lanes)
void setSpeed(int lane, SUMOReal speed)
set lane specific speed (negative lane implies set for all lanes)
Boundary getBoundary() const
returns the boundry (including lanes)
GUIColorer laneColorer
The lane colorer.
SUMOReal laneWidthExaggeration
The lane exaggeration (upscale thickness)
Stores the information about how to visualize structures.
This is an uncontrolled, minor link, has to stop.
int getPriority() const
Returns the priority of the edge.
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
void removeAdditionalChild(GNEAdditional *additional)
remove additional child to this lane
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
bool hasRestrictedLane(SUMOVehicleClass vclass) const
check if edge has a restricted lane
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.
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.
std::vector< GNEEdge * > getGNEIncomingEdges() const
Return incoming GNEEdges.
int editMode
the current NETEDIT mode (temporary)
bool showLaneDirection
Whether to show direction indicators for lanes.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::vector< RGBColor > myShapeColors
The color of the shape parts (cached)
const std::vector< SUMOReal > & getShapeLengths() const
returns the vector with the shape lengths
This is an uncontrolled, right-before-left link.
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::vector< GNEConnection * > & getGNEConnections()
returns a reference to the GNEConnection vector
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.
void drawCrossties(SUMOReal length, SUMOReal spacing, SUMOReal halfWidth) const
draw crossties for railroads
Lane & getLaneStruct(int lane)
An Element wich group additionalSet elements.
The link is controlled by a tls which is off, not blinking, may pass.
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.
std::vector< SUMOReal > myLaneRestrictedTextureRotations
Rotations of textures of restricted lanes.
SUMOReal getLaneParametricLenght() const
returns the parameteric length of the lane
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.
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some lane function
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
std::vector< std::string > getStrings() const
static OptionsCont & getOptions()
Retrieves the options.
SUMOReal scale
information about a lane's width (temporary, used for a single view)
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
The link is a straight direction.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
std::vector< Connection > getConnectionsFromLane(int lane) const
Returns connections from a given lane.
SUMOReal getColorValue(int activeScheme) const
return value for lane coloring according to the given scheme
bool drawAsWaterway(const GUIVisualizationSettings &s) const
whether to draw this lane as a waterways
int getIndex() const
returns the index of the lane
SUMOReal selectionScale
the current selection scaling in NETEDIT (temporary)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
SUMOReal getLaneShapeLenght() const
returns the length of the lane's shape
const std::vector< GNEAdditionalSet * > & getAdditionalSetParents()
return list of additionalSets parents of this lane
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 z() const
Returns the z-position.
This is an uncontrolled, minor link, has to brake.
std::string getLaneID(int lane) const
get Lane ID (Secure)
int getNumLanes() const
Returns the number of lanes.
void drawLinkNo() const
draw link Number
A point in 2D or 3D with translation and scaling methods.
void addAdditionalChild(GNEAdditional *additional)
add additional child to this lane
SUMOReal getPositionRelativeToShapeLenght(SUMOReal position) const
bool controlsEdge(GNEEdge &edge) const
whether the given edge is controlled by the currently edited tlDef
bool isLogicValid()
whether this junction has a valid logic
std::vector< SUMOReal > myShapeRotations
bool removeAdditionalGeometrySet(GNEAdditionalSet *additionalSet)
remove GNEAdditionalSet from this lane
bool isWaterway(SVCPermissions permissions)
Returns whether an edge with the given permission is a waterway edge.
friend class GNEChange_Attribute
declare friend class
T get(const std::string &str) const
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void drawArrows() const
draw arrows
SUMOReal x() const
Returns the x-position.
The link is a (hard) right direction.
void drawMarkings(const bool &selectedEdge, SUMOReal scale) const
draw lane markings
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
const T getColor(const SUMOReal value) const
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
std::vector< Connection > myConnections
List of connections to following edges.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
GNEJunction * getGNEJunctionSource() const
returns the source-junction
SUMOReal getSpeed() const
returns the current speed of lane
The link is a partial right direction.
std::string getVehicleClassNames(SVCPermissions permissions)
Returns the ids of the given classes, divided using a ' '.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
vehicle is a passenger car (a "normal" car)
void updateGeometry()
update pre-computed geometry information
static SUMOReal naviDegree(const SUMOReal angle)
std::string getAttribute(SumoXMLAttr key) const
LinkDirection getDirection(const NBEdge *const incoming, const NBEdge *const outgoing, bool leftHand=false) const
Returns the representation of the described stream's direction.
EditMode getCurrentEditMode() const
get the current edit mode
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.
A road/street connecting two junctions (netedit-version)
void drawDirectionIndicators() const
direction indicators for lanes
GNEEdge & myParentEdge
The Edge that to which this lane belongs.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
GNEJunction * getGNEJunctionDest() const
returns the destination-junction
const PositionVector & getShape() const
returns the shape of the lane
const std::vector< SUMOReal > & getShapeRotations() const
returns the vector with the shape rotations
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
const PositionVector & getLaneShape(int i) const
Returns the shape of the nth lane.
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.
AdditionalSetVector myAdditionalSetParents
list with the additonalSets parents of this lane
std::vector< Position > myLaneRestrictedTexturePositions
Position of textures of restricted lanes.
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
SUMOReal getPositionRelativeToParametricLenght(SUMOReal position) const
void setSpecialColor(const RGBColor *Color2)
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.
void drawLinkRules() const
draw link rules
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.
GUIGlID getGlID() const
Returns the numerical id of the object.
Position positionAtOffset2D(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
The link is a 180 degree turn (left-hand network)
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
void setEndOffset(int lane, SUMOReal offset)
set lane specific end-offset (negative lane implies set for all lanes)
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
const std::string & getParentName() const
Returns the name of the parent object (if any)
static const RGBColor selectionColor
color of selection
mode for connecting lanes
mode for creating new edges
bool isValid(SumoXMLAttr key, const std::string &value)
NBEdge * getNBEdge()
returns the internal NBEdge
SUMOReal getLoadedLength() const
Returns the length was set explicitly or the computed length if it wasn't set.
SUMOReal laneMinSize
The minimum visual lane width for drawing.
static GUIGlID getGif(GUITexture which)
returns a texture Gif previously defined in the enum GUITexture
SUMOReal y() const
Returns the y-position.
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.
SUMOReal getLaneWidth() const
Returns the default width of lanes of this edge.
A window containing a gl-object's parameter.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void drawTexturedBox(int which, SUMOReal size)
Draws a named texture as a box with the given size.
NBNode * getToNode() const
Returns the destination node of the edge.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
SUMOReal getLength() const
Returns the computed length of the edge.
SUMOReal width
This lane's width.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GNEViewNet * getViewNet() const
get view net
SUMOReal getLaneSpeed(int lane) const
get lane speed
const std::vector< GNEAdditional * > & getAdditionalChilds() const
get additional childs of lane
The link has no direction (is a dead end link)
static RGBColor getColor()
gets the gl-color