62 undoList->
begin(route,
"apply distance along route");
66 dist += edge->getNBEdge()->getFinalLength();
79{}, {}, {}, {}, {}, {}),
94{}, {}, {}, {}, {}, {}),
101 resetDefaultValues();
108{}, originalRoute->getParentEdges(), {}, {}, {}, {}),
112myVClass(originalRoute->getVClass()) {
120{}, originalRoute->getParentEdges(), {}, {}, {vehicleParent}, {}),
124myVClass(originalRoute->getVClass()) {
133{}, edges, {}, {}, {}, {}),
137myCycleTime(cycleTime),
146{}, edges, {}, {}, {vehicleParent}, {}),
150myCycleTime(cycleTime),
151myVClass(vehicleParent->getVClass()) {
175 new FXMenuSeparator(ret);
182 new FXMenuSeparator(ret);
185 new FXMenuSeparator(ret);
218 if (demandElement->getTagProperty().isVehicleStop()) {
219 demandElement->writeDemandElement(device);
233 std::vector<GNEDemandElement*> stops;
235 if (routeChild->getTagProperty().isVehicleStop()) {
236 stops.push_back(routeChild);
267 std::vector<GNEDemandElement*> stops;
269 if (routeChild->getTagProperty().isVehicleStop()) {
270 stops.push_back(routeChild);
274 if (invalidStops.size() > 0) {
275 return toString(invalidStops.size()) +
" stops are outside of route (downstream)";
281 return TL(
"Cannot repeat in routes with only one edge");
285 return TL(
"Cannot repeat route; front and last edge aren't connected");
329 if (!demandElement->getTagProperty().isVehicleStop()) {
330 demandElement->updateGeometry();
359 routeBoundary.
add(i->getCenteringBoundary());
363 return routeBoundary;
365 return Boundary(-0.1, -0.1, 0.1, 0.1);
375 if (newRouteEdges.size() > 0) {
548 return getParentEdges().back()->getLanes().front()->getLaneShape().length2D();
559 return getParentEdges().front()->getLanes().front()->getLaneShape().front();
561 return getParentEdges().back()->getLanes().front()->getLaneShape().back();
596 std::vector<GNEDemandElement*> vehicles;
598 if (childDemandElement->getTagProperty().isVehicle()) {
599 vehicles.push_back(childDemandElement);
603 if (vehicles.size() > 0) {
604 undoList->
begin(
this,
"reset start and end edges");
605 for (
const auto& vehicle : vehicles) {
612 undoList->
begin(
this,
"reset start and end edges");
645 return canParse<RGBColor>(value);
648 return canParse<int>(value);
650 if (canParse<SUMOTime>(value)) {
651 return (parse<SUMOTime>(value) >= 0);
656 return canParse<bool>(value);
685 if (edges.size() == 0) {
687 return (
"list of route edges cannot be empty");
688 }
else if (edges.size() == 1) {
693 auto it = edges.begin();
694 while (it != edges.end() - 1) {
695 const GNEEdge* currentEdge = *it;
696 const GNEEdge* nextEdge = *(it + 1);
698 if (currentEdge->
getID() == nextEdge->
getID()) {
699 return (
"consecutive duplicated edges (" + currentEdge->
getID() +
") aren't allowed in a route");
704 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), nextEdge) == outgoingEdges.end()) {
705 return (
"Edges '" + currentEdge->
getID() +
"' and '" + nextEdge->
getID() +
"' aren't consecutives");
717 const auto net = originalRoute->
getNet();
720 const std::string newRouteID = net->getAttributeCarriers()->generateDemandElementID(
SUMO_TAG_ROUTE);
724 undoList->begin(originalRoute,
TLF(
"copy % '%'", originalRoute->
getTagStr(), newRouteID));
738 const GUIGeometry& geometry,
const double exaggeration)
const {
744 glTranslated(0, 0,
getType() + offsetFront);
777 const double offsetFront,
const GUIGeometry& geometry,
const double exaggeration)
const {
784 glTranslated(0, 0,
getType() + offsetFront);
788 }
else if (invalid) {
813 element->updateGeometry();
816 element->updateGeometry();
823 myColor = parse<RGBColor>(value);
833 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
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
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...)
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
PathElement()=delete
invalidate default constructor
const GNELane * getPreviousLane() const
get previous lane
GNEContour * getContour() const
getcontour associated with segment
const GNELane * getNextLane() const
get next lane
const GNELane * getLane() const
get lane associated with this segment
bool isLastSegment() const
check if segment is the last path's segment
bool isFirstSegment() const
check if segment is the first path's segment
PathDraw * getPathDraw()
obtain instance of PathDraw
void calculateConsecutivePathEdges(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEEdge * > &edges, const int firstLaneIndex=-1, const int lastLaneIndex=-1)
calculate consecutive path edges
bool isPathValid(const PathElement *pathElement) const
check if path element is valid
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)
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 drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
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
void drawRoutePartialLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEPathManager::Segment *segment, const double offsetFront, const GUIGeometry &geometry, const double exaggeration) const
draw route partial 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
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
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
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
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
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