63 undoList->
begin(route,
"apply distance along route");
67 dist += edge->getNBEdge()->getFinalLength();
80{}, {}, {}, {}, {}, {}),
95{}, {}, {}, {}, {}, {}),
102 resetDefaultValues();
109{}, originalRoute->getParentEdges(), {}, {}, {}, {}),
113myVClass(originalRoute->getVClass()) {
121{}, originalRoute->getParentEdges(), {}, {}, {vehicleParent}, {}),
125myVClass(originalRoute->getVClass()) {
134{}, edges, {}, {}, {}, {}),
138myCycleTime(cycleTime),
147{}, edges, {}, {}, {vehicleParent}, {}),
151myCycleTime(cycleTime),
152myVClass(vehicleParent->getVClass()) {
176 new FXMenuSeparator(ret);
183 new FXMenuSeparator(ret);
186 new FXMenuSeparator(ret);
219 if (demandElement->getTagProperty().isVehicleStop()) {
220 demandElement->writeDemandElement(device);
234 std::vector<GNEDemandElement*> stops;
236 if (routeChild->getTagProperty().isVehicleStop()) {
237 stops.push_back(routeChild);
268 std::vector<GNEDemandElement*> stops;
270 if (routeChild->getTagProperty().isVehicleStop()) {
271 stops.push_back(routeChild);
275 if (invalidStops.size() > 0) {
276 return toString(invalidStops.size()) +
" stops are outside of route (downstream)";
282 return TL(
"Cannot repeat in routes with only one edge");
286 return TL(
"Cannot repeat route; front and last edge aren't connected");
330 if (!demandElement->getTagProperty().isVehicleStop()) {
331 demandElement->updateGeometry();
360 routeBoundary.
add(i->getCenteringBoundary());
364 return routeBoundary;
366 return Boundary(-0.1, -0.1, 0.1, 0.1);
376 if (newRouteEdges.size() > 0) {
492 segment->
getContour()->
calculateContourExtrudedShape(s, d,
this, routeGeometry.
getShape(),
getType(), routeWidth, routeExaggeration,
false,
false, 0, segment);
557 return getParentEdges().back()->getLanes().front()->getLaneShape().length2D();
568 return getParentEdges().front()->getLanes().front()->getLaneShape().front();
570 return getParentEdges().back()->getLanes().front()->getLaneShape().back();
605 std::vector<GNEDemandElement*> vehicles;
607 if (childDemandElement->getTagProperty().isVehicle()) {
608 vehicles.push_back(childDemandElement);
612 if (vehicles.size() > 0) {
613 undoList->
begin(
this,
"reset start and end edges");
614 for (
const auto& vehicle : vehicles) {
621 undoList->
begin(
this,
"reset start and end edges");
654 return canParse<RGBColor>(value);
657 return canParse<int>(value);
659 if (canParse<SUMOTime>(value)) {
660 return (parse<SUMOTime>(value) >= 0);
665 return canParse<bool>(value);
694 if (edges.size() == 0) {
696 return (
"list of route edges cannot be empty");
697 }
else if (edges.size() == 1) {
702 auto it = edges.begin();
703 while (it != edges.end() - 1) {
704 const GNEEdge* currentEdge = *it;
705 const GNEEdge* nextEdge = *(it + 1);
707 if (currentEdge->
getID() == nextEdge->
getID()) {
708 return (
"consecutive duplicated edges (" + currentEdge->
getID() +
") aren't allowed in a route");
713 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), nextEdge) == outgoingEdges.end()) {
714 return (
"Edges '" + currentEdge->
getID() +
"' and '" + nextEdge->
getID() +
"' aren't consecutives");
726 const auto net = originalRoute->
getNet();
729 const std::string newRouteID = net->getAttributeCarriers()->generateDemandElementID(
SUMO_TAG_ROUTE);
733 undoList->begin(originalRoute,
TLF(
"copy % '%'", originalRoute->
getTagStr(), newRouteID));
746 const GNESegment* segment,
const double offsetFront,
747 const GUIGeometry& geometry,
const double exaggeration)
const {
753 glTranslated(0, 0,
getType() + offsetFront);
786 const double offsetFront,
const GUIGeometry& geometry,
const double exaggeration)
const {
793 glTranslated(0, 0,
getType() + offsetFront);
797 }
else if (invalid) {
822 element->updateGeometry();
825 element->updateGeometry();
832 myColor = parse<RGBColor>(value);
842 if (parse<bool>(value)) {
FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[]
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
@ MID_COPY_NAME
Copy object name - popup entry.
@ MID_GNE_ROUTE_APPLY_DISTANCE
apply distance
@ GLO_ROUTE_EMBEDDED
a route
GUIViewObjectsHandler gViewObjectsHandler
GUIIcon
An enumeration of icons used by the gui applications.
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_COLOR
A color information.
@ GNE_ATTR_ROUTE_DISTRIBUTION
route distribution
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
bool isInitialised() const
check if Boundary is Initialised
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void popMatrix()
pop matrix
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static void pushMatrix()
push matrix
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
FXIcon * getACIcon() const
get FXIcon associated to this AC
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment) const
calculate contour extruded (used in elements formed by a central shape)
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
bool checkDrawPathContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC) const
drawing contour functions
void buildMenuCommandRouteLength(GUIGLObjectPopupMenu *ret) const
build menu command route length
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
std::vector< GNEDemandElement * > getInvalidStops() const
get invalid stops
std::string getDistributionParents() const
get distribution in which the given element is part
bool isValidDemandElementID(const std::string &value) const
check if a new demand element ID is valid
void setDemandElementID(const std::string &newID)
set demand element id
void buildMenuAddReverse(GUIGLObjectPopupMenu *ret) const
build menu command route length
Problem
enum class for demandElement problems
@ REPEATEDROUTE_DISCONNECTED
A road/street connecting two junctions (netedit-version)
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given toLane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
get elements shape
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Position getPositionInView() const
Returns position of hierarchical element in view.
const GUIGeometry & getLaneGeometry() const
get lane geometry
A NBNetBuilder extended by visualisation and editing capabilities.
GNEPathManager * getDemandPathManager()
get demand path manager
GNEViewNet * getViewNet() const
get view net
bool checkDrawPathGeometry(const GUIVisualizationSettings &s, const GNELane *lane, SumoXMLTag tag)
check if path element geometry must be drawn in the given lane
PathDraw * getPathDraw()
obtain instance of PathDraw
bool isPathValid(const GNEPathElement *pathElement) const
check if path element is valid
void calculateConsecutivePathEdges(GNEPathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEEdge * > &edges, const int firstLaneIndex=-1, const int lastLaneIndex=-1)
calculate consecutive path edges
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
GNELane * getLastPathLane() const
get last path lane
Position getPositionInView() const
Returns position of additional in view.
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
std::string getParentName() const
Returns the name of the parent object.
SUMOTime myCycleTime
cycleTime
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Position getAttributePosition(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void drawRoutePartialJunction(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw route partial junction
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
const Parameterised::Map & getACParametersMap() const
get parameters map
static GNEDemandElement * copyRoute(const GNERoute *originalRoute)
create a copy of the given route
GNELane * getFirstPathLane() const
get first path lane
double getAttributeDouble(SumoXMLAttr key) const
GNEMoveOperation * getMoveOperation()
get move operation
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void drawRoutePartialLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNESegment *segment, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw route partial lane
GNERoute(SumoXMLTag tag, GNENet *net)
default constructor
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void computePathElement()
compute pathElement
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
RGBColor myColor
route color
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
bool isAttributeEnabled(SumoXMLAttr key) const
const RGBColor & getColor() const
get color
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
const GNELane * getLane() const
get lane associated with this segment
const GNELane * getNextLane() const
get next lane
const GNELane * getPreviousLane() const
get previous lane
bool isFirstSegment() const
check if segment is the first path's segment
GNEContour * getContour() const
bool isLastSegment() const
check if segment is the last path's segment
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
GNEUndoList * getUndoList() const
get the undoList object
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
void addToRedrawPathElements(const GNEPathElement *pathElement)
add path element to redrawing set
bool isPathElementMarkForRedraw(const GNEPathElement *pathElement) const
check if the given path element has to be redraw again
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationSizeSettings vehicleSize
GUIVisualizationWidthSettings widthSettings
width settings
bool checkDrawVehicle(Detail d, const bool selected) const
check if draw vehicle
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position (in radians bet...
double length() const
Returns the length.
static const RGBColor YELLOW
static const RGBColor INVISIBLE
static const RGBColor RED
named colors
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool showDemandElements() const
check if show demand elements checkbox is enabled
RGBColor selectedRouteColor
route selection color (used for routes and vehicle stops)
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const double segmentWidth
width of dotted contour segments
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
static const double embeddedRouteWidth
width for embeddedroutes
static const double routeWidth
width for routes