Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEContainer.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 containers in netedit
19/****************************************************************************/
20
22
26#include <netedit/GNENet.h>
33
34#include "GNEContainer.h"
35#include "GNERouteHandler.h"
36
37// ===========================================================================
38// FOX callback mapping
39// ===========================================================================
40
44
48
49// Object implementation
50FXIMPLEMENT(GNEContainer::GNEContainerPopupMenu, GUIGLObjectPopupMenu, containerPopupMenuMap, ARRAYNUMBER(containerPopupMenuMap))
51FXIMPLEMENT(GNEContainer::GNESelectedContainersPopupMenu, GUIGLObjectPopupMenu, selectedContainersPopupMenuMap, ARRAYNUMBER(selectedContainersPopupMenuMap))
52
53// ===========================================================================
54// GNEContainer::GNEContainerPopupMenu
55// ===========================================================================
56
58 GUIGLObjectPopupMenu(app, parent, container),
59 myContainer(container),
60 myTransformToContainer(nullptr),
61 myTransformToContainerFlow(nullptr) {
62 // build common options
63 container->buildPopUpMenuCommonOptions(this, app, container->myNet->getViewNet(), container->getTagProperty()->getTag(), container->isAttributeCarrierSelected(), container->myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand(), true);
64 // add transform functions only in demand mode
65 if (myContainer->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 myTransformToContainer = GUIDesigns::buildFXMenuCommand(transformOperation, "Container", GUIIconSubSys::getIcon(GUIIcon::CONTAINER), this, MID_GNE_CONTAINER_TRANSFORM);
72 myTransformToContainerFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "ContainerFlow", GUIIconSubSys::getIcon(GUIIcon::CONTAINERFLOW), this, MID_GNE_CONTAINER_TRANSFORM);
73 // check what menu command has to be disabled
74 if (myContainer->getTagProperty()->getTag() == SUMO_TAG_CONTAINER) {
75 myTransformToContainer->disable();
76 } else if (myContainer->getTagProperty()->getTag() == SUMO_TAG_CONTAINERFLOW) {
77 myTransformToContainerFlow->disable();
78 }
79 }
80}
81
82
84
85
86long
87GNEContainer::GNEContainerPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
88 if (obj == myTransformToContainer) {
90 } else if (obj == myTransformToContainerFlow) {
92 }
93 return 1;
94}
95
96
97// ===========================================================================
98// GNEContainer::GNESelectedContainersPopupMenu
99// ===========================================================================
100
101GNEContainer::GNESelectedContainersPopupMenu::GNESelectedContainersPopupMenu(GNEContainer* container, const std::vector<GNEContainer*>& selectedContainer, GUIMainWindow& app, GUISUMOAbstractView& parent) :
102 GUIGLObjectPopupMenu(app, parent, container),
103 myContainerTag(container->getTagProperty()->getTag()),
104 mySelectedContainers(selectedContainer),
105 myTransformToContainer(nullptr),
106 myTransformToContainerFlow(nullptr) {
107 // build common options
108 container->buildPopUpMenuCommonOptions(this, app, container->myNet->getViewNet(), container->getTagProperty()->getTag(), container->isAttributeCarrierSelected(), container->myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand(), true);
109 // add transform functions only in demand mode
110 if (container->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
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 containers
128 for (const auto& container : mySelectedContainers) {
129 if ((obj == myTransformToContainer) &&
130 (container->getTagProperty()->getTag() == myContainerTag)) {
132 } else if ((obj == myTransformToContainerFlow) &&
133 (container->getTagProperty()->getTag() == myContainerTag)) {
135 }
136 }
137 return 1;
138}
139
140// ===========================================================================
141// member method definitions
142// ===========================================================================
143
144#ifdef _MSC_VER
145#pragma warning(push)
146#pragma warning(disable: 4355) // mask warning about "this" in initializers
147#endif
156
157
159 GNEDemandElement* pType, const SUMOVehicleParameter& containerparameters) :
160 GNEDemandElement(containerparameters.id, net, tag, fileBucket),
161 GNEDemandElementFlow(this, containerparameters),
162 myMoveElementPlanParent(new GNEMoveElementPlanParent(this, departPos, departPosProcedure)) {
163 // set parents
164 setParent<GNEDemandElement*>(pType);
165 // set manually vtypeID (needed for saving)
166 vtypeid = pType->getID();
167}
168#ifdef _MSC_VER
169#pragma warning(pop)
170#endif
171
173
174
179
180
183 return this;
184}
185
186
187const Parameterised*
189 return this;
190}
191
192
193void
195 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
197 // unset VType parameter
198 parametersSet &= ~VEHPARS_VTYPE_SET;
199 // write container attributes (VType will not be written)
201 // set VType parameter again
203 } else {
204 // write container attributes, including VType
206 }
207 // write parameters
208 XMLHelpers::writeParams(device, *this);
209 // write child demand elements associated to this container (Rides, Walks...)
210 for (const auto& containerPlan : getChildDemandElements()) {
211 containerPlan->writeDemandElement(device);
212 }
213 // close container tag
214 device.closeTag();
215}
216
217
220 if (getChildDemandElements().size() == 0) {
221 return Problem::NO_PLANS;
222 } else {
223 return Problem::OK;
224 }
225}
226
227
228std::string
230 if (getChildDemandElements().size() == 0) {
231 return "Container needs at least one plan";
232 } else {
233 return "";
234 }
235}
236
237
238void
240 // nothing to fix
241}
242
243
246 return getParentDemandElements().front()->getVClass();
247}
248
249
250const RGBColor&
252 return color;
253}
254
255
256void
258 // only update geometry of childrens
259 for (const auto& demandElement : getChildDemandElements()) {
260 demandElement->updateGeometry();
261 }
262}
263
264
269
270
273 // return a GNEContainerPopupMenu
274 return new GNEContainerPopupMenu(this, app, parent);
275}
276
277
278std::string
280 return getParentDemandElements().front()->getID();
281}
282
283
284double
288
289
292 Boundary containerBoundary;
293 if (getChildDemandElements().size() > 0) {
294 if (getChildDemandElements().front()->getTagProperty()->isPlanStopContainer()) {
295 // use boundary of stop center
296 return getChildDemandElements().front()->getCenteringBoundary();
297 } else {
298 containerBoundary.add(getPositionInView());
299 }
300 } else {
301 containerBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
302 }
303 containerBoundary.grow(20);
304 return containerBoundary;
305}
306
307
308void
309GNEContainer::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/,
310 const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
311 // geometry of this element cannot be splitted
312}
313
314
315void
317 bool drawContainer = true;
318 // check if container can be drawn
320 drawContainer = false;
322 drawContainer = false;
324 drawContainer = false;
325 } else if (getChildDemandElements().empty()) {
326 drawContainer = false;
327 }
328 // continue if container can be drawn
329 if (drawContainer) {
330 // obtain exaggeration (and add the special containerExaggeration)
331 const double exaggeration = getExaggeration(s) + 10;
332 // get detail level
333 const auto d = s.getDetailLevel(exaggeration);
334 // obtain position
335 const Position containerPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
336 if (containerPosition == Position::INVALID) {
337 return;
338 }
339 // draw geometry only if we'rent in drawForObjectUnderCursor mode
341 // obtain img file
342 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
343 // push draw matrix
345 // Start with the drawing of the area translating matrix to origin
347 // translate and rotate
348 glTranslated(containerPosition.x(), containerPosition.y(), 0);
349 glRotated(90, 0, 0, 1);
350 // set container color
352 // set scale
353 glScaled(exaggeration, exaggeration, 1);
354 // draw container depending of detail level
355 switch (s.containerQuality) {
356 case 0:
357 case 1:
358 case 2:
360 break;
361 case 3:
362 default:
364 break;
365 }
366 // pop matrix
368 // draw line between junctions if container plan isn't valid
369 for (const auto& containerPlan : getChildDemandElements()) {
370 if (containerPlan->getTagProperty()->isPlanContainer() && (containerPlan->getParentJunctions().size() > 0) &&
371 !myNet->getDemandPathManager()->isPathValid(containerPlan)) {
372 drawJunctionLine(containerPlan);
373 }
374 }
375 // draw stack label
376 if (myStackedLabelNumber > 0) {
377 drawStackLabel(myStackedLabelNumber, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
379 // declare counter for stacked containers over stops
380 int stackedCounter = 0;
381 // get stoppingPlace
382 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
383 // get stacked containers
384 for (const auto& stopContainer : stoppingPlace->getChildDemandElements()) {
385 if (stopContainer->getTagProperty()->getTag() == GNE_TAG_STOPCONTAINER_CONTAINERSTOP) {
386 // get container parent
387 const auto containerParent = stopContainer->getParentDemandElements().front();
388 // check if the stop if the first container plan parent
389 if (stopContainer->getPreviousChildDemandElement(containerParent) == nullptr) {
390 stackedCounter++;
391 }
392 }
393 }
394 // if we have more than two stacked elements, draw label
395 if (stackedCounter > 1) {
396 drawStackLabel(stackedCounter, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
397 }
398 }
399 // draw flow label
400 if (myTagProperty->isFlow()) {
401 drawFlowLabel(Position(containerPosition.x() - 1, containerPosition.y() - 4.25), -90, 1.8, 2, getExaggeration(s));
402 }
403 // draw name
404 drawName(containerPosition, s.scale, s.containerName, s.angle);
405 // draw lock icon
407 // draw dotted contour
409 }
410 // calculate contour
411 myContainerContour.calculateContourRectangleShape(s, d, this, containerPosition, 0.5, 0.18, getType(), -5.5, 0, 0, exaggeration, nullptr);
412 }
413}
414
415
416void
418 // compute all container plan children (because aren't computed in "computeDemandElements()")
419 for (const auto& demandElement : getChildDemandElements()) {
420 demandElement->computePathElement();
421 }
422}
423
424
425void
426GNEContainer::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
427 // Stops don't use drawJunctionPartialGL
428}
429
430
431void
432GNEContainer::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
433 // Stops don't use drawJunctionPartialGL
434}
435
436
437GNELane*
439 // use path lane of first container plan
440 return getChildDemandElements().front()->getFirstPathLane();
441}
442
443
444GNELane*
446 // use path lane of first container plan
447 return getChildDemandElements().front()->getLastPathLane();
448}
449
450
451std::string
453 // declare string error
454 std::string error;
455 switch (key) {
456 case SUMO_ATTR_ID:
457 return getMicrosimID();
458 case SUMO_ATTR_TYPE:
459 return getTypeParent()->getID();
460 case SUMO_ATTR_COLOR:
462 return toString(color);
463 } else {
465 }
468 return getDepartPos();
469 } else {
471 }
472 default:
473 return getFlowAttribute(this, key);
474 }
475}
476
477
478double
480 switch (key) {
483 return departPos;
484 } else {
485 return 0;
486 }
487 default:
488 return getFlowAttributeDouble(key);
489 }
490}
491
492
495 switch (key) {
496 case SUMO_ATTR_DEPARTPOS: {
497 // first check number of child demand elements
498 if (getChildDemandElements().empty()) {
499 return Position();
500 }
501 // get container plan
502 const GNEDemandElement* containerPlan = getChildDemandElements().front();
503 // first check if first container plan is a stop
504 if (containerPlan->getTagProperty()->isPlanStopContainer()) {
505 // stop center
506 return containerPlan->getPositionInView();
507 } else if (containerPlan->getTagProperty()->planFromTAZ()) {
508 // TAZ
509 if (containerPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) {
510 return containerPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID);
511 } else {
512 return containerPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
513 }
514 } else if (containerPlan->getTagProperty()->planFromJunction()) {
515 // juncrtion
516 return containerPlan->getParentJunctions().front()->getPositionInView();
517 } else {
519 }
520 }
521 default:
522 return getCommonAttributePosition(key);
523 }
524}
525
526
527void
528GNEContainer::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
529 switch (key) {
530 case SUMO_ATTR_ID:
531 case SUMO_ATTR_TYPE:
532 case SUMO_ATTR_COLOR:
534 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
535 break;
536 default:
537 setFlowAttribute(this, key, value, undoList);
538 break;
539 }
540}
541
542
543bool
544GNEContainer::isValid(SumoXMLAttr key, const std::string& value) {
545 // declare string error
546 std::string error;
547 switch (key) {
548 case SUMO_ATTR_ID:
550 case SUMO_ATTR_TYPE:
551 return (myNet->getAttributeCarriers()->retrieveDemandElements(NamespaceIDs::types, value, false) != nullptr);
552 case SUMO_ATTR_COLOR:
553 return canParse<RGBColor>(value);
554 case SUMO_ATTR_DEPARTPOS: {
555 double dummyDepartPos;
556 DepartPosDefinition dummyDepartPosProcedure;
557 parseDepartPos(value, myTagProperty->getTagStr(), id, dummyDepartPos, dummyDepartPosProcedure, error);
558 // if error is empty, given value is valid
559 return error.empty();
560 }
561 default:
562 return isValidFlowAttribute(this, key, value);
563 }
564}
565
566
567void
569 enableFlowAttribute(this, key, undoList);
570}
571
572
573void
575 disableFlowAttribute(this, key, undoList);
576}
577
578
579bool
583
584
585std::string
587 return getTagStr();
588}
589
590
591std::string
593 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
594 // special case for Trips and flow
596 // check if we're inspecting an Edge
597 if (inspectedElements.getFirstAC() && (inspectedElements.getFirstAC()->getTagProperty()->getTag() == SUMO_TAG_EDGE)) {
598 // check if edge correspond to a "from", "to" or "via" edge
599 if (inspectedElements.isACInspected(getParentEdges().front())) {
600 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (from)";
601 } else if (inspectedElements.isACInspected(getParentEdges().front())) {
602 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (to)";
603 } else {
604 // iterate over via
605 for (const auto& viaEdgeID : via) {
606 if (viaEdgeID == inspectedElements.getFirstAC()->getID()) {
607 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (via)";
608 }
609 }
610 }
611 }
612 }
613 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
614}
615
616// ===========================================================================
617// protected
618// ===========================================================================
619
622 // change color
623 if (drawUsingSelectColor()) {
625 } else {
626 return getColorByScheme(s.containerColorer, this);
627 }
628}
629
630
631void
633 // obtain width and length
634 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
635 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
636 // draw pedestrian shape
637 glScaled(length * 0.2, width * 0.2, 1);
638 glBegin(GL_QUADS);
639 glVertex2d(0, 0.5);
640 glVertex2d(0, -0.5);
641 glVertex2d(-1, -0.5);
642 glVertex2d(-1, 0.5);
643 glEnd();
644 GLHelper::setColor(GLHelper::getColor().changedBrightness(-30));
645 glTranslated(0, 0, .045);
646 glBegin(GL_QUADS);
647 glVertex2d(-0.1, 0.4);
648 glVertex2d(-0.1, -0.4);
649 glVertex2d(-0.9, -0.4);
650 glVertex2d(-0.9, 0.4);
651 glEnd();
652}
653
654
655void
657 const std::string& file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
658 // obtain width and length
659 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
660 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
661 if (file != "") {
662 // @todo invent an option for controlling whether images should be rotated or not
663 //if (getVehicleType().getGuiShape() == SVS_CONTAINER) {
664 // glRotated(RAD2DEG(getAngle() + M_PI / 2.), 0, 0, 1);
665 //}
666 int textureID = GUITexturesHelper::getTextureID(file);
667 if (textureID > 0) {
668 const double exaggeration = s.containerSize.getExaggeration(s, this);
669 const double halfLength = length / 2.0 * exaggeration;
670 const double halfWidth = width / 2.0 * exaggeration;
671 GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, -halfLength, halfWidth, halfLength);
672 }
673 } else {
674 // fallback if no image is defined
676 }
677}
678
679// ===========================================================================
680// private
681// ===========================================================================
682
684 containerPlan(_containerPlan),
685 edge(nullptr),
686 arrivalPos(-1) {
687}
688
689
691 containerPlan(nullptr),
692 edge(nullptr),
693 arrivalPos(-1) {
694}
695
696
697void
698GNEContainer::setAttribute(SumoXMLAttr key, const std::string& value) {
699 // declare string error
700 std::string error;
701 switch (key) {
702 case SUMO_ATTR_ID:
703 // update microsimID
704 setDemandElementID(value);
705 // update id
706 id = value;
707 break;
708 case SUMO_ATTR_TYPE:
709 if (getID().size() > 0) {
711 // set manually vtypeID (needed for saving)
712 vtypeid = value;
713 }
714 break;
715 case SUMO_ATTR_COLOR:
716 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
717 color = parse<RGBColor>(value);
718 // mark parameter as set
720 } else {
721 // set default value
722 color = parse<RGBColor>(myTagProperty->getDefaultStringValue(key));
723 // unset parameter
724 parametersSet &= ~VEHPARS_COLOR_SET;
725 }
726 break;
728 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
730 // mark parameter as set
732 } else {
733 // set default value
735 // unset parameter
736 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
737 }
738 // compute container
740 break;
741 default:
742 setFlowAttribute(this, key, value);
743 break;
744 }
745}
746
747void
749 // toggle flow attributes
750 toggleFlowAttribute(key, value);
751}
752
753/****************************************************************************/
FXDEFMAP(GNEContainer::GNEContainerPopupMenu) containerPopupMenuMap[]
@ MID_GNE_CONTAINER_TRANSFORM
transform container to another container type (ej: container to containerflow)
@ CONTAINERFLOW
const std::string DEFAULT_CONTAINERTYPE_ID
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_CONTAINERFLOW
@ GNE_TAG_STOPCONTAINER_CONTAINERSTOP
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
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_CONTAINERSPERHOUR
@ 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
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 RGBColor getColor()
gets the gl-color
Definition GLHelper.cpp:655
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
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
class used in GUIGLObjectPopupMenu for container transformations
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current container to another container type.
class used in GUIGLObjectPopupMenu for single container transformations
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current container to another container type.
GNESelectedContainersPopupMenu(GNEContainer *container, const std::vector< GNEContainer * > &selectedContainer, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
FXMenuCommand * myTransformToContainer
menu command for transform to container
FXMenuCommand * myTransformToContainerFlow
menu command for transform to containerFlow
GNELane * getLastPathLane() const override
get last path lane
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
std::string getDemandElementProblem() const override
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
void updateGeometry() override
update pre-computed geometry information
Parameterised * getParameters() override
get parameters associated with this container
void writeDemandElement(OutputDevice &device) const override
write demand element element into a xml file
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
Problem isDemandElementValid() const override
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
GNEContainer(SumoXMLTag tag, GNENet *net)
default constructor
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
SUMOVehicleClass getVClass() const override
obtain VClass related with this demand element
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this container
void toggleAttribute(SumoXMLAttr key, const bool value) override
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
void fixDemandElementProblem() override
fix demand element problem (by default throw an exception, has to be reimplemented in children)
bool isAttributeEnabled(SumoXMLAttr key) const override
double getAttributeDouble(SumoXMLAttr key) const override
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
bool isValid(SumoXMLAttr key, const std::string &value) override
void drawAction_drawAsPoly() const
draw container as poly
std::string getParentName() const override
Returns the name of the parent object.
GNEMoveElementPlanParent * myMoveElementPlanParent
move element plan parent
Position getPositionInView() const override
Returns position of demand element in view.
Position getAttributePosition(SumoXMLAttr key) const override
GNELane * getFirstPathLane() const override
get first path lane
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
draw container as image
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
~GNEContainer()
destructor
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
void computePathElement() override
compute pathElement
GNEContour myContainerContour
variable used for contours
const RGBColor & getColor() const override
get color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList) override
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 drawJunctionLine(const GNEDemandElement *element) const
draw line between junctions
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< GNEEdge * > & getParentEdges() const
get parent edges
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.
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:198
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
bool isPathValid(const GNEPathElement *pathElement) const
check if path element is valid
static void transformToContainerFlow(GNEContainer *originalContainer)
transform routeFlow over an existent route
static void transformToContainer(GNEContainer *originalContainer)
transform container functions
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
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool isPlanStopContainer() const
return true if tag correspond to a container stop plan
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
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
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
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.
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
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings containerSize
int containerQuality
The quality of container drawing.
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
bool checkDrawContainer(Detail d, const bool selected) const
check if draw container
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationTextSettings containerName
GUIColorer containerColorer
The container colorer.
double angle
The current view rotation angle.
static const std::vector< SumoXMLTag > types
type namespace
static const std::vector< SumoXMLTag > containers
containers 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.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
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 selectedContainerColor
container 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