Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
24#include <netedit/GNENet.h>
31
32#include "GNEPerson.h"
33#include "GNERouteHandler.h"
34
35// ===========================================================================
36// FOX callback mapping
37// ===========================================================================
38
42
46
47// Object implementation
48FXIMPLEMENT(GNEPerson::GNEPersonPopupMenu, GUIGLObjectPopupMenu, personPopupMenuMap, ARRAYNUMBER(personPopupMenuMap))
49FXIMPLEMENT(GNEPerson::GNESelectedPersonsPopupMenu, GUIGLObjectPopupMenu, selectedPersonsPopupMenuMap, ARRAYNUMBER(selectedPersonsPopupMenuMap))
50
51// ===========================================================================
52// GNEPerson::GNEPersonPopupMenu
53// ===========================================================================
54
56 GUIGLObjectPopupMenu(app, parent, person),
57 myPerson(person),
58 myTransformToPerson(nullptr),
59 myTransformToPersonFlow(nullptr) {
60 // build common options
61 person->buildPopUpMenuCommonOptions(this, app, person->myNet->getViewNet(), person->getTagProperty()->getTag(), person->isAttributeCarrierSelected());
62 // add transform functions only in demand mode
63 if (myPerson->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
64 // create menu pane for transform operations
65 FXMenuPane* transformOperation = new FXMenuPane(this);
66 this->insertMenuPaneChild(transformOperation);
67 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
68 // Create menu comands for all transformations
69 myTransformToPerson = GUIDesigns::buildFXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(GUIIcon::PERSON), this, MID_GNE_PERSON_TRANSFORM);
70 myTransformToPersonFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "PersonFlow", GUIIconSubSys::getIcon(GUIIcon::PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
71 // check what menu command has to be disabled
72 if (myPerson->getTagProperty()->getTag() == SUMO_TAG_PERSON) {
73 myTransformToPerson->disable();
74 } else if (myPerson->getTagProperty()->getTag() == SUMO_TAG_PERSONFLOW) {
75 myTransformToPersonFlow->disable();
76 }
77 }
78}
79
80
82
83
84long
85GNEPerson::GNEPersonPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
86 if (obj == myTransformToPerson) {
88 } else if (obj == myTransformToPersonFlow) {
90 }
91 return 1;
92}
93
94
95// ===========================================================================
96// GNEPerson::GNESelectedPersonsPopupMenu
97// ===========================================================================
98
99GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent) :
100 GUIGLObjectPopupMenu(app, parent, person),
101 myPersonTag(person->getTagProperty()->getTag()),
102 mySelectedPersons(selectedPerson),
103 myTransformToPerson(nullptr),
104 myTransformToPersonFlow(nullptr) {
105 // build common options
106 person->buildPopUpMenuCommonOptions(this, app, person->myNet->getViewNet(), person->myTagProperty->getTag(), person->isAttributeCarrierSelected());
107 // add transform functions only in demand mode
109 // create menu pane for transform operations
110 FXMenuPane* transformOperation = new FXMenuPane(this);
111 this->insertMenuPaneChild(transformOperation);
112 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
113 // Create menu comands for all transformations
116 }
117}
118
119
121
122
123long
125 // iterate over all selected persons
126 for (const auto& i : mySelectedPersons) {
127 if ((obj == myTransformToPerson) &&
128 (i->getTagProperty()->getTag() == myPersonTag)) {
130 } else if ((obj == myTransformToPersonFlow) &&
131 (i->getTagProperty()->getTag() == myPersonTag)) {
133 }
134 }
135 return 1;
136}
137
138// ===========================================================================
139// member method definitions
140// ===========================================================================
141#ifdef _MSC_VER
142#pragma warning(push)
143#pragma warning(disable: 4355) // mask warning about "this" in initializers
144#endif
146 GNEDemandElement(net, tag),
149 // enable set and persons per hour as default flow values
152}
153
154
156 const SUMOVehicleParameter& personparameters) :
157 GNEDemandElement(personparameters.id, net, tag, fileBucket),
158 GNEDemandElementFlow(this, personparameters),
159 myMoveElementPlanParent(new GNEMoveElementPlanParent(this, departPos, departPosProcedure)) {
160 // set parents
161 setParent<GNEDemandElement*>(pType);
162 // set manually vtypeID (needed for saving)
163 vtypeid = pType->getID();
164}
165#ifdef _MSC_VER
166#pragma warning(pop)
167#endif
168
170
171
176
177
180 return this;
181}
182
183
184const Parameterised*
186 return this;
187}
188
189
190void
192 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
194 // unset VType parameter
195 parametersSet &= ~VEHPARS_VTYPE_SET;
196 // write person attributes (VType will not be written)
198 // set VType parameter again
200 } else {
201 // write person attributes, including VType
203 }
204 // write parameters
205 writeParams(device);
206 // write child demand elements associated to this person (Rides, Walks...)
207 for (const auto& i : getChildDemandElements()) {
208 i->writeDemandElement(device);
209 }
210 // close person tag
211 device.closeTag();
212}
213
214
217 if (getChildDemandElements().size() == 0) {
218 return Problem::NO_PLANS;
219 } else {
220 return Problem::OK;
221 }
222}
223
224
225std::string
227 if (getChildDemandElements().size() == 0) {
228 return "Person needs at least one plan";
229 } else {
230 return "";
231 }
232}
233
234
235void
237 // nothing to fix
238}
239
240
243 return getParentDemandElements().front()->getVClass();
244}
245
246
247const RGBColor&
249 return color;
250}
251
252
253void
255 // only update geometry of childrens
256 for (const auto& demandElement : getChildDemandElements()) {
257 demandElement->updateGeometry();
258 }
259}
260
261
266
267
270 // return a GNEPersonPopupMenu
271 return new GNEPersonPopupMenu(this, app, parent);
272}
273
274
275std::string
277 return getParentDemandElements().front()->getID();
278}
279
280
281double
283 return s.personSize.getExaggeration(s, this, 80);
284}
285
286
289 Boundary personBoundary;
290 if (getChildDemandElements().size() > 0) {
291 if (getChildDemandElements().front()->getTagProperty()->isPlanStopPerson()) {
292 // use boundary of stop center
293 return getChildDemandElements().front()->getCenteringBoundary();
294 } else {
295 personBoundary.add(getPositionInView());
296 }
297 } else {
298 personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
299 }
300 personBoundary.grow(20);
301 return personBoundary;
302}
303
304
305void
306GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
307 // geometry of this element cannot be splitted
308}
309
310
311void
313 bool drawPerson = true;
314 // check if person can be drawn
316 drawPerson = false;
318 drawPerson = false;
320 drawPerson = false;
321 } else if (getChildDemandElements().empty()) {
322 drawPerson = false;
323 }
324 // continue if person can be drawn
325 if (drawPerson) {
326 // obtain exaggeration (and add the special personExaggeration)
327 const double exaggeration = getExaggeration(s) + 10;
328 // obtain position
329 const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
330 if (personPosition == Position::INVALID) {
331 return;
332 }
333 // get detail level
334 const auto d = s.getDetailLevel(exaggeration);
335 // draw geometry only if we'rent in drawForObjectUnderCursor mode
337 // obtain width and length
338 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
339 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
340 // obtain img file
341 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
342 // push draw matrix
344 // Start with the drawing of the area traslating matrix to origin
346 // translate and rotate
347 glTranslated(personPosition.x(), personPosition.y(), 0);
348 glRotated(90, 0, 0, 1);
349 // set person color
351 // set scale
352 glScaled(exaggeration, exaggeration, 1);
353 // draw person depending of detail level
354 if (s.personQuality >= 2) {
356 } else if (s.personQuality == 1) {
357 GUIBasePersonHelper::drawAction_drawAsCenteredCircle(length / 2, width / 2, s.scale * exaggeration);
358 } else if (s.personQuality == 0) {
360 }
361 // pop matrix
363 // draw stack label
364 if (myStackedLabelNumber > 0) {
365 drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
366 } else if ((getChildDemandElements().front()->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
368 // declare counter for stacked persons over stops
369 int stackedCounter = 0;
370 // get stoppingPlace
371 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
372 // get stacked persons
373 for (const auto& stopPerson : stoppingPlace->getChildDemandElements()) {
374 if ((stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
375 (stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_TRAINSTOP)) {
376 // get person parent
377 const auto personParent = stopPerson->getParentDemandElements().front();
378 // check if the stop if the first person plan parent
379 if (stopPerson->getPreviousChildDemandElement(personParent) == nullptr) {
380 stackedCounter++;
381 }
382 }
383 }
384 // if we have more than two stacked elements, draw label
385 if (stackedCounter > 1) {
386 drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
387 }
388 }
389 // draw flow label
390 if (myTagProperty->isFlow()) {
391 drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s));
392 }
393 // draw lock icon
394 GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), personPosition, exaggeration, s.dottedContourSettings.segmentWidth);
395 // draw name
396 drawName(personPosition, s.scale, s.personName, s.angle);
397 if (s.personValue.show(this)) {
398 Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
399 const double value = getColorValue(s, s.personColorer.getActive());
400 GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
401 }
402 // draw dotted contour
404 }
405 // calculate contour
406 myPersonContour.calculateContourRectangleShape(s, d, this, personPosition, 0.1, 0.2, getType(), -1.1, 0, 0, exaggeration, nullptr);
407 }
408}
409
410
411void
413 // compute all person plan children (because aren't computed in "computeDemandElements()")
414 for (const auto& demandElement : getChildDemandElements()) {
415 demandElement->computePathElement();
416 }
417}
418
419
420void
421GNEPerson::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
422 // Stops don't use drawJunctionPartialGL
423}
424
425
426void
427GNEPerson::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
428 // Stops don't use drawJunctionPartialGL
429}
430
431
432GNELane*
434 // use path lane of first person plan
435 return getChildDemandElements().front()->getFirstPathLane();
436}
437
438
439GNELane*
441 // use path lane of first person plan
442 return getChildDemandElements().front()->getLastPathLane();
443}
444
445
446std::string
448 // declare string error
449 std::string error;
450 switch (key) {
451 case SUMO_ATTR_ID:
452 return getMicrosimID();
453 case SUMO_ATTR_TYPE:
454 return getTypeParent()->getID();
455 case SUMO_ATTR_COLOR:
457 return toString(color);
458 } else {
460 }
463 return getDepartPos();
464 } else {
466 }
467 default:
468 return getFlowAttribute(this, key);
469 }
470}
471
472
473double
475 switch (key) {
478 return departPos;
479 } else {
480 return 0;
481 }
482 default:
483 return getFlowAttributeDouble(key);
484 }
485}
486
487
490 switch (key) {
491 case SUMO_ATTR_DEPARTPOS: {
492 // first check number of child demand elements
493 if (getChildDemandElements().empty()) {
494 return Position();
495 }
496 // get person plan
497 const GNEDemandElement* personPlan = getChildDemandElements().front();
498 // first check if first person plan is a stop
499 if (personPlan->getTagProperty()->isPlanStopPerson()) {
500 // stop center
501 return personPlan->getPositionInView();
502 } else if (personPlan->getTagProperty()->planFromTAZ()) {
503 // TAZ
504 if (personPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) {
505 return personPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID);
506 } else {
507 return personPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
508 }
509 } else if (personPlan->getTagProperty()->planFromJunction()) {
510 // juncrtion
511 return personPlan->getParentJunctions().front()->getPositionInView();
512 } else {
514 }
515 }
516 default:
517 return getCommonAttributePosition(key);
518 }
519}
520
521
522void
523GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
524 switch (key) {
525 case SUMO_ATTR_ID:
526 case SUMO_ATTR_TYPE:
527 case SUMO_ATTR_COLOR:
529 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
530 break;
531 default:
532 setFlowAttribute(this, key, value, undoList);
533 break;
534 }
535}
536
537
538bool
539GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
540 // declare string error
541 std::string error;
542 switch (key) {
543 case SUMO_ATTR_ID:
545 case SUMO_ATTR_TYPE:
546 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) != nullptr);
547 case SUMO_ATTR_COLOR:
548 return canParse<RGBColor>(value);
549 case SUMO_ATTR_DEPARTPOS: {
550 double dummyDepartPos;
551 DepartPosDefinition dummyDepartPosProcedure;
552 parseDepartPos(value, toString(SUMO_TAG_PERSON), id, dummyDepartPos, dummyDepartPosProcedure, error);
553 // if error is empty, given value is valid
554 return error.empty();
555 }
556 default:
557 return isValidFlowAttribute(this, key, value);
558 }
559}
560
561
562void
564 enableFlowAttribute(this, key, undoList);
565}
566
567
568void
570 disableFlowAttribute(this, key, undoList);
571}
572
573
574bool
578
579
580std::string
582 return getTagStr();
583}
584
585
586std::string
588 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
589}
590
591// ===========================================================================
592// protected
593// ===========================================================================
594
599 } else {
600 return getColorByScheme(s.personColorer, this);
601 }
602}
603
604// ===========================================================================
605// private
606// ===========================================================================
607
609 personPlan(_personPlan),
610 edge(nullptr),
611 arrivalPos(-1) {
612}
613
614
616 personPlan(nullptr),
617 edge(nullptr),
618 arrivalPos(-1) {
619}
620
621
622void
623GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
624 // declare string error
625 std::string error;
626 switch (key) {
627 case SUMO_ATTR_ID:
628 // update microsimID
629 setDemandElementID(value);
630 // update id
631 id = value;
632 break;
633 case SUMO_ATTR_TYPE:
634 if (getID().size() > 0) {
636 // set manually vtypeID (needed for saving)
637 vtypeid = value;
638 }
639 break;
640 case SUMO_ATTR_COLOR:
641 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
642 color = parse<RGBColor>(value);
643 // mark parameter as set
645 } else {
646 // set default value
647 color = parse<RGBColor>(myTagProperty->getDefaultStringValue(key));
648 // unset parameter
649 parametersSet &= ~VEHPARS_COLOR_SET;
650 }
651 break;
653 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
655 // mark parameter as set
657 } else {
658 // set default value
660 // unset parameter
661 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
662 }
663 // compute person
665 break;
666 default:
667 setFlowAttribute(this, key, value);
668 break;
669 }
670}
671
672
673void
675 // toggle flow attributes
676 toggleFlowAttribute(key, value);
677}
678
679/****************************************************************************/
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.
@ 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:773
virtual double getAttributeDouble(SumoXMLAttr key) const =0
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::string getID() const override
get ID (all Attribute Carriers have one)
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
Position getCommonAttributePosition(SumoXMLAttr key) const
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
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 enableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
void setFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Position getAttributePosition(SumoXMLAttr key) const override
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
bool isValidDemandElementID(const std::string &value) const
check if a new demand element ID is valid
void setDemandElementID(const std::string &newID)
set demand element id
GNEDemandElement * getTypeParent() const
get type parent (needed because first parent can be either type or typeDistribution)
void replaceDemandElementParent(const std::vector< SumoXMLTag > tags, const std::string &value, const int parentIndex)
replace demand element parent
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
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const GNEHierarchicalContainerParents< GNEJunction * > & getParentJunctions() const
get parent junctions
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
GNEDemandElement * retrieveDemandElements(const std::vector< SumoXMLTag > types, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
class used in GUIGLObjectPopupMenu for person transformations
Definition GNEPerson.h:42
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition GNEPerson.cpp:85
class used in GUIGLObjectPopupMenu for single person transformations
Definition GNEPerson.h:74
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition GNEPerson.cpp:99
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:103
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition GNEPerson.h:106
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
double getAttributeDouble(SumoXMLAttr key) const override
void writeDemandElement(OutputDevice &device) const override
write demand element element into a xml file
bool isAttributeEnabled(SumoXMLAttr key) const override
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
GNELane * getLastPathLane() const override
get last path lane
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
bool isValid(SumoXMLAttr key, const std::string &value) override
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
void toggleAttribute(SumoXMLAttr key, const bool value) override
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Problem isDemandElementValid() const override
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
std::string getParentName() const override
Returns the name of the parent object.
GNELane * getFirstPathLane() const override
get first path lane
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
void fixDemandElementProblem() override
fix demand element problem (by default throw an exception, has to be reimplemented in children)
std::string getDemandElementProblem() const override
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
~GNEPerson()
destructor
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Parameterised * getParameters() override
get parameters associated with this person
GNEContour myPersonContour
variable used for contours
Definition GNEPerson.h:294
SUMOVehicleClass getVClass() const override
obtain VClass related with this demand element
Position getPositionInView() const override
Returns position of demand element in view.
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
void updateGeometry() override
update pre-computed geometry information
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
GNEMoveElementPlanParent * myMoveElementPlanParent
move element plan parent
Definition GNEPerson.h:291
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
void computePathElement() override
compute pathElement
Position getAttributePosition(SumoXMLAttr key) const override
const RGBColor & getColor() const override
get color
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this person
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
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.
An upper class for objects with additional parameters.
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:323
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