Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEPerson.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-2025 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// Representation of persons in netedit
19/****************************************************************************/
20
22#include <netedit/GNENet.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNEViewNet.h>
32
33#include "GNEPerson.h"
34#include "GNERouteHandler.h"
35
36// ===========================================================================
37// FOX callback mapping
38// ===========================================================================
39
43
47
48// Object implementation
49FXIMPLEMENT(GNEPerson::GNEPersonPopupMenu, GUIGLObjectPopupMenu, personPopupMenuMap, ARRAYNUMBER(personPopupMenuMap))
50FXIMPLEMENT(GNEPerson::GNESelectedPersonsPopupMenu, GUIGLObjectPopupMenu, selectedPersonsPopupMenuMap, ARRAYNUMBER(selectedPersonsPopupMenuMap))
51
52// ===========================================================================
53// GNEPerson::GNEPersonPopupMenu
54// ===========================================================================
55
57 GUIGLObjectPopupMenu(app, parent, person),
58 myPerson(person),
59 myTransformToPerson(nullptr),
60 myTransformToPersonFlow(nullptr) {
61 // build common options
62 person->buildPopUpMenuCommonOptions(this, app, person->myNet->getViewNet(), person->getTagProperty()->getTag(), person->isAttributeCarrierSelected());
63 // add transform functions only in demand mode
64 if (myPerson->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
65 // create menu pane for transform operations
66 FXMenuPane* transformOperation = new FXMenuPane(this);
67 this->insertMenuPaneChild(transformOperation);
68 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
69 // Create menu comands for all transformations
70 myTransformToPerson = GUIDesigns::buildFXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(GUIIcon::PERSON), this, MID_GNE_PERSON_TRANSFORM);
71 myTransformToPersonFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "PersonFlow", GUIIconSubSys::getIcon(GUIIcon::PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
72 // check what menu command has to be disabled
73 if (myPerson->getTagProperty()->getTag() == SUMO_TAG_PERSON) {
74 myTransformToPerson->disable();
75 } else if (myPerson->getTagProperty()->getTag() == SUMO_TAG_PERSONFLOW) {
76 myTransformToPersonFlow->disable();
77 }
78 }
79}
80
81
83
84
85long
86GNEPerson::GNEPersonPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
87 if (obj == myTransformToPerson) {
89 } else if (obj == myTransformToPersonFlow) {
91 }
92 return 1;
93}
94
95
96// ===========================================================================
97// GNEPerson::GNESelectedPersonsPopupMenu
98// ===========================================================================
99
100GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent) :
101 GUIGLObjectPopupMenu(app, parent, person),
102 myPersonTag(person->getTagProperty()->getTag()),
103 mySelectedPersons(selectedPerson),
104 myTransformToPerson(nullptr),
105 myTransformToPersonFlow(nullptr) {
106 // build common options
107 person->buildPopUpMenuCommonOptions(this, app, person->myNet->getViewNet(), person->myTagProperty->getTag(), person->isAttributeCarrierSelected());
108 // add transform functions only in demand mode
110 // create menu pane for transform operations
111 FXMenuPane* transformOperation = new FXMenuPane(this);
112 this->insertMenuPaneChild(transformOperation);
113 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
114 // Create menu comands for all transformations
117 }
118}
119
120
122
123
124long
126 // iterate over all selected persons
127 for (const auto& i : mySelectedPersons) {
128 if ((obj == myTransformToPerson) &&
129 (i->getTagProperty()->getTag() == myPersonTag)) {
131 } else if ((obj == myTransformToPersonFlow) &&
132 (i->getTagProperty()->getTag() == myPersonTag)) {
134 }
135 }
136 return 1;
137}
138
139// ===========================================================================
140// member method definitions
141// ===========================================================================
142#ifdef _MSC_VER
143#pragma warning(push)
144#pragma warning(disable: 4355) // mask warning about "this" in initializers
145#endif
149 // enable set and persons per hour as default flow values
152}
153
154
155GNEPerson::GNEPerson(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters) :
156 GNEDemandElement(personparameters.id, net, filename, tag, GNEPathElement::Options::DEMAND_ELEMENT),
157 GNEDemandElementFlow(this, personparameters) {
158 // set parents
159 setParent<GNEDemandElement*>(pType);
160 // set manually vtypeID (needed for saving)
161 vtypeid = pType->getID();
162}
163#ifdef _MSC_VER
164#pragma warning(pop)
165#endif
166
168
169
172 const auto firstContainerPlan = getChildDemandElements().front();
173 // check first person plan
174 if (firstContainerPlan->getTagProperty()->isPlanStopPerson()) {
175 return nullptr;
176 } else if (firstContainerPlan->getParentEdges().size() > 0) {
177 // get lane
178 const GNELane* lane = firstContainerPlan->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
179 // declare departPos
180 double posOverLane = 0;
181 if (canParse<double>(getDepartPos())) {
182 posOverLane = parse<double>(getDepartPos());
183 }
184 // return move operation
185 return new GNEMoveOperation(this, lane, posOverLane, false);
186 } else {
187 return nullptr;
188 }
189}
190
191
192void
194 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
196 // unset VType parameter
197 parametersSet &= ~VEHPARS_VTYPE_SET;
198 // write person attributes (VType will not be written)
200 // set VType parameter again
202 } else {
203 // write person attributes, including VType
205 }
206 // write flow attributes
207 writeFlowAttributes(this, device);
208 // write parameters
209 writeParams(device);
210 // write child demand elements associated to this person (Rides, Walks...)
211 for (const auto& i : getChildDemandElements()) {
212 i->writeDemandElement(device);
213 }
214 // close person tag
215 device.closeTag();
216}
217
218
221 if (getChildDemandElements().size() == 0) {
222 return Problem::NO_PLANS;
223 } else {
224 return Problem::OK;
225 }
226}
227
228
229std::string
231 if (getChildDemandElements().size() == 0) {
232 return "Person needs at least one plan";
233 } else {
234 return "";
235 }
236}
237
238
239void
241 // nothing to fix
242}
243
244
247 return getParentDemandElements().front()->getVClass();
248}
249
250
251const RGBColor&
253 return color;
254}
255
256
257void
259 // only update geometry of childrens
260 for (const auto& demandElement : getChildDemandElements()) {
261 demandElement->updateGeometry();
262 }
263}
264
265
270
271
274 // return a GNEPersonPopupMenu
275 return new GNEPersonPopupMenu(this, app, parent);
276}
277
278
279std::string
281 return getParentDemandElements().front()->getID();
282}
283
284
285double
287 return s.personSize.getExaggeration(s, this, 80);
288}
289
290
293 Boundary personBoundary;
294 if (getChildDemandElements().size() > 0) {
295 if (getChildDemandElements().front()->getTagProperty()->isPlanStopPerson()) {
296 // use boundary of stop center
297 return getChildDemandElements().front()->getCenteringBoundary();
298 } else {
299 personBoundary.add(getPositionInView());
300 }
301 } else {
302 personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
303 }
304 personBoundary.grow(20);
305 return personBoundary;
306}
307
308
309void
310GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
311 // geometry of this element cannot be splitted
312}
313
314
315void
317 bool drawPerson = true;
318 // check if person can be drawn
320 drawPerson = false;
322 drawPerson = false;
324 drawPerson = false;
325 } else if (getChildDemandElements().empty()) {
326 drawPerson = false;
327 }
328 // continue if person can be drawn
329 if (drawPerson) {
330 // obtain exaggeration (and add the special personExaggeration)
331 const double exaggeration = getExaggeration(s) + 10;
332 // obtain position
333 const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
334 if (personPosition == Position::INVALID) {
335 return;
336 }
337 // get detail level
338 const auto d = s.getDetailLevel(exaggeration);
339 // draw geometry only if we'rent in drawForObjectUnderCursor mode
341 // obtain width and length
342 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
343 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
344 // obtain img file
345 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
346 // push draw matrix
348 // Start with the drawing of the area traslating matrix to origin
350 // translate and rotate
351 glTranslated(personPosition.x(), personPosition.y(), 0);
352 glRotated(90, 0, 0, 1);
353 // set person color
355 // set scale
356 glScaled(exaggeration, exaggeration, 1);
357 // draw person depending of detail level
358 if (s.personQuality >= 2) {
360 } else if (s.personQuality == 1) {
361 GUIBasePersonHelper::drawAction_drawAsCenteredCircle(length / 2, width / 2, s.scale * exaggeration);
362 } else if (s.personQuality == 0) {
364 }
365 // pop matrix
367 // draw stack label
368 if (myStackedLabelNumber > 0) {
369 drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
370 } else if ((getChildDemandElements().front()->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
372 // declare counter for stacked persons over stops
373 int stackedCounter = 0;
374 // get stoppingPlace
375 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
376 // get stacked persons
377 for (const auto& stopPerson : stoppingPlace->getChildDemandElements()) {
378 if ((stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
379 (stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_TRAINSTOP)) {
380 // get person parent
381 const auto personParent = stopPerson->getParentDemandElements().front();
382 // check if the stop if the first person plan parent
383 if (stopPerson->getPreviousChildDemandElement(personParent) == nullptr) {
384 stackedCounter++;
385 }
386 }
387 }
388 // if we have more than two stacked elements, draw label
389 if (stackedCounter > 1) {
390 drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
391 }
392 }
393 // draw flow label
394 if (myTagProperty->isFlow()) {
395 drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s));
396 }
397 // draw lock icon
398 GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), personPosition, exaggeration, s.dottedContourSettings.segmentWidth);
399 // draw name
400 drawName(personPosition, s.scale, s.personName, s.angle);
401 if (s.personValue.show(this)) {
402 Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
403 const double value = getColorValue(s, s.personColorer.getActive());
404 GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
405 }
406 // draw dotted contour
408 }
409 // calculate contour
410 myPersonContour.calculateContourRectangleShape(s, d, this, personPosition, 0.1, 0.2, getType(), -1.1, 0, 0, exaggeration, nullptr);
411 }
412}
413
414
415void
417 // compute all person plan children (because aren't computed in "computeDemandElements()")
418 for (const auto& demandElement : getChildDemandElements()) {
419 demandElement->computePathElement();
420 }
421}
422
423
424void
425GNEPerson::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
426 // Stops don't use drawJunctionPartialGL
427}
428
429
430void
431GNEPerson::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
432 // Stops don't use drawJunctionPartialGL
433}
434
435
436GNELane*
438 // use path lane of first person plan
439 return getChildDemandElements().front()->getFirstPathLane();
440}
441
442
443GNELane*
445 // use path lane of first person plan
446 return getChildDemandElements().front()->getLastPathLane();
447}
448
449
450std::string
452 // declare string error
453 std::string error;
454 switch (key) {
455 case SUMO_ATTR_ID:
456 return getMicrosimID();
457 case SUMO_ATTR_TYPE:
458 return getTypeParent()->getID();
459 case SUMO_ATTR_COLOR:
461 return toString(color);
462 } else {
464 }
467 return getDepartPos();
468 } else {
470 }
471 default:
472 return getFlowAttribute(this, key);
473 }
474}
475
476
477double
479 switch (key) {
482 return departPos;
483 } else {
484 return 0;
485 }
486 default:
487 return getFlowAttributeDouble(key);
488 }
489}
490
491
494 switch (key) {
495 case SUMO_ATTR_DEPARTPOS: {
496 // first check number of child demand elements
497 if (getChildDemandElements().empty()) {
498 return Position();
499 }
500 // get person plan
501 const GNEDemandElement* personPlan = getChildDemandElements().front();
502 // first check if first person plan is a stop
503 if (personPlan->getTagProperty()->isPlanStopPerson()) {
504 // stop center
505 return personPlan->getPositionInView();
506 } else if (personPlan->getTagProperty()->planFromTAZ()) {
507 // TAZ
508 if (personPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) {
509 return personPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID);
510 } else {
511 return personPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
512 }
513 } else if (personPlan->getTagProperty()->planFromJunction()) {
514 // juncrtion
515 return personPlan->getParentJunctions().front()->getPositionInView();
516 } else {
518 }
519 }
520 default:
521 throw InvalidArgument(getTagStr() + " doesn't have a Position attribute of type '" + toString(key) + "'");
522 }
523}
524
525
526void
527GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
528 switch (key) {
529 case SUMO_ATTR_ID:
530 case SUMO_ATTR_TYPE:
531 case SUMO_ATTR_COLOR:
533 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
534 break;
535 default:
536 setFlowAttribute(this, key, value, undoList);
537 break;
538 }
539}
540
541
542bool
543GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
544 // declare string error
545 std::string error;
546 switch (key) {
547 case SUMO_ATTR_ID:
549 case SUMO_ATTR_TYPE:
550 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) != nullptr);
551 case SUMO_ATTR_COLOR:
552 return canParse<RGBColor>(value);
553 case SUMO_ATTR_DEPARTPOS: {
554 double dummyDepartPos;
555 DepartPosDefinition dummyDepartPosProcedure;
556 parseDepartPos(value, toString(SUMO_TAG_PERSON), id, dummyDepartPos, dummyDepartPosProcedure, error);
557 // if error is empty, given value is valid
558 return error.empty();
559 }
560 default:
561 return isValidFlowAttribute(this, key, value);
562 }
563}
564
565
566void
568 enableFlowAttribute(this, key, undoList);
569}
570
571
572void
574 disableFlowAttribute(this, key, undoList);
575}
576
577
578bool
582
583
584std::string
586 return getTagStr();
587}
588
589
590std::string
592 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
593}
594
595
600
601// ===========================================================================
602// protected
603// ===========================================================================
604
609 } else {
610 return getColorByScheme(s.personColorer, this);
611 }
612}
613
614// ===========================================================================
615// private
616// ===========================================================================
617
619 personPlan(_personPlan),
620 edge(nullptr),
621 arrivalPos(-1) {
622}
623
624
626 personPlan(nullptr),
627 edge(nullptr),
628 arrivalPos(-1) {
629}
630
631
632void
633GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
634 // declare string error
635 std::string error;
636 switch (key) {
637 case SUMO_ATTR_ID:
638 // update microsimID
639 setDemandElementID(value);
640 // update id
641 id = value;
642 break;
643 case SUMO_ATTR_TYPE:
644 if (getID().size() > 0) {
646 // set manually vtypeID (needed for saving)
647 vtypeid = value;
648 }
649 break;
650 case SUMO_ATTR_COLOR:
651 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
652 color = parse<RGBColor>(value);
653 // mark parameter as set
655 } else {
656 // set default value
657 color = parse<RGBColor>(myTagProperty->getDefaultStringValue(key));
658 // unset parameter
659 parametersSet &= ~VEHPARS_COLOR_SET;
660 }
661 break;
663 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
665 // mark parameter as set
667 } else {
668 // set default value
670 // unset parameter
671 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
672 }
673 // compute person
675 break;
676 default:
677 setFlowAttribute(this, key, value);
678 break;
679 }
680}
681
682
683void
685 // toggle flow attributes
686 toggleFlowAttribute(key, value);
687}
688
689
690void
692 // change departPos
694 departPos = moveResult.newFirstPos;
695 // update geometry
697}
698
699
700void
702 undoList->begin(this, "departPos of " + getTagStr());
703 // now set departPos
705 undoList->end();
706}
707
708/****************************************************************************/
FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[]
@ MID_GNE_PERSON_TRANSFORM
transform person to another person type (ej: person to personflow)
@ GLO_MAX
empty max
const std::string DEFAULT_PEDTYPE_ID
@ PEDESTRIAN
render as a pedestrian
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
DepartPosDefinition
Possible ways to choose the departure position.
@ GIVEN
The position is given.
const long long int VEHPARS_COLOR_SET
const long long int VEHPARS_DEPARTPOS_SET
const long long int VEHPARS_VTYPE_SET
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ GNE_TAG_STOPPERSON_BUSSTOP
@ SUMO_TAG_PERSON
@ GNE_TAG_STOPPERSON_TRAINSTOP
@ SUMO_TAG_PERSONFLOW
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_PLAN_GEOMETRY_STARTPOS
person/container geometry start position
@ GNE_ATTR_TAZ_CENTROID
TAZ Center (uses to return the TAZ centroid if center is not defined)
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_CENTER
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_PERSONSPERHOUR
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:75
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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)
Definition GLHelper.cpp:779
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::string & getTagStr() const
get tag assigned to this object in string format
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
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
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...)
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double layer, const double offsetX, const double offsetY, const double rot, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (for rectangled elements)
void toggleFlowAttribute(const SumoXMLAttr attribute, const bool value)
toggle flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers
void drawFlowLabel(const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw flow label
std::string getFlowAttribute(const GNEDemandElement *flowElement, SumoXMLAttr key) const
inherited from GNEAttributeCarrier and adapted to GNEDemandElementFlow
void disableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
bool isFlowAttributeEnabled(SumoXMLAttr key) const
double getFlowAttributeDouble(SumoXMLAttr key) const
bool isValidFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value)
void writeFlowAttributes(const GNEDemandElement *flowElement, OutputDevice &device) const
write flow attributes
void enableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
void setFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void drawStackLabel(const int number, const std::string &element, const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw stack label
virtual double getAttributeDouble(SumoXMLAttr key) const =0
bool isValidDemandElementID(const std::string &value) const
check if a new demand element ID is valid
virtual std::string getAttribute(SumoXMLAttr key) const =0
void setDemandElementID(const std::string &newID)
set demand element id
GNEDemandElement * getTypeParent() const
get type parent (needed because first parent can be either type or typeDistribution)
int myStackedLabelNumber
stacked label number
virtual Position getPositionInView() const =0
Returns position of demand element in view.
RGBColor getColorByScheme(const GUIColorer &c, const SUMOVehicleParameter *parameters) const
get color by scheme (used by vehicles, persons and containers)
Problem
enum class for demandElement problems
virtual Position getAttributePosition(SumoXMLAttr key) const =0
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const GNEHierarchicalContainerParents< GNEEdge * > & getParentEdges() const
get parent edges
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move operation
move result
double newFirstPos
new first position
GNEDemandElement * retrieveDemandElements(const std::vector< SumoXMLTag > types, 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:146
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2194
class used in GUIGLObjectPopupMenu for person transformations
Definition GNEPerson.h:36
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition GNEPerson.cpp:86
class used in GUIGLObjectPopupMenu for single person transformations
Definition GNEPerson.h:68
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition GNEPerson.h:97
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition GNEPerson.h:100
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEMoveOperation * getMoveOperation()
get move operation
Position getPositionInView() const
Returns position of demand element in view.
void updateGeometry()
update pre-computed geometry information
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
const RGBColor & getColor() const
get color
bool isAttributeEnabled(SumoXMLAttr key) const
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
GNELane * getLastPathLane() const
get last path lane
Position getAttributePosition(SumoXMLAttr key) const
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEPerson()
destructor
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void computePathElement()
compute pathElement
std::string getParentName() const
Returns the name of the parent object.
GNEContour myPersonContour
variable used for contours
Definition GNEPerson.h:278
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
const Parameterised::Map & getACParametersMap() const
get parameters map
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
double getAttributeDouble(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
GNELane * getFirstPathLane() const
get first path lane
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
bool planFromJunction() const
return true if tag correspond to a plan that starts in junction
bool isFlow() const
return true if tag correspond to a flow element
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool planFromTAZ() const
return true if tag correspond to a plan that starts in TAZ
SumoXMLTag getXMLTag() const
default values
bool isPlanStopPerson() const
return true if tag correspond to a person stop plan
const std::string & getDefaultStringValue(SumoXMLAttr attr) const
default values
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
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static void drawAction_drawAsImage(const double angle, const double length, const double width, const std::string &file, const SUMOVehicleShape guiShape, const double exaggeration)
static void drawAction_drawAsCenteredCircle(const double length, const double width, double detail)
static void drawAction_drawAsTriangle(const double angle, const double length, const double width)
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
The popup menu of a globject.
void insertMenuPaneChild(FXMenuPane *child)
Insert a sub-menu pane in this GUIGLObjectPopupMenu.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual double getColorValue(const GUIVisualizationSettings &, int) const
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)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Stores the information about how to visualize structures.
GUIVisualizationTextSettings personValue
int personQuality
The quality of person drawing.
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationSizeSettings personSize
GUIVisualizationColorSettings colorSettings
color settings
GUIColorer personColorer
The person colorer.
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
bool checkDrawPerson(Detail d, const bool selected) const
check if draw person
GUIVisualizationTextSettings personName
double angle
The current view rotation angle.
static const std::vector< SumoXMLTag > types
type namespace
static const std::vector< SumoXMLTag > persons
persons namespace
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
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.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:319
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
Structure representing possible vehicle parameter.
SumoXMLTag tag
The vehicle tag.
std::string vtypeid
The vehicle's type id.
long long int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag altTag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
bool wasSet(long long int what) const
Returns whether the given parameter was set.
double departPos
(optional) The position the vehicle shall depart from
RGBColor color
The vehicle's color, TraCI may change this.
double arrivalPos
(optional) The position the vehicle shall arrive on
std::string getDepartPos() const
obtain depart pos parameter in string format
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
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
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool showDemandElements() const
check if show demand elements checkbox is enabled
RGBColor selectedPersonColor
person selection color
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
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size