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
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 myMoveElementPlanParent(new GNEMoveElementPlanParent(this, departPos, departPosProcedure)) {
159 // set parents
160 setParent<GNEDemandElement*>(pType);
161 // set manually vtypeID (needed for saving)
162 vtypeid = pType->getID();
163}
164#ifdef _MSC_VER
165#pragma warning(pop)
166#endif
167
169
170
175
176
179 return this;
180}
181
182
183const Parameterised*
185 return this;
186}
187
188
189void
191 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
193 // unset VType parameter
194 parametersSet &= ~VEHPARS_VTYPE_SET;
195 // write person attributes (VType will not be written)
197 // set VType parameter again
199 } else {
200 // write person attributes, including VType
202 }
203 // write parameters
204 writeParams(device);
205 // write child demand elements associated to this person (Rides, Walks...)
206 for (const auto& i : getChildDemandElements()) {
207 i->writeDemandElement(device);
208 }
209 // close person tag
210 device.closeTag();
211}
212
213
216 if (getChildDemandElements().size() == 0) {
217 return Problem::NO_PLANS;
218 } else {
219 return Problem::OK;
220 }
221}
222
223
224std::string
226 if (getChildDemandElements().size() == 0) {
227 return "Person needs at least one plan";
228 } else {
229 return "";
230 }
231}
232
233
234void
236 // nothing to fix
237}
238
239
242 return getParentDemandElements().front()->getVClass();
243}
244
245
246const RGBColor&
248 return color;
249}
250
251
252void
254 // only update geometry of childrens
255 for (const auto& demandElement : getChildDemandElements()) {
256 demandElement->updateGeometry();
257 }
258}
259
260
265
266
269 // return a GNEPersonPopupMenu
270 return new GNEPersonPopupMenu(this, app, parent);
271}
272
273
274std::string
276 return getParentDemandElements().front()->getID();
277}
278
279
280double
282 return s.personSize.getExaggeration(s, this, 80);
283}
284
285
288 Boundary personBoundary;
289 if (getChildDemandElements().size() > 0) {
290 if (getChildDemandElements().front()->getTagProperty()->isPlanStopPerson()) {
291 // use boundary of stop center
292 return getChildDemandElements().front()->getCenteringBoundary();
293 } else {
294 personBoundary.add(getPositionInView());
295 }
296 } else {
297 personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
298 }
299 personBoundary.grow(20);
300 return personBoundary;
301}
302
303
304void
305GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
306 // geometry of this element cannot be splitted
307}
308
309
310void
312 bool drawPerson = true;
313 // check if person can be drawn
315 drawPerson = false;
317 drawPerson = false;
319 drawPerson = false;
320 } else if (getChildDemandElements().empty()) {
321 drawPerson = false;
322 }
323 // continue if person can be drawn
324 if (drawPerson) {
325 // obtain exaggeration (and add the special personExaggeration)
326 const double exaggeration = getExaggeration(s) + 10;
327 // obtain position
328 const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
329 if (personPosition == Position::INVALID) {
330 return;
331 }
332 // get detail level
333 const auto d = s.getDetailLevel(exaggeration);
334 // draw geometry only if we'rent in drawForObjectUnderCursor mode
336 // obtain width and length
337 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
338 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
339 // obtain img file
340 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
341 // push draw matrix
343 // Start with the drawing of the area traslating matrix to origin
345 // translate and rotate
346 glTranslated(personPosition.x(), personPosition.y(), 0);
347 glRotated(90, 0, 0, 1);
348 // set person color
350 // set scale
351 glScaled(exaggeration, exaggeration, 1);
352 // draw person depending of detail level
353 if (s.personQuality >= 2) {
355 } else if (s.personQuality == 1) {
356 GUIBasePersonHelper::drawAction_drawAsCenteredCircle(length / 2, width / 2, s.scale * exaggeration);
357 } else if (s.personQuality == 0) {
359 }
360 // pop matrix
362 // draw stack label
363 if (myStackedLabelNumber > 0) {
364 drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
365 } else if ((getChildDemandElements().front()->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
367 // declare counter for stacked persons over stops
368 int stackedCounter = 0;
369 // get stoppingPlace
370 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
371 // get stacked persons
372 for (const auto& stopPerson : stoppingPlace->getChildDemandElements()) {
373 if ((stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
374 (stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_TRAINSTOP)) {
375 // get person parent
376 const auto personParent = stopPerson->getParentDemandElements().front();
377 // check if the stop if the first person plan parent
378 if (stopPerson->getPreviousChildDemandElement(personParent) == nullptr) {
379 stackedCounter++;
380 }
381 }
382 }
383 // if we have more than two stacked elements, draw label
384 if (stackedCounter > 1) {
385 drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
386 }
387 }
388 // draw flow label
389 if (myTagProperty->isFlow()) {
390 drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s));
391 }
392 // draw lock icon
393 GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), personPosition, exaggeration, s.dottedContourSettings.segmentWidth);
394 // draw name
395 drawName(personPosition, s.scale, s.personName, s.angle);
396 if (s.personValue.show(this)) {
397 Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
398 const double value = getColorValue(s, s.personColorer.getActive());
399 GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
400 }
401 // draw dotted contour
403 }
404 // calculate contour
405 myPersonContour.calculateContourRectangleShape(s, d, this, personPosition, 0.1, 0.2, getType(), -1.1, 0, 0, exaggeration, nullptr);
406 }
407}
408
409
410void
412 // compute all person plan children (because aren't computed in "computeDemandElements()")
413 for (const auto& demandElement : getChildDemandElements()) {
414 demandElement->computePathElement();
415 }
416}
417
418
419void
420GNEPerson::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
421 // Stops don't use drawJunctionPartialGL
422}
423
424
425void
426GNEPerson::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
427 // Stops don't use drawJunctionPartialGL
428}
429
430
431GNELane*
433 // use path lane of first person plan
434 return getChildDemandElements().front()->getFirstPathLane();
435}
436
437
438GNELane*
440 // use path lane of first person plan
441 return getChildDemandElements().front()->getLastPathLane();
442}
443
444
445std::string
447 // declare string error
448 std::string error;
449 switch (key) {
450 case SUMO_ATTR_ID:
451 return getMicrosimID();
452 case SUMO_ATTR_TYPE:
453 return getTypeParent()->getID();
454 case SUMO_ATTR_COLOR:
456 return toString(color);
457 } else {
459 }
462 return getDepartPos();
463 } else {
465 }
466 default:
467 return getFlowAttribute(this, key);
468 }
469}
470
471
472double
474 switch (key) {
477 return departPos;
478 } else {
479 return 0;
480 }
481 default:
482 return getFlowAttributeDouble(key);
483 }
484}
485
486
489 switch (key) {
490 case SUMO_ATTR_DEPARTPOS: {
491 // first check number of child demand elements
492 if (getChildDemandElements().empty()) {
493 return Position();
494 }
495 // get person plan
496 const GNEDemandElement* personPlan = getChildDemandElements().front();
497 // first check if first person plan is a stop
498 if (personPlan->getTagProperty()->isPlanStopPerson()) {
499 // stop center
500 return personPlan->getPositionInView();
501 } else if (personPlan->getTagProperty()->planFromTAZ()) {
502 // TAZ
503 if (personPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) {
504 return personPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID);
505 } else {
506 return personPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
507 }
508 } else if (personPlan->getTagProperty()->planFromJunction()) {
509 // juncrtion
510 return personPlan->getParentJunctions().front()->getPositionInView();
511 } else {
513 }
514 }
515 default:
516 return getCommonAttributePosition(key);
517 }
518}
519
520
521void
522GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
523 switch (key) {
524 case SUMO_ATTR_ID:
525 case SUMO_ATTR_TYPE:
526 case SUMO_ATTR_COLOR:
528 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
529 break;
530 default:
531 setFlowAttribute(this, key, value, undoList);
532 break;
533 }
534}
535
536
537bool
538GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
539 // declare string error
540 std::string error;
541 switch (key) {
542 case SUMO_ATTR_ID:
544 case SUMO_ATTR_TYPE:
545 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) != nullptr);
546 case SUMO_ATTR_COLOR:
547 return canParse<RGBColor>(value);
548 case SUMO_ATTR_DEPARTPOS: {
549 double dummyDepartPos;
550 DepartPosDefinition dummyDepartPosProcedure;
551 parseDepartPos(value, toString(SUMO_TAG_PERSON), id, dummyDepartPos, dummyDepartPosProcedure, error);
552 // if error is empty, given value is valid
553 return error.empty();
554 }
555 default:
556 return isValidFlowAttribute(this, key, value);
557 }
558}
559
560
561void
563 enableFlowAttribute(this, key, undoList);
564}
565
566
567void
569 disableFlowAttribute(this, key, undoList);
570}
571
572
573bool
577
578
579std::string
581 return getTagStr();
582}
583
584
585std::string
587 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
588}
589
590// ===========================================================================
591// protected
592// ===========================================================================
593
598 } else {
599 return getColorByScheme(s.personColorer, this);
600 }
601}
602
603// ===========================================================================
604// private
605// ===========================================================================
606
608 personPlan(_personPlan),
609 edge(nullptr),
610 arrivalPos(-1) {
611}
612
613
615 personPlan(nullptr),
616 edge(nullptr),
617 arrivalPos(-1) {
618}
619
620
621void
622GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
623 // declare string error
624 std::string error;
625 switch (key) {
626 case SUMO_ATTR_ID:
627 // update microsimID
628 setDemandElementID(value);
629 // update id
630 id = value;
631 break;
632 case SUMO_ATTR_TYPE:
633 if (getID().size() > 0) {
635 // set manually vtypeID (needed for saving)
636 vtypeid = value;
637 }
638 break;
639 case SUMO_ATTR_COLOR:
640 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
641 color = parse<RGBColor>(value);
642 // mark parameter as set
644 } else {
645 // set default value
646 color = parse<RGBColor>(myTagProperty->getDefaultStringValue(key));
647 // unset parameter
648 parametersSet &= ~VEHPARS_COLOR_SET;
649 }
650 break;
652 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
654 // mark parameter as set
656 } else {
657 // set default value
659 // unset parameter
660 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
661 }
662 // compute person
664 break;
665 default:
666 setFlowAttribute(this, key, value);
667 break;
668 }
669}
670
671
672void
674 // toggle flow attributes
675 toggleFlowAttribute(key, value);
676}
677
678/****************************************************************************/
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:773
virtual double getAttributeDouble(SumoXMLAttr key) const =0
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
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 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
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)
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.
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:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
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 drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Position getPositionInView() const
Returns position of demand element in view.
double getAttributeDouble(SumoXMLAttr key) const override
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
const RGBColor & getColor() const
get color
bool isAttributeEnabled(SumoXMLAttr key) const
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
bool isValid(SumoXMLAttr key, const std::string &value) override
GNELane * getLastPathLane() const
get last path lane
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.
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.
Parameterised * getParameters() override
get parameters associated with this person
GNEContour myPersonContour
variable used for contours
Definition GNEPerson.h:293
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
void updateGeometry() override
update pre-computed geometry information
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEMoveElementPlanParent * myMoveElementPlanParent
move element plan parent
Definition GNEPerson.h:290
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
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.
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
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...
Position getAttributePosition(SumoXMLAttr key) const override
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