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-2026 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
26#include <netedit/GNENet.h>
33
34#include "GNEPerson.h"
35#include "GNERouteHandler.h"
36
37// ===========================================================================
38// FOX callback mapping
39// ===========================================================================
40
44
48
49// Object implementation
50FXIMPLEMENT(GNEPerson::GNEPersonPopupMenu, GUIGLObjectPopupMenu, personPopupMenuMap, ARRAYNUMBER(personPopupMenuMap))
51FXIMPLEMENT(GNEPerson::GNESelectedPersonsPopupMenu, GUIGLObjectPopupMenu, selectedPersonsPopupMenuMap, ARRAYNUMBER(selectedPersonsPopupMenuMap))
52
53// ===========================================================================
54// GNEPerson::GNEPersonPopupMenu
55// ===========================================================================
56
58 GUIGLObjectPopupMenu(app, parent, person),
59 myPerson(person),
60 myTransformToPerson(nullptr),
61 myTransformToPersonFlow(nullptr) {
62 // build common options
63 person->buildPopUpMenuCommonOptions(this, app, person->myNet->getViewNet(), person->getTagProperty()->getTag(), person->isAttributeCarrierSelected(), person->myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand(), true);
64 // add transform functions only in demand mode
65 if (myPerson->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
66 // create menu pane for transform operations
67 FXMenuPane* transformOperation = new FXMenuPane(this);
68 this->insertMenuPaneChild(transformOperation);
69 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
70 // Create menu comands for all transformations
71 myTransformToPerson = GUIDesigns::buildFXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(GUIIcon::PERSON), this, MID_GNE_PERSON_TRANSFORM);
72 myTransformToPersonFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "PersonFlow", GUIIconSubSys::getIcon(GUIIcon::PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
73 // check what menu command has to be disabled
74 if (myPerson->getTagProperty()->getTag() == SUMO_TAG_PERSON) {
75 myTransformToPerson->disable();
76 } else if (myPerson->getTagProperty()->getTag() == SUMO_TAG_PERSONFLOW) {
77 myTransformToPersonFlow->disable();
78 }
79 }
80}
81
82
84
85
86long
87GNEPerson::GNEPersonPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
88 if (obj == myTransformToPerson) {
90 } else if (obj == myTransformToPersonFlow) {
92 }
93 return 1;
94}
95
96
97// ===========================================================================
98// GNEPerson::GNESelectedPersonsPopupMenu
99// ===========================================================================
100
101GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent) :
102 GUIGLObjectPopupMenu(app, parent, person),
103 myPersonTag(person->getTagProperty()->getTag()),
104 mySelectedPersons(selectedPerson),
105 myTransformToPerson(nullptr),
106 myTransformToPersonFlow(nullptr) {
107 // build common options
108 person->buildPopUpMenuCommonOptions(this, app, person->myNet->getViewNet(), person->myTagProperty->getTag(), person->isAttributeCarrierSelected(), person->myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand(), true);
109 // add transform functions only in demand mode
111 // create menu pane for transform operations
112 FXMenuPane* transformOperation = new FXMenuPane(this);
113 this->insertMenuPaneChild(transformOperation);
114 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
115 // Create menu comands for all transformations
118 }
119}
120
121
123
124
125long
127 // iterate over all selected persons
128 for (const auto& i : mySelectedPersons) {
129 if ((obj == myTransformToPerson) &&
130 (i->getTagProperty()->getTag() == myPersonTag)) {
132 } else if ((obj == myTransformToPersonFlow) &&
133 (i->getTagProperty()->getTag() == myPersonTag)) {
135 }
136 }
137 return 1;
138}
139
140// ===========================================================================
141// member method definitions
142// ===========================================================================
143#ifdef _MSC_VER
144#pragma warning(push)
145#pragma warning(disable: 4355) // mask warning about "this" in initializers
146#endif
148 GNEDemandElement(net, tag),
151 // enable set and persons per hour as default flow values
154}
155
156
158 const SUMOVehicleParameter& personparameters) :
159 GNEDemandElement(personparameters.id, net, tag, fileBucket),
160 GNEDemandElementFlow(this, personparameters),
161 myMoveElementPlanParent(new GNEMoveElementPlanParent(this, departPos, departPosProcedure)) {
162 // set parents
163 setParent<GNEDemandElement*>(pType);
164 // set manually vtypeID (needed for saving)
165 vtypeid = pType->getID();
166}
167#ifdef _MSC_VER
168#pragma warning(pop)
169#endif
170
172
173
178
179
182 return this;
183}
184
185
186const Parameterised*
188 return this;
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 parameters
207 XMLHelpers::writeParams(device, *this);
208 // write child demand elements associated to this person (Rides, Walks...)
209 for (const auto& i : getChildDemandElements()) {
210 i->writeDemandElement(device);
211 }
212 // close person tag
213 device.closeTag();
214}
215
216
219 if (getChildDemandElements().size() == 0) {
220 return Problem::NO_PLANS;
221 } else {
222 return Problem::OK;
223 }
224}
225
226
227std::string
229 if (getChildDemandElements().size() == 0) {
230 return "Person needs at least one plan";
231 } else {
232 return "";
233 }
234}
235
236
237void
239 // nothing to fix
240}
241
242
245 return getParentDemandElements().front()->getVClass();
246}
247
248
249const RGBColor&
251 return color;
252}
253
254
255void
257 // only update geometry of childrens
258 for (const auto& demandElement : getChildDemandElements()) {
259 demandElement->updateGeometry();
260 }
261}
262
263
268
269
272 // return a GNEPersonPopupMenu
273 return new GNEPersonPopupMenu(this, app, parent);
274}
275
276
277std::string
279 return getParentDemandElements().front()->getID();
280}
281
282
283double
285 return s.personSize.getExaggeration(s, this, 80);
286}
287
288
291 Boundary personBoundary;
292 if (getChildDemandElements().size() > 0) {
293 if (getChildDemandElements().front()->getTagProperty()->isPlanStopPerson()) {
294 // use boundary of stop center
295 return getChildDemandElements().front()->getCenteringBoundary();
296 } else {
297 personBoundary.add(getPositionInView());
298 }
299 } else {
300 personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
301 }
302 personBoundary.grow(20);
303 return personBoundary;
304}
305
306
307void
308GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
309 // geometry of this element cannot be splitted
310}
311
312
313void
315 bool drawPerson = true;
316 // check if person can be drawn
318 drawPerson = false;
320 drawPerson = false;
322 drawPerson = false;
323 } else if (getChildDemandElements().empty()) {
324 drawPerson = false;
325 }
326 // continue if person can be drawn
327 if (drawPerson) {
328 // obtain exaggeration (and add the special personExaggeration)
329 const double exaggeration = getExaggeration(s) + 10;
330 // obtain position
331 const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
332 if (personPosition == Position::INVALID) {
333 return;
334 }
335 // get detail level
336 const auto d = s.getDetailLevel(exaggeration);
337 // draw geometry only if we'rent in drawForObjectUnderCursor mode
339 // obtain width and length
340 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
341 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
342 // obtain img file
343 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
344 // push draw matrix
346 // Start with the drawing of the area translating matrix to origin
348 // translate and rotate
349 glTranslated(personPosition.x(), personPosition.y(), 0);
350 glRotated(90, 0, 0, 1);
351 // set person color
353 // set scale
354 glScaled(exaggeration, exaggeration, 1);
355 // draw person depending of detail level
356 if (s.personQuality >= 2) {
358 } else if (s.personQuality == 1) {
359 GUIBasePersonHelper::drawAction_drawAsCenteredCircle(length / 2, width / 2, s.scale * exaggeration);
360 } else if (s.personQuality == 0) {
362 }
363 // pop matrix
365 // draw stack label
366 if (myStackedLabelNumber > 0) {
367 drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
368 } else if ((getChildDemandElements().front()->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
370 // declare counter for stacked persons over stops
371 int stackedCounter = 0;
372 // get stoppingPlace
373 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
374 // get stacked persons
375 for (const auto& stopPerson : stoppingPlace->getChildDemandElements()) {
376 if ((stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
377 (stopPerson->getTagProperty()->getTag() == GNE_TAG_STOPPERSON_TRAINSTOP)) {
378 // get person parent
379 const auto personParent = stopPerson->getParentDemandElements().front();
380 // check if the stop if the first person plan parent
381 if (stopPerson->getPreviousChildDemandElement(personParent) == nullptr) {
382 stackedCounter++;
383 }
384 }
385 }
386 // if we have more than two stacked elements, draw label
387 if (stackedCounter > 1) {
388 drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
389 }
390 }
391 // draw flow label
392 if (myTagProperty->isFlow()) {
393 drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s));
394 }
395 // draw lock icon
396 GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), personPosition, exaggeration, s.dottedContourSettings.segmentWidth);
397 // draw name
398 drawName(personPosition, s.scale, s.personName, s.angle);
399 if (s.personValue.show(this)) {
400 Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
401 const double value = getColorValue(s, s.personColorer.getActive());
402 GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
403 }
404 // draw dotted contour
406 }
407 // calculate contour
408 myPersonContour.calculateContourRectangleShape(s, d, this, personPosition, 0.1, 0.2, getType(), -1.1, 0, 0, exaggeration, nullptr);
409 }
410}
411
412
413void
415 // compute all person plan children (because aren't computed in "computeDemandElements()")
416 for (const auto& demandElement : getChildDemandElements()) {
417 demandElement->computePathElement();
418 }
419}
420
421
422void
423GNEPerson::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
424 // Stops don't use drawJunctionPartialGL
425}
426
427
428void
429GNEPerson::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
430 // Stops don't use drawJunctionPartialGL
431}
432
433
434GNELane*
436 // use path lane of first person plan
437 return getChildDemandElements().front()->getFirstPathLane();
438}
439
440
441GNELane*
443 // use path lane of first person plan
444 return getChildDemandElements().front()->getLastPathLane();
445}
446
447
448std::string
450 // declare string error
451 std::string error;
452 switch (key) {
453 case SUMO_ATTR_ID:
454 return getMicrosimID();
455 case SUMO_ATTR_TYPE:
456 return getTypeParent()->getID();
457 case SUMO_ATTR_COLOR:
459 return toString(color);
460 } else {
462 }
465 return getDepartPos();
466 } else {
468 }
469 default:
470 return getFlowAttribute(this, key);
471 }
472}
473
474
475double
477 switch (key) {
480 return departPos;
481 } else {
482 return 0;
483 }
484 default:
485 return getFlowAttributeDouble(key);
486 }
487}
488
489
492 switch (key) {
493 case SUMO_ATTR_DEPARTPOS: {
494 // first check number of child demand elements
495 if (getChildDemandElements().empty()) {
496 return Position();
497 }
498 // get person plan
499 const GNEDemandElement* personPlan = getChildDemandElements().front();
500 // first check if first person plan is a stop
501 if (personPlan->getTagProperty()->isPlanStopPerson()) {
502 // stop center
503 return personPlan->getPositionInView();
504 } else if (personPlan->getTagProperty()->planFromTAZ()) {
505 // TAZ
506 if (personPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) {
507 return personPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID);
508 } else {
509 return personPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
510 }
511 } else if (personPlan->getTagProperty()->planFromJunction()) {
512 // juncrtion
513 return personPlan->getParentJunctions().front()->getPositionInView();
514 } else {
516 }
517 }
518 default:
519 return getCommonAttributePosition(key);
520 }
521}
522
523
524void
525GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
526 switch (key) {
527 case SUMO_ATTR_ID:
528 case SUMO_ATTR_TYPE:
529 case SUMO_ATTR_COLOR:
531 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
532 break;
533 default:
534 setFlowAttribute(this, key, value, undoList);
535 break;
536 }
537}
538
539
540bool
541GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
542 // declare string error
543 std::string error;
544 switch (key) {
545 case SUMO_ATTR_ID:
547 case SUMO_ATTR_TYPE:
548 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) != nullptr);
549 case SUMO_ATTR_COLOR:
550 return canParse<RGBColor>(value);
551 case SUMO_ATTR_DEPARTPOS: {
552 double dummyDepartPos;
553 DepartPosDefinition dummyDepartPosProcedure;
554 parseDepartPos(value, toString(SUMO_TAG_PERSON), id, dummyDepartPos, dummyDepartPosProcedure, error);
555 // if error is empty, given value is valid
556 return error.empty();
557 }
558 default:
559 return isValidFlowAttribute(this, key, value);
560 }
561}
562
563
564void
566 enableFlowAttribute(this, key, undoList);
567}
568
569
570void
572 disableFlowAttribute(this, key, undoList);
573}
574
575
576bool
580
581
582std::string
584 return getTagStr();
585}
586
587
588std::string
590 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
591}
592
593// ===========================================================================
594// protected
595// ===========================================================================
596
601 } else {
602 return getColorByScheme(s.personColorer, this);
603 }
604}
605
606// ===========================================================================
607// private
608// ===========================================================================
609
611 personPlan(_personPlan),
612 edge(nullptr),
613 arrivalPos(-1) {
614}
615
616
618 personPlan(nullptr),
619 edge(nullptr),
620 arrivalPos(-1) {
621}
622
623
624void
625GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
626 // declare string error
627 std::string error;
628 switch (key) {
629 case SUMO_ATTR_ID:
630 // update microsimID
631 setDemandElementID(value);
632 // update id
633 id = value;
634 break;
635 case SUMO_ATTR_TYPE:
636 if (getID().size() > 0) {
638 // set manually vtypeID (needed for saving)
639 vtypeid = value;
640 }
641 break;
642 case SUMO_ATTR_COLOR:
643 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
644 color = parse<RGBColor>(value);
645 // mark parameter as set
647 } else {
648 // set default value
649 color = parse<RGBColor>(myTagProperty->getDefaultStringValue(key));
650 // unset parameter
651 parametersSet &= ~VEHPARS_COLOR_SET;
652 }
653 break;
655 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
657 // mark parameter as set
659 } else {
660 // set default value
662 // unset parameter
663 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
664 }
665 // compute person
667 break;
668 default:
669 setFlowAttribute(this, key, value);
670 break;
671 }
672}
673
674
675void
677 // toggle flow attributes
678 toggleFlowAttribute(key, value);
679}
680
681/****************************************************************************/
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:57
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:87
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.
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, const bool allowDelete, const bool addSeparator)
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.
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.
static OutputDevice & writeParams(OutputDevice &device, const Parameterised &params)
write the parameters of the given object as param tags
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