64 undoList->
begin(route,
"apply distance along route");
68 dist += edge->getNBEdge()->getFinalLength();
90 setParents<GNEEdge*>({calibrator->
getParentLanes().front()->getParentEdge()});
92 throw InvalidArgument(
"Calibrator parent requieres at least one edge or one lane");
98 GNEDemandElement(id, originalRoute->getNet(), originalRoute->getFilename(), originalRoute->getTagProperty()->getTag(),
99 originalRoute->getPathElementOptions()),
100 Parameterised(originalRoute->getParameters()->getParametersMap()),
103 myVClass(originalRoute->getVClass()) {
111 GNEDemandElement(vehicleParent, originalRoute->getTagProperty()->getTag(), originalRoute->getPathElementOptions()),
112 Parameterised(originalRoute->getParameters()->getParametersMap()),
115 myVClass(originalRoute->getVClass()) {
118 setParent<GNEDemandElement*>(vehicleParent);
124 const std::vector<GNEEdge*>& edges,
const RGBColor& color,
const int repeat,
131 myCycleTime(cycleTime),
134 setParents<GNEEdge*>(edges);
145 myCycleTime(cycleTime),
146 myVClass(vehicleParent->getVClass()) {
148 setParents<GNEEdge*>(edges);
149 setParent<GNEDemandElement*>(vehicleParent);
182 new FXMenuSeparator(ret);
185 new FXMenuSeparator(ret);
215 std::vector<GNEDemandElement*> refs;
218 refs.push_back(routeChild);
221 if (refs.size() == 1) {
228 if (routeChild->getTagProperty()->isVehicleStop()) {
229 routeChild->writeDemandElement(device);
243 std::vector<GNEDemandElement*> stops;
245 if (routeChild->getTagProperty()->isVehicleStop()) {
246 stops.push_back(routeChild);
277 std::vector<GNEDemandElement*> stops;
279 if (routeChild->getTagProperty()->isVehicleStop()) {
280 stops.push_back(routeChild);
284 if (invalidStops.size() > 0) {
285 return toString(invalidStops.size()) +
" stops are outside of route (downstream)";
291 return TL(
"Cannot repeat in routes with only one edge");
295 return TL(
"Cannot repeat route; front and last edge aren't connected");
339 if (!demandElement->getTagProperty()->isVehicleStop()) {
340 demandElement->updateGeometry();
369 routeBoundary.
add(i->getCenteringBoundary());
373 return routeBoundary;
375 return Boundary(-0.1, -0.1, 0.1, 0.1);
385 if (newRouteEdges.size() > 0) {
573 return getParentEdges().back()->getChildLanes().front()->getLaneShape().length2D();
584 return getParentEdges().front()->getChildLanes().front()->getLaneShape().front();
586 return getParentEdges().back()->getChildLanes().front()->getLaneShape().back();
608 std::vector<GNEDemandElement*> vehicles;
610 if (childDemandElement->getTagProperty()->isVehicle()) {
611 vehicles.push_back(childDemandElement);
615 if (vehicles.size() > 0) {
616 undoList->
begin(
this,
"reset start and end edges");
617 for (
const auto& vehicle : vehicles) {
624 undoList->
begin(
this,
"reset start and end edges");
651 return canParse<std::vector<GNEEdge*> >(
myNet, value,
true);
657 return canParse<RGBColor>(value);
660 return canParse<int>(value) && (parse<int>(value) >= 0);
662 if (canParse<SUMOTime>(value)) {
663 return (parse<SUMOTime>(value) >= 0);
687 if (edges.size() == 0) {
689 return (
"list of route edges cannot be empty");
690 }
else if (edges.size() == 1) {
695 auto it = edges.begin();
696 while (it != edges.end() - 1) {
697 const GNEEdge* currentEdge = *it;
698 const GNEEdge* nextEdge = *(it + 1);
700 if (currentEdge->
getID() == nextEdge->
getID()) {
701 return (
"consecutive duplicated edges (" + currentEdge->
getID() +
") aren't allowed in a route");
706 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), nextEdge) == outgoingEdges.end()) {
707 return (
"Edges '" + currentEdge->
getID() +
"' and '" + nextEdge->
getID() +
"' aren't consecutives");
719 const auto net = originalRoute->
getNet();
722 const std::string newRouteID = net->getAttributeCarriers()->generateDemandElementID(
SUMO_TAG_ROUTE);
726 undoList->begin(originalRoute,
TLF(
"copy % '%'", originalRoute->
getTagStr(), newRouteID));
739 const GNESegment* segment,
const double offsetFront,
740 const GUIGeometry& geometry,
const double exaggeration)
const {
746 glTranslated(0, 0,
getType() + offsetFront);
779 const double offsetFront,
const GUIGeometry& geometry,
const double exaggeration)
const {
786 glTranslated(0, 0,
getType() + offsetFront);
790 }
else if (invalid) {
816 element->updateGeometry();
819 element->updateGeometry();
826 myColor = parse<RGBColor>(value);
864 if (templateAC && templateAC->getTagProperty()->vehicleRoute()) {
FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[]
@ DEMAND_VEHICLE
Mode for editing vehicles.
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
@ MID_GNE_ROUTE_APPLY_DISTANCE
apply distance
@ GLO_VEHICLELABELS
stack and flow labels (used in netedit)
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
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
double getCommonAttributeDouble(SumoXMLAttr key) const
FXIcon * getACIcon() const
get FXIcon associated to this AC
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
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.
Position getCommonAttributePosition(SumoXMLAttr key) const
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
bool isCommonAttributeValid(SumoXMLAttr key, const std::string &value) const
virtual std::string getAttribute(SumoXMLAttr key) const =0
std::string getCommonAttribute(SumoXMLAttr key) const
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
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
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 GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
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
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
bool isValid(SumoXMLAttr key, const std::string &value) override
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this route
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
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)
bool checkCreatingVehicleOverRoute() const
check if we're creating a vehicle or flow over route
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.
double getAttributeDouble(SumoXMLAttr key) const override
SUMOTime myCycleTime
cycleTime
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void updateGeometry() override
update pre-computed geometry information
Parameterised * getParameters() override
get parameters associated with this route
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
static GNEDemandElement * copyRoute(const GNERoute *originalRoute)
create a copy of the given route
GNELane * getFirstPathLane() const
get first path lane
Position getAttributePosition(SumoXMLAttr key) const override
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
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.
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 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
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
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
int getLaneIndex() const
get lane index
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
GNEAttributeCarrier * getCurrentTemplateAC() const
get current templateAC
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...
GNETagSelector * getVehicleTagSelector() const
get vehicle tag selector (needed for transform vehicles)
bool isACInspected(GNEAttributeCarrier *AC) const
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
GNEVehicleFrame * getVehicleFrame() const
get frame for DEMAND_VEHICLE
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
GUIVisualizationTextSettings vehicleName
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)
bool showRouteIndex
Information whether the route index should be shown.
double angle
The current view rotation angle.
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
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
DemandEditMode demandEditMode
the current Demand edit mode
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