Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNETranship.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2023 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
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
220 Boundary transhipBoundary;
221 // return the combination of all parent edges's boundaries
222 for (const auto& i : getParentEdges()) {
223 transhipBoundary.add(i->getCenteringBoundary());
224 }
225 // check if is valid
226 if (transhipBoundary.isInitialised()) {
227 return transhipBoundary;
228 } else {
229 return Boundary(-0.1, -0.1, 0.1, 0.1);
230 }
231}
232
233
234void
235GNETranship::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
236 // only split geometry of TranshipEdges
238 // obtain new list of tranship edges
239 std::string newTranshipEdges = getNewListOfParents(originalElement, newElement);
240 // update tranship edges
241 if (newTranshipEdges.size() > 0) {
242 setAttribute(SUMO_ATTR_EDGES, newTranshipEdges, undoList);
243 }
244 }
245}
246
247
248void
250 // Tranships are drawn in drawPartialGL
251}
252
253
254void
256 // update lanes depending of tranship tag
258 // calculate consecutive path using parent edges
260 } else {
261 // calculate path
263 }
264 // update geometry
266}
267
268
269void
270GNETranship::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
271 // draw container plan over lane
273}
274
275
276void
277GNETranship::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const {
278 // draw container plan over junction
279 drawPersonPlanPartial(drawContainerPlan(), s, fromLane, toLane, segment, offsetFront, s.widthSettings.transhipWidth, s.colorSettings.transhipColor);
280}
281
282
283GNELane*
285 return getParentEdges().front()->getLaneByAllowedVClass(SVC_PEDESTRIAN);
286}
287
288
289GNELane*
291 if (getParentAdditionals().size() > 0) {
292 return getParentAdditionals().front()->getParentLanes().front();
293 } else {
294 return getParentEdges().back()->getLaneByDisallowedVClass(SVC_PEDESTRIAN);
295 }
296}
297
298
299std::string
301 switch (key) {
302 // Common container plan attributes
303 case SUMO_ATTR_ID:
304 case GNE_ATTR_PARENT:
305 return getParentDemandElements().front()->getID();
306 case SUMO_ATTR_FROM:
307 return getParentEdges().front()->getID();
308 case SUMO_ATTR_TO:
309 return getParentEdges().back()->getID();
311 return getParentAdditionals().back()->getID();
312 case SUMO_ATTR_EDGES:
313 return parseIDs(getParentEdges());
314 // specific container plan attributes
315 case SUMO_ATTR_SPEED:
316 return toString(mySpeed);
318 if (myDepartPosition == -1) {
319 return "";
320 } else {
322 }
324 if (myArrivalPosition == -1) {
325 return "";
326 } else {
328 }
331 default:
332 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
333 }
334}
335
336
337double
339 switch (key) {
341 if (myArrivalPosition != -1) {
342 return myArrivalPosition;
343 } else {
344 return (getLastPathLane()->getLaneShape().length() - POSITION_EPS);
345 }
346 default:
347 throw InvalidArgument(getTagStr() + " doesn't have a doubleattribute of type '" + toString(key) + "'");
348 }
349}
350
351
354 switch (key) {
356 // get lane shape
357 const PositionVector& laneShape = getLastPathLane()->getLaneShape();
358 // continue depending of arrival position
359 if (myArrivalPosition == 0) {
360 return laneShape.front();
361 } else if ((myArrivalPosition == -1) || (myArrivalPosition >= laneShape.length2D())) {
362 return laneShape.back();
363 } else {
364 return laneShape.positionAtOffset2D(myArrivalPosition);
365 }
366 }
367 default:
368 throw InvalidArgument(getTagStr() + " doesn't have a position attribute of type '" + toString(key) + "'");
369 }
370}
371
372
373void
374GNETranship::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
375 if (value == getAttribute(key)) {
376 return; //avoid needless changes, later logic relies on the fact that attributes have changed
377 }
378 switch (key) {
379 // Common container plan attributes
380 case SUMO_ATTR_FROM:
381 case SUMO_ATTR_SPEED:
385 case GNE_ATTR_PARENT:
386 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
387 break;
388 // special case for "to" attributes
389 case SUMO_ATTR_TO: {
390 // get next containerPlan
391 GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
392 // continue depending of nextContainerPlan
393 if (nextContainerPlan) {
394 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
395 nextContainerPlan->setAttribute(SUMO_ATTR_FROM, value, undoList);
396 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
397 undoList->end();
398 } else {
399 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
400 }
401 break;
402 }
404 // get next container plan
405 GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
406 // continue depending of nextContainerPlan
407 if (nextContainerPlan) {
408 // obtain containerStop
410 // change from attribute using edge ID
411 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
412 nextContainerPlan->setAttribute(SUMO_ATTR_FROM, containerStop->getParentLanes().front()->getParentEdge()->getID(), undoList);
413 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
414 undoList->end();
415 } else {
416 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
417 }
418 break;
419 }
420 case SUMO_ATTR_EDGES: {
421 // get next container plan
422 GNEDemandElement* nextContainerPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
423 // continue depending of nextContainerPlan
424 if (nextContainerPlan) {
425 // obtain edges
426 const std::vector<GNEEdge*> edges = parse<std::vector<GNEEdge*> >(myNet, value);
427 // change from attribute using edge ID
428 undoList->begin(myTagProperty.getGUIIcon(), "Change from attribute of next containerPlan");
429 nextContainerPlan->setAttribute(SUMO_ATTR_FROM, edges.back()->getID(), undoList);
430 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
431 undoList->end();
432 } else {
433 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
434 }
435 break;
436 }
437 default:
438 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
439 }
440}
441
442
443bool
444GNETranship::isValid(SumoXMLAttr key, const std::string& value) {
445 switch (key) {
446 // Common container plan attributes
447 case SUMO_ATTR_FROM:
448 case SUMO_ATTR_TO:
449 return SUMOXMLDefinitions::isValidNetID(value) && (myNet->getAttributeCarriers()->retrieveEdge(value, false) != nullptr);
451 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_CONTAINER_STOP, value, false) != nullptr);
452 case SUMO_ATTR_EDGES:
453 if (canParse<std::vector<GNEEdge*> >(myNet, value, false)) {
454 // all edges exist, then check if compounds a valid route
455 return GNERoute::isRouteValid(parse<std::vector<GNEEdge*> >(myNet, value)).empty();
456 } else {
457 return false;
458 }
459 // specific container plan attributes
460 case SUMO_ATTR_SPEED:
461 return canParse<double>(value) && (parse<double>(value) >= 0);
463 if (value.empty()) {
464 return true;
465 } else if (canParse<double>(value)) {
466 if (isTemplate()) {
467 return true;
468 }
469 const double parsedValue = canParse<double>(value);
470 if ((parsedValue < 0) || (parsedValue > getFirstPathLane()->getLaneShape().length())) {
471 return false;
472 } else {
473 return true;
474 }
475 } else {
476 return false;
477 }
479 if (value.empty()) {
480 return true;
481 } else if (canParse<double>(value)) {
482 if (isTemplate()) {
483 return true;
484 }
485 const double parsedValue = canParse<double>(value);
486 if ((parsedValue < 0) || (parsedValue > getLastPathLane()->getLaneShape().length())) {
487 return false;
488 } else {
489 return true;
490 }
491 } else {
492 return false;
493 }
495 return canParse<bool>(value);
496 case GNE_ATTR_PARENT:
497 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINER, value, false) != nullptr) {
498 return true;
499 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINERFLOW, value, false) != nullptr) {
500 return true;
501 } else {
502 return false;
503 }
504 default:
505 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
506 }
507}
508
509
510bool
512 if (key == SUMO_ATTR_FROM) {
513 return (getParentDemandElements().at(0)->getPreviousChildDemandElement(this) == nullptr);
514 } else {
515 return true;
516 }
517}
518
519
520std::string
522 return getTagStr();
523}
524
525
526std::string
529 return "tranship: " + getParentEdges().front()->getID() + " -> " + getParentEdges().back()->getID();
531 return "tranship: " + getParentEdges().front()->getID() + " -> " + getParentAdditionals().back()->getID();
533 return "tranship: " + getParentEdges().front()->getID() + " ... " + getParentEdges().back()->getID();
534 } else {
535 throw ("Invalid tranship tag");
536 }
537}
538
539
544
545// ===========================================================================
546// private
547// ===========================================================================
548
549void
550GNETranship::setAttribute(SumoXMLAttr key, const std::string& value) {
551 switch (key) {
552 // Common container plan attributes
553 case SUMO_ATTR_FROM:
554 // change first edge
556 // compute tranship
558 break;
559 case SUMO_ATTR_TO:
560 // change last edge
562 // compute tranship
564 break;
567 // compute tranship
569 break;
570 case SUMO_ATTR_EDGES:
572 // compute tranship
574 break;
575 // specific container plan attributes
576 case SUMO_ATTR_SPEED:
577 mySpeed = parse<double>(value);
578 break;
580 if (value.empty()) {
581 myDepartPosition = -1;
582 } else {
583 myDepartPosition = parse<double>(value);
584 }
586 break;
588 if (value.empty()) {
590 } else {
591 myArrivalPosition = parse<double>(value);
592 }
594 break;
596 if (parse<bool>(value)) {
598 } else {
600 }
601 break;
602 case GNE_ATTR_PARENT:
603 if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINER, value, false) != nullptr) {
605 } else if (myNet->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_CONTAINERFLOW, value, false) != nullptr) {
607 }
609 break;
610 default:
611 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
612 }
613}
614
615
616void
618 // change both position
619 myArrivalPosition = moveResult.newFirstPos;
620 // update geometry
622}
623
624
625void
627 undoList->begin(myTagProperty.getGUIIcon(), "arrivalPos of " + getTagStr());
628 // now adjust start position
630 undoList->end();
631}
632
633/****************************************************************************/
@ 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:462
@ 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.
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
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
void replaceFirstParentAdditional(SumoXMLTag tag, const std::string &value)
replace the first parent additional
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
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:136
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:120
GNEPathManager * getPathManager()
get path manager
Definition GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
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:758
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
SUMOVehicleClass getVClass() const
double mySpeed
speed
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
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
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
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)
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
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.
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
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.
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.
std::map< std::string, std::string > Map
parameters map
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:259
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