Eclipse SUMO - Simulation of Urban MObility
GNETranship.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A class for visualizing tranships in Netedit
19/****************************************************************************/
20#include <config.h>
21
24#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
28
29#include "GNETranship.h"
30#include "GNERoute.h"
31
32
33// ===========================================================================
34// method definitions
35// ===========================================================================
36
39 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
40 mySpeed(0),
41 myDepartPosition(0),
42myArrivalPosition(-1) {
43 // reset default values
44 resetDefaultValues();
45}
46
47
48GNETranship::GNETranship(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEEdge* toEdge,
49 const double speed, const double departPosition, const double arrivalPosition) :
51 GNEPathManager::PathElement::Options::DEMAND_ELEMENT,
52{}, {fromEdge, toEdge}, {}, {}, {containerParent}, {}),
53mySpeed(speed),
54myDepartPosition(departPosition),
55myArrivalPosition(arrivalPosition) {
56}
57
58
59GNETranship::GNETranship(GNENet* net, GNEDemandElement* containerParent, GNEEdge* fromEdge, GNEAdditional* toContainerStop,
60 const double speed, const double departPosition, const double arrivalPosition) :
62 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {fromEdge}, {}, {toContainerStop}, {containerParent}, {}),
63mySpeed(speed),
64myDepartPosition(departPosition),
65myArrivalPosition(arrivalPosition) {
66}
67
68
69GNETranship::GNETranship(GNENet* net, GNEDemandElement* containerParent, std::vector<GNEEdge*> edges,
70 const double speed, const double departPosition, const double arrivalPosition) :
72 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {edges}, {}, {}, {containerParent}, {}),
73mySpeed(speed),
74myDepartPosition(departPosition),
75myArrivalPosition(arrivalPosition) {
76}
77
78
80
81
84 // avoid move container plan that ends in containerStop
85 if (getParentAdditionals().size() > 0) {
86 return nullptr;
87 }
88 // get geometry end pos
89 const Position geometryEndPos = getPathElementArrivalPos();
90 // calculate circle width squared
92 // check if we clicked over a geometry end pos
93 if (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= ((circleWidthSquared + 2))) {
94 // continue depending of parent edges
95 if (getParentEdges().size() > 0) {
96 return new GNEMoveOperation(this, getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
97 } else {
98 return new GNEMoveOperation(this, getParentDemandElements().at(1)->getParentEdges().back()->getLaneByAllowedVClass(getVClass()), myArrivalPosition, false);
99 }
100 } else {
101 return nullptr;
102 }
103}
104
105
108 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
109 // build header
110 buildPopupHeader(ret, app);
111 // build menu command for center button and copy cursor position to clipboard
113 buildPositionCopyEntry(ret, app);
114 // buld menu commands for names
115 GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
116 GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
117 new FXMenuSeparator(ret);
118 // build selection and show parameters menu
121 // show option to open demand element dialog
122 if (myTagProperty.hasDialog()) {
123 GUIDesigns::buildFXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getACIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
124 new FXMenuSeparator(ret);
125 }
126 GUIDesigns::buildFXMenuCommand(ret, ("Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y())).c_str(), nullptr, nullptr, 0);
127 return ret;
128}
129
130
131void
133 // open tag
135 // write attributes depending of tranship type
138 } else {
139 // check if from attribute is enabled
141 device.writeAttr(SUMO_ATTR_FROM, getParentEdges().front()->getID());
142 }
143 // write to depending if containerplan ends in a containerStop
144 if (getParentAdditionals().size() > 0) {
146 } else {
147 device.writeAttr(SUMO_ATTR_TO, getParentEdges().back()->getID());
148 }
149 }
150 // only write departPos if is different of -1
151 if (myDepartPosition != -1) {
153 }
154 // only write arrivalPos if is different of -1
157 }
158 // only write speed if is different of 1.39
159 if (mySpeed != 1.39) {
161 }
162 // close tag
163 device.closeTag();
164}
165
166
169 return Problem::OK;
170}
171
172
173std::string
175 return "";
176}
177
178
179void
181 // currently the only solution is removing Tranship
182}
183
184
187 return getParentDemandElements().front()->getVClass();
188}
189
190
191const RGBColor&
193 return getParentDemandElements().front()->getColor();
194}
195
196
197void
199 // update child demand elementss
200 for (const auto& i : getChildDemandElements()) {
201 i->updateGeometry();
202 }
203}
204
205
208 return getParentEdges().front()->getPositionInView();
209}
210
211
212std::string
214 return getParentDemandElements().front()->getID();
215}
216
217
218double
220 return 1;
221}
222
223
226 Boundary transhipBoundary;
227 // return the combination of all parent edges's boundaries
228 for (const auto& i : getParentEdges()) {
229 transhipBoundary.add(i->getCenteringBoundary());
230 }
231 // check if is valid
232 if (transhipBoundary.isInitialised()) {
233 return transhipBoundary;
234 } else {
235 return Boundary(-0.1, -0.1, 0.1, 0.1);
236 }
237}
238
239
240void
241GNETranship::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
242 // only split geometry of TranshipEdges
244 // obtain new list of tranship edges
245 std::string newTranshipEdges = getNewListOfParents(originalElement, newElement);
246 // update tranship edges
247 if (newTranshipEdges.size() > 0) {
248 setAttribute(SUMO_ATTR_EDGES, newTranshipEdges, undoList);
249 }
250 }
251}
252
253
254void
256 // Tranships are drawn in drawPartialGL
257}
258
259
260void
262 // update lanes depending of tranship tag
264 // calculate consecutive path using parent edges
266 } else {
267 // calculate path
269 }
270 // update geometry
272}
273
274
275void
276GNETranship::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
277 // draw container plan over lane
279}
280
281
282void
283GNETranship::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
284 // draw container plan over junction
285 drawPersonPlanPartial(drawContainerPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.transhipWidth, s.colorSettings.transhipColor);
286}
287
288
289GNELane*
291 return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
292}
293
294
295GNELane*
297 if (getParentAdditionals().size() > 0) {
298 return getParentAdditionals().front()->getParentLanes().front();
299 } else {
300 return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
301 }
302}
303
304
305std::string
307 switch (key) {
308 // Common container plan attributes
309 case SUMO_ATTR_ID:
310 case GNE_ATTR_PARENT:
311 return getParentDemandElements().front()->getID();
312 case SUMO_ATTR_FROM:
313 return getParentEdges().front()->getID();
314 case SUMO_ATTR_TO:
315 return getParentEdges().back()->getID();
317 return getParentAdditionals().back()->getID();
318 case SUMO_ATTR_EDGES:
319 return parseIDs(getParentEdges());
320 // specific container plan attributes
321 case SUMO_ATTR_SPEED:
322 return toString(mySpeed);
324 if (myDepartPosition == -1) {
325 return "";
326 } else {
328 }
330 if (myArrivalPosition == -1) {
331 return "";
332 } else {
334 }
337 default:
338 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
339 }
340}
341
342
343double
345 switch (key) {
347 if (myArrivalPosition != -1) {
348 return myArrivalPosition;
349 } else {
350 return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
351 }
352 default:
353 throw InvalidArgument(getTagStr() + " doesn't have a doubleattribute of type '" + toString(key) + "'");
354 }
355}
356
357
360 switch (key) {
362 // get lane shape
363 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
364 // continue depending of arrival position
365 if (myArrivalPosition == 0) {
366 return laneShape.front();
367 } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
368 return laneShape.back();
369 } else {
370 return laneShape.positionAtOffset2D(myArrivalPosition);
371 }
372 }
373 default:
374 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
375 }
376}
377
378
379void
380GNETranship::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
381 if (value == getAttribute(key)) {
382 return; //avoid needless changes, later logic relies on the fact that attributes have changed
383 }
384 switch (key) {
385 // Common container plan attributes
386 case SUMO_ATTR_FROM:
387 case SUMO_ATTR_SPEED:
391 case GNE_ATTR_PARENT:
392 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
393 break;
394 // special case for "to" attributes
395 case SUMO_ATTR_TO: {
396 // get next containerPlan
397 GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
398 // continue depending of nextContainerPlan
399 if (nextContainerPlan) {
400 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
401 nextContainerPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
402 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
403 undoList->end();
404 } else {
405 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
406 }
407 break;
408 }
410 // get next container plan
411 GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
412 // continue depending of nextContainerPlan
413 if (nextContainerPlan) {
414 // obtain containerStop
416 // change from attribute using edge ID
417 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
418 nextContainerPlan->setAttribute(SUMO_ATTR_FROM, containerStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
419 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
420 undoList->end();
421 } else {
422 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
423 }
424 break;
425 }
426 case SUMO_ATTR_EDGES: {
427 // get next container plan
428 GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
429 // continue depending of nextContainerPlan
430 if (nextContainerPlan) {
431 // obtain edges
432 const std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
433 // change from attribute using edge ID
434 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
435 nextContainerPlan->setAttribute(SUMO_ATTR_FROM, edges.back()->getID(), undoList);
436 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
437 undoList->end();
438 } else {
439 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
440 }
441 break;
442 }
443 default:
444 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
445 }
446}
447
448
449bool
450GNETranship::isValid(SumoXMLAttr key, const std::string& value) {
451 switch (key) {
452 // Common container plan attributes
453 case SUMO_ATTR_FROM:
454 case SUMO_ATTR_TO:
455 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
457 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
458 case SUMO_ATTR_EDGES:
459 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
460 // all edges exist, then check if compounds a valid route
461 return GNERoute::isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
462 } else {
463 return false;
464 }
465 // specific container plan attributes
466 case SUMO_ATTR_SPEED:
467 return canParse<double>(value) && (parse<double>(value) >= 0);
469 if (value.empty()) {
470 return true;
471 } else if (canParse<double>(value)) {
472 if (isTemplate()) {
473 return true;
474 }
475 const double parsedValue = canParse<double>(value);
476 if ((parsedValue < 0) || (parsedValue > getFirstPathLane()->getLaneShape().length())) {
477 return false;
478 } else {
479 return true;
480 }
481 } else {
482 return false;
483 }
485 if (value.empty()) {
486 return true;
487 } else if (canParse<double>(value)) {
488 if (isTemplate()) {
489 return true;
490 }
491 const double parsedValue = canParse<double>(value);
492 if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
493 return false;
494 } else {
495 return true;
496 }
497 } else {
498 return false;
499 }
501 return canParse<bool>(value);
502 case GNE_ATTR_PARENT:
503 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINER, value, false) != nullptr) {
504 return true;
505 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINERFLOW, value, false) != nullptr) {
506 return true;
507 } else {
508 return false;
509 }
510 default:
511 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
512 }
513}
514
515
516bool
518 if (key == SUMO_ATTR_FROM) {
519 return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
520 } else {
521 return true;
522 }
523}
524
525
526std::string
528 return getTagStr();
529}
530
531
532std::string
535 return "tranship: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
537 return "tranship: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
539 return "tranship: " + getParentEdges().front()->getID() + " ... " + getParentEdges().back()->getID();
540 } else {
541 throw ("Invalid tranship tag");
542 }
543}
544
545
548 return getParametersMap();
549}
550
551// ===========================================================================
552// private
553// ===========================================================================
554
555void
556GNETranship::setAttribute(SumoXMLAttr key, const std::string& value) {
557 switch (key) {
558 // Common container plan attributes
559 case SUMO_ATTR_FROM:
560 // change first edge
562 // compute tranship
564 break;
565 case SUMO_ATTR_TO:
566 // change last edge
568 // compute tranship
570 break;
573 // compute tranship
575 break;
576 case SUMO_ATTR_EDGES:
578 // compute tranship
580 break;
581 // specific container plan attributes
582 case SUMO_ATTR_SPEED:
583 mySpeed = parse<double>(value);
584 break;
586 if (value.empty()) {
587 myDepartPosition = -1;
588 } else {
589 myDepartPosition = parse<double>(value);
590 }
592 break;
594 if (value.empty()) {
596 } else {
597 myArrivalPosition = parse<double>(value);
598 }
600 break;
602 if (parse<bool>(value)) {
604 } else {
606 }
607 break;
608 case GNE_ATTR_PARENT:
609 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINER, value, false) != nullptr) {
611 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINERFLOW, value, false) != nullptr) {
613 }
615 break;
616 default:
617 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
618 }
619}
620
621
622void
624 // change both position
625 myArrivalPosition = moveResult.newFirstPos;
626 // update geometry
628}
629
630
631void
633 undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
634 // now adjust start position
636 undoList->end();
637}
638
639/****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:450
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:460
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:448
@ GLO_TRANSHIP
a container tranship
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ TRANSHIP_FROMTO
@ TRANSPORT_CONTAINERSTOP
@ TRANSHIP_EDGES
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_TRANSHIP
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_CONTAINERFLOW
@ GNE_TAG_TRANSHIP_EDGES
@ SUMO_TAG_CONTAINER
@ GNE_TAG_TRANSHIP_EDGE
@ GNE_TAG_TRANSHIP_CONTAINERSTOP
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_TO_CONTAINERSTOP
to busStop (used by containerPlans)
@ SUMO_ATTR_SPEED
@ SUMO_ATTR_CONTAINER_STOP
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:216
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
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
friend class GNEChange_Attribute
declare friend class
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
bool isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
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
An Element which don't belong to GNENet but has influence in the simulation.
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
Position getPathElementArrivalPos() const
get path element arrival position
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
bool drawContainerPlan() const
check if container plan can be drawn
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform demand element changes
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value)
replace additional parent
Problem
enum class for demandElement problems
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
static const double myPersonPlanArrivalPositionDiameter
person plans arrival position radius
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
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< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:142
move operation
move result
double newFirstPos
new first position
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:132
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:138
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
void calculateConsecutivePathEdges(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEEdge * > edges)
calculate consecutive path edges
void calculatePathLanes(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNELane * > lanes)
calculate path lanes (using dijkstra, require path calculator updated)
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
Definition: GNERoute.cpp:754
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
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 drawGL(const GUIVisualizationSettings &s) const
Draws the object.
~GNETranship()
destructor
Definition: GNETranship.cpp:79
SUMOVehicleClass getVClass() const
double mySpeed
speed
Definition: GNETranship.h:239
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
GNELane * getFirstPathLane() const
get first path lane
GNETranship(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNETranship.cpp:37
bool isAttributeEnabled(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Position getAttributePosition(SumoXMLAttr key) const
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNETranship.cpp:83
Position getPositionInView() const
Returns position of additional in view.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double getAttributeDouble(SumoXMLAttr key) const
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double myArrivalPosition
arrival position
Definition: GNETranship.h:245
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void computePathElement()
compute pathElement
const Parameterised::Map & getACParametersMap() const
get parameters map
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
std::string getParentName() const
Returns the name of the parent object.
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNELane * getLastPathLane() const
get last path lane
const RGBColor & getColor() const
get color
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
double myDepartPosition
depart position
Definition: GNETranship.h:242
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...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:474
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
The popup menu of a globject.
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.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationWidthSettings widthSettings
width settings
GUIVisualizationColorSettings colorSettings
color settings
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
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.
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:257
A list of positions.
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
RGBColor transhipColor
color for tranships