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-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Representation of containers in netedit
19/****************************************************************************/
20
24#include <netedit/GNENet.h>
31
32#include "GNEContainer.h"
33#include "GNERouteHandler.h"
34
35// ===========================================================================
36// FOX callback mapping
37// ===========================================================================
38
42
46
47// Object implementation
48FXIMPLEMENT(GNEContainer::GNEContainerPopupMenu, GUIGLObjectPopupMenu, containerPopupMenuMap, ARRAYNUMBER(containerPopupMenuMap))
49FXIMPLEMENT(GNEContainer::GNESelectedContainersPopupMenu, GUIGLObjectPopupMenu, selectedContainersPopupMenuMap, ARRAYNUMBER(selectedContainersPopupMenuMap))
50
51// ===========================================================================
52// GNEContainer::GNEContainerPopupMenu
53// ===========================================================================
54
56 GUIGLObjectPopupMenu(app, parent, container),
57 myContainer(container),
58 myTransformToContainer(nullptr),
59 myTransformToContainerFlow(nullptr) {
60 // build common options
61 container->buildPopUpMenuCommonOptions(this, app, container->myNet->getViewNet(), container->getTagProperty()->getTag(), container->isAttributeCarrierSelected());
62 // add transform functions only in demand mode
63 if (myContainer->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
64 // create menu pane for transform operations
65 FXMenuPane* transformOperation = new FXMenuPane(this);
66 this->insertMenuPaneChild(transformOperation);
67 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
68 // Create menu comands for all transformations
69 myTransformToContainer = GUIDesigns::buildFXMenuCommand(transformOperation, "Container", GUIIconSubSys::getIcon(GUIIcon::CONTAINER), this, MID_GNE_CONTAINER_TRANSFORM);
70 myTransformToContainerFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "ContainerFlow", GUIIconSubSys::getIcon(GUIIcon::CONTAINERFLOW), this, MID_GNE_CONTAINER_TRANSFORM);
71 // check what menu command has to be disabled
72 if (myContainer->getTagProperty()->getTag() == SUMO_TAG_CONTAINER) {
73 myTransformToContainer->disable();
74 } else if (myContainer->getTagProperty()->getTag() == SUMO_TAG_CONTAINERFLOW) {
75 myTransformToContainerFlow->disable();
76 }
77 }
78}
79
80
82
83
84long
85GNEContainer::GNEContainerPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
86 if (obj == myTransformToContainer) {
88 } else if (obj == myTransformToContainerFlow) {
90 }
91 return 1;
92}
93
94
95// ===========================================================================
96// GNEContainer::GNESelectedContainersPopupMenu
97// ===========================================================================
98
99GNEContainer::GNESelectedContainersPopupMenu::GNESelectedContainersPopupMenu(GNEContainer* container, const std::vector<GNEContainer*>& selectedContainer, GUIMainWindow& app, GUISUMOAbstractView& parent) :
100 GUIGLObjectPopupMenu(app, parent, container),
101 myContainerTag(container->getTagProperty()->getTag()),
102 mySelectedContainers(selectedContainer),
103 myTransformToContainer(nullptr),
104 myTransformToContainerFlow(nullptr) {
105 // build common options
106 container->buildPopUpMenuCommonOptions(this, app, container->myNet->getViewNet(), container->getTagProperty()->getTag(), container->isAttributeCarrierSelected());
107 // add transform functions only in demand mode
108 if (container->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
109 // create menu pane for transform operations
110 FXMenuPane* transformOperation = new FXMenuPane(this);
111 this->insertMenuPaneChild(transformOperation);
112 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
113 // Create menu comands for all transformations
116 }
117}
118
119
121
122
123long
125 // iterate over all selected containers
126 for (const auto& container : mySelectedContainers) {
127 if ((obj == myTransformToContainer) &&
128 (container->getTagProperty()->getTag() == myContainerTag)) {
130 } else if ((obj == myTransformToContainerFlow) &&
131 (container->getTagProperty()->getTag() == myContainerTag)) {
133 }
134 }
135 return 1;
136}
137
138// ===========================================================================
139// member method definitions
140// ===========================================================================
141
142#ifdef _MSC_VER
143#pragma warning(push)
144#pragma warning(disable: 4355) // mask warning about "this" in initializers
145#endif
154
155
156GNEContainer::GNEContainer(SumoXMLTag tag, GNENet* net, const std::string& filename, GNEDemandElement* pType, const SUMOVehicleParameter& containerparameters) :
157 GNEDemandElement(containerparameters.id, net, filename, tag, GNEPathElement::Options::DEMAND_ELEMENT),
158 GNEDemandElementFlow(this, containerparameters),
159 myMoveElementPlanParent(new GNEMoveElementPlanParent(this, departPos, departPosProcedure)) {
160 // set parents
161 setParent<GNEDemandElement*>(pType);
162 // set manually vtypeID (needed for saving)
163 vtypeid = pType->getID();
164}
165#ifdef _MSC_VER
166#pragma warning(pop)
167#endif
168
170
171
176
177
180 return this;
181}
182
183
184const Parameterised*
186 return this;
187}
188
189
190void
192 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
194 // unset VType parameter
195 parametersSet &= ~VEHPARS_VTYPE_SET;
196 // write container attributes (VType will not be written)
198 // set VType parameter again
200 } else {
201 // write container attributes, including VType
203 }
204 // write parameters
205 writeParams(device);
206 // write child demand elements associated to this container (Rides, Walks...)
207 for (const auto& containerPlan : getChildDemandElements()) {
208 containerPlan->writeDemandElement(device);
209 }
210 // close container tag
211 device.closeTag();
212}
213
214
217 if (getChildDemandElements().size() == 0) {
218 return Problem::NO_PLANS;
219 } else {
220 return Problem::OK;
221 }
222}
223
224
225std::string
227 if (getChildDemandElements().size() == 0) {
228 return "Container needs at least one plan";
229 } else {
230 return "";
231 }
232}
233
234
235void
237 // nothing to fix
238}
239
240
243 return getParentDemandElements().front()->getVClass();
244}
245
246
247const RGBColor&
249 return color;
250}
251
252
253void
255 // only update geometry of childrens
256 for (const auto& demandElement : getChildDemandElements()) {
257 demandElement->updateGeometry();
258 }
259}
260
261
266
267
270 // return a GNEContainerPopupMenu
271 return new GNEContainerPopupMenu(this, app, parent);
272}
273
274
275std::string
277 return getParentDemandElements().front()->getID();
278}
279
280
281double
285
286
289 Boundary containerBoundary;
290 if (getChildDemandElements().size() > 0) {
291 if (getChildDemandElements().front()->getTagProperty()->isPlanStopContainer()) {
292 // use boundary of stop center
293 return getChildDemandElements().front()->getCenteringBoundary();
294 } else {
295 containerBoundary.add(getPositionInView());
296 }
297 } else {
298 containerBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
299 }
300 containerBoundary.grow(20);
301 return containerBoundary;
302}
303
304
305void
306GNEContainer::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/,
307 const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
308 // geometry of this element cannot be splitted
309}
310
311
312void
314 bool drawContainer = true;
315 // check if container can be drawn
317 drawContainer = false;
319 drawContainer = false;
321 drawContainer = false;
322 } else if (getChildDemandElements().empty()) {
323 drawContainer = false;
324 }
325 // continue if container can be drawn
326 if (drawContainer) {
327 // obtain exaggeration (and add the special containerExaggeration)
328 const double exaggeration = getExaggeration(s) + 10;
329 // get detail level
330 const auto d = s.getDetailLevel(exaggeration);
331 // obtain position
332 const Position containerPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
333 if (containerPosition == Position::INVALID) {
334 return;
335 }
336 // draw geometry only if we'rent in drawForObjectUnderCursor mode
338 // obtain img file
339 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
340 // push draw matrix
342 // Start with the drawing of the area traslating matrix to origin
344 // translate and rotate
345 glTranslated(containerPosition.x(), containerPosition.y(), 0);
346 glRotated(90, 0, 0, 1);
347 // set container color
349 // set scale
350 glScaled(exaggeration, exaggeration, 1);
351 // draw container depending of detail level
352 switch (s.containerQuality) {
353 case 0:
354 case 1:
355 case 2:
357 break;
358 case 3:
359 default:
361 break;
362 }
363 // pop matrix
365 // draw line between junctions if container plan isn't valid
366 for (const auto& containerPlan : getChildDemandElements()) {
367 if (containerPlan->getTagProperty()->isPlanContainer() && (containerPlan->getParentJunctions().size() > 0) &&
368 !myNet->getDemandPathManager()->isPathValid(containerPlan)) {
369 drawJunctionLine(containerPlan);
370 }
371 }
372 // draw stack label
373 if (myStackedLabelNumber > 0) {
374 drawStackLabel(myStackedLabelNumber, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
376 // declare counter for stacked containers over stops
377 int stackedCounter = 0;
378 // get stoppingPlace
379 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
380 // get stacked containers
381 for (const auto& stopContainer : stoppingPlace->getChildDemandElements()) {
382 if (stopContainer->getTagProperty()->getTag() == GNE_TAG_STOPCONTAINER_CONTAINERSTOP) {
383 // get container parent
384 const auto containerParent = stopContainer->getParentDemandElements().front();
385 // check if the stop if the first container plan parent
386 if (stopContainer->getPreviousChildDemandElement(containerParent) == nullptr) {
387 stackedCounter++;
388 }
389 }
390 }
391 // if we have more than two stacked elements, draw label
392 if (stackedCounter > 1) {
393 drawStackLabel(stackedCounter, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
394 }
395 }
396 // draw flow label
397 if (myTagProperty->isFlow()) {
398 drawFlowLabel(Position(containerPosition.x() - 1, containerPosition.y() - 4.25), -90, 1.8, 2, getExaggeration(s));
399 }
400 // draw name
401 drawName(containerPosition, s.scale, s.containerName, s.angle);
402 // draw lock icon
404 // draw dotted contour
406 }
407 // calculate contour
408 myContainerContour.calculateContourRectangleShape(s, d, this, containerPosition, 0.5, 0.18, getType(), -5.5, 0, 0, exaggeration, nullptr);
409 }
410}
411
412
413void
415 // compute all container plan children (because aren't computed in "computeDemandElements()")
416 for (const auto& demandElement : getChildDemandElements()) {
417 demandElement->computePathElement();
418 }
419}
420
421
422void
423GNEContainer::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
424 // Stops don't use drawJunctionPartialGL
425}
426
427
428void
429GNEContainer::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 container plan
437 return getChildDemandElements().front()->getFirstPathLane();
438}
439
440
441GNELane*
443 // use path lane of first container 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 container plan
499 const GNEDemandElement* containerPlan = getChildDemandElements().front();
500 // first check if first container plan is a stop
501 if (containerPlan->getTagProperty()->isPlanStopContainer()) {
502 // stop center
503 return containerPlan->getPositionInView();
504 } else if (containerPlan->getTagProperty()->planFromTAZ()) {
505 // TAZ
506 if (containerPlan->getParentAdditionals().front()->getAttribute(SUMO_ATTR_CENTER).empty()) {
507 return containerPlan->getParentAdditionals().front()->getAttributePosition(GNE_ATTR_TAZ_CENTROID);
508 } else {
509 return containerPlan->getParentAdditionals().front()->getAttributePosition(SUMO_ATTR_CENTER);
510 }
511 } else if (containerPlan->getTagProperty()->planFromJunction()) {
512 // juncrtion
513 return containerPlan->getParentJunctions().front()->getPositionInView();
514 } else {
516 }
517 }
518 default:
519 return getCommonAttributePosition(key);
520 }
521}
522
523
524void
525GNEContainer::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
541GNEContainer::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, myTagProperty->getTagStr(), 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 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
591 // special case for Trips and flow
593 // check if we're inspecting an Edge
594 if (inspectedElements.getFirstAC() && (inspectedElements.getFirstAC()->getTagProperty()->getTag() == SUMO_TAG_EDGE)) {
595 // check if edge correspond to a "from", "to" or "via" edge
596 if (inspectedElements.isACInspected(getParentEdges().front())) {
597 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (from)";
598 } else if (inspectedElements.isACInspected(getParentEdges().front())) {
599 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (to)";
600 } else {
601 // iterate over via
602 for (const auto& viaEdgeID : via) {
603 if (viaEdgeID == inspectedElements.getFirstAC()->getID()) {
604 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (via)";
605 }
606 }
607 }
608 }
609 }
610 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
611}
612
613// ===========================================================================
614// protected
615// ===========================================================================
616
619 // change color
620 if (drawUsingSelectColor()) {
622 } else {
623 return getColorByScheme(s.containerColorer, this);
624 }
625}
626
627
628void
630 // obtain width and length
631 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
632 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
633 // draw pedestrian shape
634 glScaled(length * 0.2, width * 0.2, 1);
635 glBegin(GL_QUADS);
636 glVertex2d(0, 0.5);
637 glVertex2d(0, -0.5);
638 glVertex2d(-1, -0.5);
639 glVertex2d(-1, 0.5);
640 glEnd();
641 GLHelper::setColor(GLHelper::getColor().changedBrightness(-30));
642 glTranslated(0, 0, .045);
643 glBegin(GL_QUADS);
644 glVertex2d(-0.1, 0.4);
645 glVertex2d(-0.1, -0.4);
646 glVertex2d(-0.9, -0.4);
647 glVertex2d(-0.9, 0.4);
648 glEnd();
649}
650
651
652void
654 const std::string& file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
655 // obtain width and length
656 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
657 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
658 if (file != "") {
659 // @todo invent an option for controlling whether images should be rotated or not
660 //if (getVehicleType().getGuiShape() == SVS_CONTAINER) {
661 // glRotated(RAD2DEG(getAngle() + M_PI / 2.), 0, 0, 1);
662 //}
663 int textureID = GUITexturesHelper::getTextureID(file);
664 if (textureID > 0) {
665 const double exaggeration = s.containerSize.getExaggeration(s, this);
666 const double halfLength = length / 2.0 * exaggeration;
667 const double halfWidth = width / 2.0 * exaggeration;
668 GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, -halfLength, halfWidth, halfLength);
669 }
670 } else {
671 // fallback if no image is defined
673 }
674}
675
676// ===========================================================================
677// private
678// ===========================================================================
679
681 containerPlan(_containerPlan),
682 edge(nullptr),
683 arrivalPos(-1) {
684}
685
686
688 containerPlan(nullptr),
689 edge(nullptr),
690 arrivalPos(-1) {
691}
692
693
694void
695GNEContainer::setAttribute(SumoXMLAttr key, const std::string& value) {
696 // declare string error
697 std::string error;
698 switch (key) {
699 case SUMO_ATTR_ID:
700 // update microsimID
701 setDemandElementID(value);
702 // update id
703 id = value;
704 break;
705 case SUMO_ATTR_TYPE:
706 if (getID().size() > 0) {
708 // set manually vtypeID (needed for saving)
709 vtypeid = value;
710 }
711 break;
712 case SUMO_ATTR_COLOR:
713 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
714 color = parse<RGBColor>(value);
715 // mark parameter as set
717 } else {
718 // set default value
719 color = parse<RGBColor>(myTagProperty->getDefaultStringValue(key));
720 // unset parameter
721 parametersSet &= ~VEHPARS_COLOR_SET;
722 }
723 break;
725 if (!value.empty() && (value != myTagProperty->getDefaultStringValue(key))) {
727 // mark parameter as set
729 } else {
730 // set default value
732 // unset parameter
733 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
734 }
735 // compute container
737 break;
738 default:
739 setFlowAttribute(this, key, value);
740 break;
741 }
742}
743
744void
746 // toggle flow attributes
747 toggleFlowAttribute(key, value);
748}
749
750/****************************************************************************/
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_VTYPE
description of a vehicle/person/container type
@ 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:46
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:75
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static 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
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
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
Position getPositionInView() const
Returns position of demand element in view.
GNELane * getLastPathLane() const
get last path lane
void updateGeometry() override
update pre-computed geometry information
Parameterised * getParameters() override
get parameters associated with this container
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
const RGBColor & getColor() const
get color
GNEContainer(SumoXMLTag tag, GNENet *net)
default constructor
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this container
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
double getAttributeDouble(SumoXMLAttr key) const override
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool isValid(SumoXMLAttr key, const std::string &value) override
void drawAction_drawAsPoly() const
draw container as poly
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
GNEMoveElementPlanParent * myMoveElementPlanParent
move element plan parent
Position getAttributePosition(SumoXMLAttr key) const override
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
void computePathElement()
compute pathElement
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
draw container as image
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEContainer()
destructor
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
std::string getParentName() const
Returns the name of the parent object.
RGBColor getDrawingColor(const GUIVisualizationSettings &s) const
get drawing color
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
bool isAttributeEnabled(SumoXMLAttr key) const
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNEContour myContainerContour
variable used for contours
GNELane * getFirstPathLane() const
get first path lane
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double layer, const double offsetX, const double offsetY, const double rot, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (for rectangled elements)
void toggleFlowAttribute(const SumoXMLAttr attribute, const bool value)
toggle flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers
void drawFlowLabel(const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw flow label
std::string getFlowAttribute(const GNEDemandElement *flowElement, SumoXMLAttr key) const
inherited from GNEAttributeCarrier and adapted to GNEDemandElementFlow
void disableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
bool isFlowAttributeEnabled(SumoXMLAttr key) const
double getFlowAttributeDouble(SumoXMLAttr key) const
bool isValidFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value)
void enableFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, GNEUndoList *undoList)
void setFlowAttribute(GNEDemandElement *flowElement, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Position getAttributePosition(SumoXMLAttr key) const override
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
void drawStackLabel(const int number, const std::string &element, const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw stack label
bool isValidDemandElementID(const std::string &value) const
check if a new demand element ID is valid
void 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)
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.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPathManager * getDemandPathManager()
get demand path manager
Definition GNENet.cpp:174
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
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, bool addSeparator=true)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
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.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:323
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
Structure representing possible vehicle parameter.
SumoXMLTag tag
The vehicle tag.
std::string vtypeid
The vehicle's type id.
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.
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