65 undoList->
begin(route,
"apply distance along route");
69 dist += edge->getNBEdge()->getFinalLength();
91 GNEDemandElement(id, originalRoute->getNet(), originalRoute->getFilename(), originalRoute->getTagProperty()->getTag(),
92 originalRoute->getPathElementOptions()),
96 myVClass(originalRoute->getVClass()) {
104 GNEDemandElement(vehicleParent, originalRoute->getTagProperty()->getTag(), originalRoute->getPathElementOptions()),
108 myVClass(originalRoute->getVClass()) {
111 setParent<GNEDemandElement*>(vehicleParent);
117 const std::vector<GNEEdge*>& edges,
const RGBColor& color,
const int repeat,
124 myCycleTime(cycleTime),
127 setParents<GNEEdge*>(edges);
139 myCycleTime(cycleTime),
140 myVClass(vehicleParent->getVClass()) {
142 setParents<GNEEdge*>(edges);
143 setParent<GNEDemandElement*>(vehicleParent);
165 new FXMenuSeparator(ret);
168 new FXMenuSeparator(ret);
198 std::vector<GNEDemandElement*> refs;
201 refs.push_back(routeChild);
204 if (refs.size() == 1) {
211 if (routeChild->getTagProperty()->isVehicleStop()) {
212 routeChild->writeDemandElement(device);
226 std::vector<GNEDemandElement*> stops;
228 if (routeChild->getTagProperty()->isVehicleStop()) {
229 stops.push_back(routeChild);
260 std::vector<GNEDemandElement*> stops;
262 if (routeChild->getTagProperty()->isVehicleStop()) {
263 stops.push_back(routeChild);
267 if (invalidStops.size() > 0) {
268 return toString(invalidStops.size()) +
" stops are outside of route (downstream)";
274 return TL(
"Cannot repeat in routes with only one edge");
278 return TL(
"Cannot repeat route; front and last edge aren't connected");
322 if (!demandElement->getTagProperty()->isVehicleStop()) {
323 demandElement->updateGeometry();
352 routeBoundary.
add(i->getCenteringBoundary());
356 return routeBoundary;
358 return Boundary(-0.1, -0.1, 0.1, 0.1);
368 if (newRouteEdges.size() > 0) {
543 return getParentEdges().back()->getChildLanes().front()->getLaneShape().length2D();
554 return getParentEdges().front()->getChildLanes().front()->getLaneShape().front();
556 return getParentEdges().back()->getChildLanes().front()->getLaneShape().back();
584 std::vector<GNEDemandElement*> vehicles;
586 if (childDemandElement->getTagProperty()->isVehicle()) {
587 vehicles.push_back(childDemandElement);
591 if (vehicles.size() > 0) {
592 undoList->
begin(
this,
"reset start and end edges");
593 for (
const auto& vehicle : vehicles) {
600 undoList->
begin(
this,
"reset start and end edges");
627 return canParse<std::vector<GNEEdge*> >(
myNet, value,
true);
633 return canParse<RGBColor>(value);
636 return canParse<int>(value) && (parse<int>(value) >= 0);
638 if (canParse<SUMOTime>(value)) {
639 return (parse<SUMOTime>(value) >= 0);
669 if (edges.size() == 0) {
671 return (
"list of route edges cannot be empty");
672 }
else if (edges.size() == 1) {
677 auto it = edges.begin();
678 while (it != edges.end() - 1) {
679 const GNEEdge* currentEdge = *it;
680 const GNEEdge* nextEdge = *(it + 1);
682 if (currentEdge->
getID() == nextEdge->
getID()) {
683 return (
"consecutive duplicated edges (" + currentEdge->
getID() +
") aren't allowed in a route");
688 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), nextEdge) == outgoingEdges.end()) {
689 return (
"Edges '" + currentEdge->
getID() +
"' and '" + nextEdge->
getID() +
"' aren't consecutives");
701 const auto net = originalRoute->
getNet();
704 const std::string newRouteID = net->getAttributeCarriers()->generateDemandElementID(
SUMO_TAG_ROUTE);
708 undoList->begin(originalRoute,
TLF(
"copy % '%'", originalRoute->
getTagStr(), newRouteID));
721 const GNESegment* segment,
const double offsetFront,
722 const GUIGeometry& geometry,
const double exaggeration)
const {
728 glTranslated(0, 0,
getType() + offsetFront);
761 const double offsetFront,
const GUIGeometry& geometry,
const double exaggeration)
const {
768 glTranslated(0, 0,
getType() + offsetFront);
772 }
else if (invalid) {
798 element->updateGeometry();
801 element->updateGeometry();
808 myColor = parse<RGBColor>(value);
FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[]
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
@ MID_GNE_ROUTE_APPLY_DISTANCE
apply distance
GUIViewObjectsHandler gViewObjectsHandler
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
description of a route
@ GNE_TAG_ROUTEREF
virtual element used to reference routes with distributions
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_COLOR
A color information.
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
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
std::string getCommonAttribute(const Parameterised *parameterised, SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
bool isCommonValid(SumoXMLAttr key, const std::string &value) const
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
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 GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
bool 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
std::vector< GNEDemandElement * > getInvalidStops() const
get invalid stops
bool isValidDemandElementID(const std::string &value) const
check if a new demand element ID is valid
virtual std::string getAttribute(SumoXMLAttr key) const =0
void setDemandElementID(const std::string &newID)
set demand element id
void buildMenuAddReverse(GUIGLObjectPopupMenu *ret) const
build menu command route length
void replaceParentEdges(const std::string &value)
all edges
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 GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const GNEHierarchicalContainerParents< GNEEdge * > & getParentEdges() const
get parent edges
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
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
GNEEdge * getParentEdge() const
get parent edge
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, const SumoXMLTag tag, const bool isPlan)
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 GNEJunction * getJunction() const
get junction 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
const RGBColor & getDefaultColorValue(SumoXMLAttr attr) const
get default bool value
double getDefaultDoubleValue(SumoXMLAttr attr) const
get default double value
SUMOTime getDefaultTimeValue(SumoXMLAttr attr) const
get default time value
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
int getDefaultIntValue(SumoXMLAttr attr) const
get default int value
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
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, bool addSeparator=true)
virtual Position getCenter() const
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.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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