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-2024 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/****************************************************************************/
21#include <netedit/GNENet.h>
22#include <netedit/GNEUndoList.h>
23#include <netedit/GNEViewNet.h>
30
31#include "GNEPerson.h"
32#include "GNERouteHandler.h"
33
34// ===========================================================================
35// FOX callback mapping
36// ===========================================================================
40
44
45// Object implementation
46FXIMPLEMENT(GNEPerson::GNEPersonPopupMenu, GUIGLObjectPopupMenu, personPopupMenuMap, ARRAYNUMBER(personPopupMenuMap))
47FXIMPLEMENT(GNEPerson::GNESelectedPersonsPopupMenu, GUIGLObjectPopupMenu, selectedPersonsPopupMenuMap, ARRAYNUMBER(selectedPersonsPopupMenuMap))
48
49// ===========================================================================
50// GNEPerson::GNEPersonPopupMenu
51// ===========================================================================
52
54 GUIGLObjectPopupMenu(app, parent, *person),
55 myPerson(person),
56 myTransformToPerson(nullptr),
57 myTransformToPersonFlow(nullptr) {
58 // build header
59 myPerson->buildPopupHeader(this, app);
60 // build menu command for center button and copy cursor position to clipboard
61 myPerson->buildCenterPopupEntry(this);
62 myPerson->buildPositionCopyEntry(this, app);
63 // build menu commands for names
64 GUIDesigns::buildFXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
65 GUIDesigns::buildFXMenuCommand(this, ("Copy " + myPerson->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
66 new FXMenuSeparator(this);
67 // build selection and show parameters menu
68 myPerson->getNet()->getViewNet()->buildSelectionACPopupEntry(this, myPerson);
69 myPerson->buildShowParamsPopupEntry(this);
70 // add transform functions only in demand mode
71 if (myPerson->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
72 // create menu pane for transform operations
73 FXMenuPane* transformOperation = new FXMenuPane(this);
74 this->insertMenuPaneChild(transformOperation);
75 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
76 // Create menu comands for all transformations
77 myTransformToPerson = GUIDesigns::buildFXMenuCommand(transformOperation, "Person", GUIIconSubSys::getIcon(GUIIcon::PERSON), this, MID_GNE_PERSON_TRANSFORM);
78 myTransformToPersonFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "PersonFlow", GUIIconSubSys::getIcon(GUIIcon::PERSONFLOW), this, MID_GNE_PERSON_TRANSFORM);
79 // check what menu command has to be disabled
80 if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSON) {
81 myTransformToPerson->disable();
82 } else if (myPerson->getTagProperty().getTag() == SUMO_TAG_PERSONFLOW) {
83 myTransformToPersonFlow->disable();
84 }
85 }
86}
87
88
90
91
92long
93GNEPerson::GNEPersonPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
94 if (obj == myTransformToPerson) {
96 } else if (obj == myTransformToPersonFlow) {
98 }
99 return 1;
100}
101
102
103// ===========================================================================
104// GNEPerson::GNESelectedPersonsPopupMenu
105// ===========================================================================
106
107GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent) :
108 GUIGLObjectPopupMenu(app, parent, *person),
109 myPersonTag(person->getTagProperty().getTag()),
110 mySelectedPersons(selectedPerson),
111 myTransformToPerson(nullptr),
112 myTransformToPersonFlow(nullptr) {
113 // build header
114 person->buildPopupHeader(this, app);
115 // build menu command for center button and copy cursor position to clipboard
116 person->buildCenterPopupEntry(this);
117 person->buildPositionCopyEntry(this, app);
118 // build menu commands for names
119 GUIDesigns::buildFXMenuCommand(this, ("Copy " + person->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
120 GUIDesigns::buildFXMenuCommand(this, ("Copy " + person->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
121 new FXMenuSeparator(this);
122 // build selection and show parameters menu
123 person->getNet()->getViewNet()->buildSelectionACPopupEntry(this, person);
124 person->buildShowParamsPopupEntry(this);
125 // add transform functions only in demand mode
127 // create menu pane for transform operations
128 FXMenuPane* transformOperation = new FXMenuPane(this);
129 this->insertMenuPaneChild(transformOperation);
130 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
131 // Create menu comands for all transformations
134 }
135}
136
137
139
140
141long
143 // iterate over all selected persons
144 for (const auto& i : mySelectedPersons) {
145 if ((obj == myTransformToPerson) &&
146 (i->getTagProperty().getTag() == myPersonTag)) {
148 } else if ((obj == myTransformToPersonFlow) &&
149 (i->getTagProperty().getTag() == myPersonTag)) {
151 }
152 }
153 return 1;
154}
155
156// ===========================================================================
157// member method definitions
158// ===========================================================================
159
162 GNEPathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}),
164 // reset default values
166 // enable set and persons per hour as default flow values
169}
170
171
173 GNEDemandElement(personparameters.id, net, (tag == SUMO_TAG_PERSONFLOW) ? GLO_PERSONFLOW : GLO_PERSON, tag,
175 GNEPathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {pType}, {}),
176GNEDemandElementFlow(this, personparameters) {
177 // set manually vtypeID (needed for saving)
178 vtypeid = pType->getID();
179}
180
181
183
184
187 const auto firstContainerPlan = getChildDemandElements().front();
188 // check first person plan
189 if (firstContainerPlan->getTagProperty().isPlanStopPerson()) {
190 return nullptr;
191 } else if (firstContainerPlan->getParentEdges().size() > 0) {
192 // get lane
193 const GNELane* lane = firstContainerPlan->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
194 // declare departPos
195 double posOverLane = 0;
196 if (canParse<double>(getDepartPos())) {
197 posOverLane = parse<double>(getDepartPos());
198 }
199 // return move operation
200 return new GNEMoveOperation(this, lane, posOverLane, false);
201 } else {
202 return nullptr;
203 }
204}
205
206
207void
209 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
211 // unset VType parameter
212 parametersSet &= ~VEHPARS_VTYPE_SET;
213 // write person attributes (VType will not be written)
215 // set VType parameter again
217 } else {
218 // write person attributes, including VType
220 }
221 // write flow attributes
222 writeFlowAttributes(this, device);
223 // write parameters
224 writeParams(device);
225 // write child demand elements associated to this person (Rides, Walks...)
226 for (const auto& i : getChildDemandElements()) {
227 i->writeDemandElement(device);
228 }
229 // close person tag
230 device.closeTag();
231}
232
233
236 if (getChildDemandElements().size() == 0) {
237 return Problem::NO_PLANS;
238 } else {
239 return Problem::OK;
240 }
241}
242
243
244std::string
246 if (getChildDemandElements().size() == 0) {
247 return "Person needs at least one plan";
248 } else {
249 return "";
250 }
251}
252
253
254void
256 // nothing to fix
257}
258
259
262 return getParentDemandElements().front()->getVClass();
263}
264
265
266const RGBColor&
268 return color;
269}
270
271
272void
274 // only update geometry of childrens
275 for (const auto& demandElement : getChildDemandElements()) {
276 demandElement->updateGeometry();
277 }
278}
279
280
285
286
289 // return a GNEPersonPopupMenu
290 return new GNEPersonPopupMenu(this, app, parent);
291}
292
293
294std::string
296 return getParentDemandElements().front()->getID();
297}
298
299
300double
302 return s.personSize.getExaggeration(s, this, 80);
303}
304
305
308 Boundary personBoundary;
309 if (getChildDemandElements().size() > 0) {
310 if (getChildDemandElements().front()->getTagProperty().isPlanStopPerson()) {
311 // use boundary of stop center
312 return getChildDemandElements().front()->getCenteringBoundary();
313 } else {
314 personBoundary.add(getPositionInView());
315 }
316 } else {
317 personBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
318 }
319 personBoundary.grow(20);
320 return personBoundary;
321}
322
323
324void
325GNEPerson::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
326 // geometry of this element cannot be splitted
327}
328
329
330void
332 bool drawPerson = true;
333 // check if person can be drawn
335 drawPerson = false;
337 drawPerson = false;
339 drawPerson = false;
340 } else if (getChildDemandElements().empty()) {
341 drawPerson = false;
342 }
343 // continue if person can be drawn
344 if (drawPerson) {
345 // obtain exaggeration (and add the special personExaggeration)
346 const double exaggeration = getExaggeration(s) + 10;
347 // obtain position
348 const Position personPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
349 if (personPosition == Position::INVALID) {
350 return;
351 }
352 // get detail level
353 const auto d = s.getDetailLevel(exaggeration);
354 // draw geometry only if we'rent in drawForObjectUnderCursor mode
356 // obtain width and length
357 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
358 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
359 // obtain img file
360 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
361 // push draw matrix
363 // Start with the drawing of the area traslating matrix to origin
365 // translate and rotate
366 glTranslated(personPosition.x(), personPosition.y(), 0);
367 glRotated(90, 0, 0, 1);
368 // set person color
370 // set scale
371 glScaled(exaggeration, exaggeration, 1);
372 // draw person depending of detail level
373 if (s.personQuality >= 2) {
375 } else if (s.personQuality == 1) {
376 GUIBasePersonHelper::drawAction_drawAsCenteredCircle(length / 2, width / 2, s.scale * exaggeration);
377 } else if (s.personQuality == 0) {
379 }
380 // pop matrix
382 // draw stack label
383 if (myStackedLabelNumber > 0) {
384 drawStackLabel(myStackedLabelNumber, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
385 } else if ((getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
387 // declare counter for stacked persons over stops
388 int stackedCounter = 0;
389 // get stoppingPlace
390 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
391 // get stacked persons
392 for (const auto& stopPerson : stoppingPlace->getChildDemandElements()) {
393 if ((stopPerson->getTagProperty().getTag() == GNE_TAG_STOPPERSON_BUSSTOP) ||
394 (stopPerson->getTagProperty().getTag() == GNE_TAG_STOPPERSON_TRAINSTOP)) {
395 // get person parent
396 const auto personParent = stopPerson->getParentDemandElements().front();
397 // check if the stop if the first person plan parent
398 if (stopPerson->getPreviousChildDemandElement(personParent) == nullptr) {
399 stackedCounter++;
400 }
401 }
402 }
403 // if we have more than two stacked elements, draw label
404 if (stackedCounter > 1) {
405 drawStackLabel(stackedCounter, "person", Position(personPosition.x() - 2.5, personPosition.y()), -90, 1.3, 5, getExaggeration(s));
406 }
407 }
408 // draw flow label
409 if (myTagProperty.isFlow()) {
410 drawFlowLabel(Position(personPosition.x() - 1, personPosition.y() - 0.25), -90, 1.8, 2, getExaggeration(s));
411 }
412 // draw lock icon
413 GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), personPosition, exaggeration, s.dottedContourSettings.segmentWidth);
414 // draw name
415 drawName(personPosition, s.scale, s.personName, s.angle);
416 if (s.personValue.show(this)) {
417 Position personValuePosition = personPosition + Position(0, 0.6 * s.personName.scaledSize(s.scale));
418 const double value = getColorValue(s, s.personColorer.getActive());
419 GLHelper::drawTextSettings(s.personValue, toString(value), personValuePosition, s.scale, s.angle, GLO_MAX - getType());
420 }
421 // draw dotted contour
423 }
424 // calculate contour
425 myPersonContour.calculateContourRectangleShape(s, d, this, personPosition, 0.1, 0.2, getType(), -1.1, 0, 0, exaggeration);
426 }
427}
428
429
430void
432 // compute all person plan children (because aren't computed in "computeDemandElements()")
433 for (const auto& demandElement : getChildDemandElements()) {
434 demandElement->computePathElement();
435 }
436}
437
438
439void
440GNEPerson::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
441 // Stops don't use drawJunctionPartialGL
442}
443
444
445void
446GNEPerson::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
447 // Stops don't use drawJunctionPartialGL
448}
449
450
451GNELane*
453 // use path lane of first person plan
454 return getChildDemandElements().front()->getFirstPathLane();
455}
456
457
458GNELane*
460 // use path lane of first person plan
461 return getChildDemandElements().front()->getLastPathLane();
462}
463
464
465std::string
467 // declare string error
468 std::string error;
469 switch (key) {
470 case SUMO_ATTR_ID:
471 return getMicrosimID();
472 case SUMO_ATTR_TYPE:
473 return getTypeParent()->getID();
474 case SUMO_ATTR_COLOR:
476 return toString(color);
477 } else {
479 }
482 return getDepartPos();
483 } else {
485 }
486 // Others
490 return getParametersStr();
491 default:
492 return getFlowAttribute(key);
493 }
494}
495
496
497double
499 switch (key) {
502 return departPos;
503 } else {
504 return 0;
505 }
506 default:
507 return getFlowAttributeDouble(key);
508 }
509}
510
511
514 switch (key) {
515 case SUMO_ATTR_DEPARTPOS: {
516 // first check number of child demand elements
517 if (getChildDemandElements().empty()) {
518 return Position();
519 }
520 // get person plan
521 const GNEDemandElement* personPlan = getChildDemandElements().front();
522 // first check if first person plan is a stop
523 if (personPlan->getTagProperty().isPlanStopPerson()) {
524 // stop center
525 return personPlan->getPositionInView();
526 } else if (personPlan->getTagProperty().planFromTAZ()) {
527 // TAZ
528 if (personPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) {
529 return personPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID);
530 } else {
531 return personPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
532 }
533 } else if (personPlan->getTagProperty().planFromJunction()) {
534 // juncrtion
535 return personPlan->getParentJunctions().front()->getPositionInView();
536 } else {
538 }
539 }
540 default:
541 throw InvalidArgument(getTagStr() + " doesn't have a Position attribute of type '" + toString(key) + "'");
542 }
543}
544
545
546void
547GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
548 switch (key) {
549 case SUMO_ATTR_ID:
550 case SUMO_ATTR_TYPE:
551 case SUMO_ATTR_COLOR:
553 // Other
556 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
557 break;
558 default:
559 setFlowAttribute(this, key, value, undoList);
560 break;
561 }
562}
563
564
565bool
566GNEPerson::isValid(SumoXMLAttr key, const std::string& value) {
567 // declare string error
568 std::string error;
569 switch (key) {
570 case SUMO_ATTR_ID:
572 case SUMO_ATTR_TYPE:
573 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) != nullptr);
574 case SUMO_ATTR_COLOR:
575 return canParse<RGBColor>(value);
576 case SUMO_ATTR_DEPARTPOS: {
577 double dummyDepartPos;
578 DepartPosDefinition dummyDepartPosProcedure;
579 parseDepartPos(value, toString(SUMO_TAG_PERSON), id, dummyDepartPos, dummyDepartPosProcedure, error);
580 // if error is empty, given value is valid
581 return error.empty();
582 }
583 // Other
585 return canParse<bool>(value);
588 default:
589 return isValidFlowAttribute(this, key, value);
590 }
591}
592
593
594void
596 enableFlowAttribute(this, key, undoList);
597}
598
599
600void
602 disableFlowAttribute(this, key, undoList);
603}
604
605
606bool
610
611
612std::string
614 return getTagStr();
615}
616
617
618std::string
620 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
621}
622
623
628
629// ===========================================================================
630// protected
631// ===========================================================================
632
637 } else {
638 return getColorByScheme(s.personColorer, this);
639 }
640}
641
642// ===========================================================================
643// private
644// ===========================================================================
645
647 personPlan(_personPlan),
648 edge(nullptr),
649 arrivalPos(-1) {
650}
651
652
654 personPlan(nullptr),
655 edge(nullptr),
656 arrivalPos(-1) {
657}
658
659
660void
661GNEPerson::setAttribute(SumoXMLAttr key, const std::string& value) {
662 // declare string error
663 std::string error;
664 switch (key) {
665 case SUMO_ATTR_ID:
666 // update microsimID
667 setDemandElementID(value);
668 // update id
669 id = value;
670 break;
671 case SUMO_ATTR_TYPE:
672 if (getID().size() > 0) {
674 // set manually vtypeID (needed for saving)
675 vtypeid = value;
676 }
677 break;
678 case SUMO_ATTR_COLOR:
679 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
680 color = parse<RGBColor>(value);
681 // mark parameter as set
683 } else {
684 // set default value
685 color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
686 // unset parameter
687 parametersSet &= ~VEHPARS_COLOR_SET;
688 }
689 break;
691 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
693 // mark parameter as set
695 } else {
696 // set default value
698 // unset parameter
699 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
700 }
701 // compute person
703 break;
704 // Other
706 if (parse<bool>(value)) {
708 } else {
710 }
711 break;
713 setParametersStr(value);
714 break;
715 default:
716 setFlowAttribute(this, key, value);
717 break;
718 }
719}
720
721
722void
724 // toggle flow attributes
725 toggleFlowAttribute(key, value);
726}
727
728
729void
731 // change departPos
733 departPos = moveResult.newFirstPos;
734 // update geometry
736}
737
738
739void
741 undoList->begin(this, "departPos of " + getTagStr());
742 // now set departPos
744 undoList->end();
745}
746
747/****************************************************************************/
FXDEFMAP(GNEPerson::GNEPersonPopupMenu) personPopupMenuMap[]
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition GUIAppEnum.h:455
@ MID_GNE_PERSON_TRANSFORM
transform person to another person type (ej: person to personflow)
@ MID_COPY_NAME
Copy object name - popup entry.
Definition GUIAppEnum.h:453
@ GLO_MAX
empty max
@ GLO_PERSON
a person
@ GLO_PERSONFLOW
a person flow
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
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_SELECTED
element is selected
@ GNE_ATTR_TAZ_CENTROID
TAZ Center (uses to return the TAZ centroid if center is not defined)
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ 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:78
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:343
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:654
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
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:787
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
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
void resetDefaultValues()
reset attribute carrier to their default values
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
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
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
calculate contour (for rectangled elements)
void 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 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
void disableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
bool isFlowAttributeEnabled(SumoXMLAttr key) const
double getFlowAttributeDouble(SumoXMLAttr key) const
bool isValidFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value)
void writeFlowAttributes(const GNEDemandElement *flowElement, OutputDevice &device) const
write flow attributes
void enableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
std::string getFlowAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier and adapted to GNEDemandElementFlow
void setFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void drawStackLabel(const int number, const std::string &element, const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw stack label
virtual double getAttributeDouble(SumoXMLAttr key) const =0
bool isValidDemandElementID(const std::string &value) const
check if a new demand element ID is valid
virtual std::string getAttribute(SumoXMLAttr key) const =0
void setDemandElementID(const std::string &newID)
set demand element id
GNEDemandElement * getTypeParent() const
get type parent (needed because first parent can be either type or typeDistribution)
int myStackedLabelNumber
stacked label number
virtual Position getPositionInView() const =0
Returns position of demand element in view.
RGBColor getColorByScheme(const GUIColorer &c, const SUMOVehicleParameter *parameters) const
get color by scheme (used by vehicles, persons and containers)
Problem
enum class for demandElement problems
virtual Position getAttributePosition(SumoXMLAttr key) const =0
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move operation
move result
double newFirstPos
new first position
GNEDemandElement * retrieveDemandElements(const std::vector< SumoXMLTag > types, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2155
class used in GUIGLObjectPopupMenu for person transformations
Definition GNEPerson.h:36
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition GNEPerson.cpp:93
class used in GUIGLObjectPopupMenu for single person transformations
Definition GNEPerson.h:68
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition GNEPerson.h:97
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition GNEPerson.h:100
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
GNEMoveOperation * getMoveOperation()
get move operation
Position getPositionInView() const
Returns position of demand element in view.
void updateGeometry()
update pre-computed geometry information
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
const RGBColor & getColor() const
get color
bool isAttributeEnabled(SumoXMLAttr key) const
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
GNELane * getLastPathLane() const
get last path lane
Position getAttributePosition(SumoXMLAttr key) const
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEPerson()
destructor
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void computePathElement()
compute pathElement
std::string getParentName() const
Returns the name of the parent object.
GNEContour myPersonContour
variable used for contours
Definition GNEPerson.h:278
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
GNEPerson(SumoXMLTag tag, GNENet *net)
default constructor
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
const Parameterised::Map & getACParametersMap() const
get parameters map
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
double getAttributeDouble(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
GNELane * getFirstPathLane() const
get first path lane
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
static void transformToPerson(GNEPerson *originalPerson)
transform person functions
static void transformToPersonFlow(GNEPerson *originalPerson)
transform routeFlow over an existent route
bool planFromJunction() const
return true if tag correspond to a plan that starts in junction
bool isFlow() const
return true if tag correspond to a flow element
bool planFromTAZ() const
return true if tag correspond to a plan that starts in TAZ
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
SumoXMLTag getXMLTag() const
get XML tag
bool isPlanStopPerson() const
return true if tag correspond to a person stop plan
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
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
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
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.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
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:322
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
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