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-2023 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#include <cmath>
22#include <netedit/GNENet.h>
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
33
34#include "GNEContainer.h"
35#include "GNERouteHandler.h"
36
37
38// ===========================================================================
39// FOX callback mapping
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 header
63 myContainer->buildPopupHeader(this, app);
64 // build menu command for center button and copy cursor position to clipboard
65 myContainer->buildCenterPopupEntry(this);
66 myContainer->buildPositionCopyEntry(this, app);
67 // buld menu commands for names
68 GUIDesigns::buildFXMenuCommand(this, ("Copy " + myContainer->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
69 GUIDesigns::buildFXMenuCommand(this, ("Copy " + myContainer->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
70 new FXMenuSeparator(this);
71 // build selection and show parameters menu
72 myContainer->getNet()->getViewNet()->buildSelectionACPopupEntry(this, myContainer);
73 myContainer->buildShowParamsPopupEntry(this);
74 // add transform functions only in demand mode
75 if (myContainer->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
76 // create menu pane for transform operations
77 FXMenuPane* transformOperation = new FXMenuPane(this);
78 this->insertMenuPaneChild(transformOperation);
79 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
80 // Create menu comands for all transformations
81 myTransformToContainer = GUIDesigns::buildFXMenuCommand(transformOperation, "Container", GUIIconSubSys::getIcon(GUIIcon::CONTAINER), this, MID_GNE_CONTAINER_TRANSFORM);
82 myTransformToContainerFlow = GUIDesigns::buildFXMenuCommand(transformOperation, "ContainerFlow", GUIIconSubSys::getIcon(GUIIcon::CONTAINERFLOW), this, MID_GNE_CONTAINER_TRANSFORM);
83 // check what menu command has to be disabled
84 if (myContainer->getTagProperty().getTag() == SUMO_TAG_CONTAINER) {
85 myTransformToContainer->disable();
86 } else if (myContainer->getTagProperty().getTag() == SUMO_TAG_CONTAINERFLOW) {
87 myTransformToContainerFlow->disable();
88 }
89 }
90}
91
92
94
95
96long
97GNEContainer::GNEContainerPopupMenu::onCmdTransform(FXObject* obj, FXSelector, void*) {
98 if (obj == myTransformToContainer) {
100 } else if (obj == myTransformToContainerFlow) {
102 }
103 return 1;
104}
105
106
107// ===========================================================================
108// GNEContainer::GNESelectedContainersPopupMenu
109// ===========================================================================
110
111GNEContainer::GNESelectedContainersPopupMenu::GNESelectedContainersPopupMenu(GNEContainer* container, const std::vector<GNEContainer*>& selectedContainer, GUIMainWindow& app, GUISUMOAbstractView& parent) :
112 GUIGLObjectPopupMenu(app, parent, *container),
113 myContainerTag(container->getTagProperty().getTag()),
114 mySelectedContainers(selectedContainer),
115 myTransformToContainer(nullptr),
116 myTransformToContainerFlow(nullptr) {
117 // build header
118 container->buildPopupHeader(this, app);
119 // build menu command for center button and copy cursor position to clipboard
120 container->buildCenterPopupEntry(this);
121 container->buildPositionCopyEntry(this, app);
122 // buld menu commands for names
123 GUIDesigns::buildFXMenuCommand(this, ("Copy " + container->getTagStr() + " name to clipboard").c_str(), nullptr, this, MID_COPY_NAME);
124 GUIDesigns::buildFXMenuCommand(this, ("Copy " + container->getTagStr() + " typed name to clipboard").c_str(), nullptr, this, MID_COPY_TYPED_NAME);
125 new FXMenuSeparator(this);
126 // build selection and show parameters menu
127 container->getNet()->getViewNet()->buildSelectionACPopupEntry(this, container);
128 container->buildShowParamsPopupEntry(this);
129 // add transform functions only in demand mode
130 if (container->getNet()->getViewNet()->getEditModes().isCurrentSupermodeDemand()) {
131 // create menu pane for transform operations
132 FXMenuPane* transformOperation = new FXMenuPane(this);
133 this->insertMenuPaneChild(transformOperation);
134 new FXMenuCascade(this, "transform to", nullptr, transformOperation);
135 // Create menu comands for all transformations
138 }
139}
140
141
143
144
145long
147 // iterate over all selected containers
148 for (const auto& container : mySelectedContainers) {
149 if ((obj == myTransformToContainer) &&
150 (container->getTagProperty().getTag() == myContainerTag)) {
152 } else if ((obj == myTransformToContainerFlow) &&
153 (container->getTagProperty().getTag() == myContainerTag)) {
155 }
156 }
157 return 1;
158}
159
160// ===========================================================================
161// member method definitions
162// ===========================================================================
163
166 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {}, {}) {
167 // reset default values
168 resetDefaultValues();
169 // set end and vehPerHours
170 toggleAttribute(SUMO_ATTR_END, 1);
171 toggleAttribute(SUMO_ATTR_CONTAINERSPERHOUR, 1);
172}
173
174
176 GNEDemandElement(containerparameters.id, net, (tag == SUMO_TAG_CONTAINERFLOW) ? GLO_CONTAINERFLOW : GLO_CONTAINER, tag,
178 GNEPathManager::PathElement::Options::DEMAND_ELEMENT, {}, {}, {}, {}, {pType}, {}),
179SUMOVehicleParameter(containerparameters) {
180 // set manually vtypeID (needed for saving)
181 vtypeid = pType->getID();
182 // adjust default flow attributes
184}
185
186
188
189
192 // check first container plan
193 if (getChildDemandElements().front()->getTagProperty().isStopContainer()) {
194 return nullptr;
195 } else {
196 // get lane
197 const GNELane* lane = getChildDemandElements().front()->getParentEdges().front()->getLaneByAllowedVClass(getVClass());
198 // declare departPos
199 double posOverLane = 0;
200 if (canParse<double>(getDepartPos())) {
201 posOverLane = parse<double>(getDepartPos());
202 }
203 // return move operation
204 return new GNEMoveOperation(this, lane, posOverLane, false);
205 }
206}
207
208
209std::string
211 // obtain depart
212 std::string departStr = depart < 0 ? "0.00" : time2string(depart);
213 // we need to handle depart as a tuple of 20 numbers (format: 000000...00<departTime>)
214 departStr.reserve(20 - departStr.size());
215 // add 0s at the beginning of departStr until we have 20 numbers
216 for (int i = (int)departStr.size(); i < 20; i++) {
217 departStr.insert(departStr.begin(), '0');
218 }
219 return departStr;
220}
221
222
223void
225 // attribute VType musn't be written if is DEFAULT_PEDTYPE_ID
227 // unset VType parameter
228 parametersSet &= ~VEHPARS_VTYPE_SET;
229 // write container attributes (VType will not be written)
231 // set VType parameter again
233 } else {
234 // write container attributes, including VType
236 }
237 // write specific flow attributes
239 // write routeFlow values depending if it was set
242 }
245 }
248 }
251 }
254 }
257 }
258 }
259 // write parameters
260 writeParams(device);
261 // write child demand elements associated to this container (Rides, Walks...)
262 for (const auto& containerPlan : getChildDemandElements()) {
263 containerPlan->writeDemandElement(device);
264 }
265 // close container tag
266 device.closeTag();
267}
268
269
272 if (getChildDemandElements().size() == 0) {
273 return Problem::NO_PLANS;
274 } else {
275 return Problem::OK;
276 }
277}
278
279
280std::string
282 if (getChildDemandElements().size() == 0) {
283 return "Container needs at least one plan";
284 } else {
285 return "";
286 }
287}
288
289
290void
292 // nothing to fix
293}
294
295
298 return getParentDemandElements().front()->getVClass();
299}
300
301
302const RGBColor&
304 return color;
305}
306
307
308void
310 // only update geometry of childrens
311 for (const auto& demandElement : getChildDemandElements()) {
312 demandElement->updateGeometry();
313 }
314}
315
316
321
322
325 // return a GNEContainerPopupMenu
326 return new GNEContainerPopupMenu(this, app, parent);
327}
328
329
330std::string
332 return getParentDemandElements().front()->getID();
333}
334
335
336double
340
341
344 Boundary containerBoundary;
345 if (getChildDemandElements().size() > 0) {
346 if (getChildDemandElements().front()->getTagProperty().isStopContainer()) {
347 // use boundary of stop center
348 return getChildDemandElements().front()->getCenteringBoundary();
349 } else {
350 containerBoundary.add(getPositionInView());
351 }
352 } else {
353 containerBoundary = Boundary(-0.1, -0.1, 0.1, 0.1);
354 }
355 containerBoundary.grow(20);
356 return containerBoundary;
357}
358
359
360void
361GNEContainer::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
362 // geometry of this element cannot be splitted
363}
364
365
366void
368 bool drawContainer = true;
369 // check if container can be drawn
370 if (color.alpha() == 0) {
371 drawContainer = false;
373 drawContainer = false;
375 drawContainer = false;
377 drawContainer = false;
378 } else if (getChildDemandElements().empty()) {
379 drawContainer = false;
380 }
381 // continue if container can be drawn
382 if (drawContainer) {
383 // obtain exaggeration (and add the special containerExaggeration)
384 const double exaggeration = getExaggeration(s) + s.detailSettings.personExaggeration;
385 // obtain width and length
386 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
387 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
388 // obtain diameter around container (used to calculate distance bewteen cursor and container)
389 const double distanceSquared = pow(exaggeration * std::max(length, width), 2);
390 // obtain img file
391 const std::string file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
392 // obtain position
393 const Position containerPosition = getAttributePosition(SUMO_ATTR_DEPARTPOS);
394 // check if container can be drawn
395 if (!(s.drawForPositionSelection && (containerPosition.distanceSquaredTo(myNet->getViewNet()->getPositionInformation()) > distanceSquared))) {
396 // push GL ID
398 // push draw matrix
400 // Start with the drawing of the area traslating matrix to origin
402 // translate and rotate
403 glTranslated(containerPosition.x(), containerPosition.y(), 0);
404 glRotated(90, 0, 0, 1);
405 // set container color
407 // set scale
408 glScaled(exaggeration, exaggeration, 1);
409 // draw container depending of detail level
410 switch (s.containerQuality) {
411 case 0:
412 case 1:
413 case 2:
415 break;
416 case 3:
417 default:
419 break;
420 }
421 // pop matrix
423 // draw line between junctions if container plan isn't valid
424 for (const auto& containerPlan : getChildDemandElements()) {
425 if (containerPlan->getTagProperty().isContainerPlan() && (containerPlan->getParentJunctions().size() > 0) && !myNet->getPathManager()->isPathValid(containerPlan)) {
426 drawJunctionLine(containerPlan);
427 }
428 }
429 // pop name
431 // draw stack label
432 if (myStackedLabelNumber > 0) {
433 drawStackLabel(myStackedLabelNumber, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
435 // declare counter for stacked containers over stops
436 int stackedCounter = 0;
437 // get stoppingPlace
438 const auto stoppingPlace = getChildDemandElements().front()->getParentAdditionals().front();
439 // get stacked containers
440 for (const auto& stopContainer : stoppingPlace->getChildDemandElements()) {
441 if (stopContainer->getTagProperty().getTag() == GNE_TAG_STOPCONTAINER_CONTAINERSTOP) {
442 // get container parent
443 const auto containerParent = stopContainer->getParentDemandElements().front();
444 // check if the stop if the first container plan parent
445 if (stopContainer->getPreviousChildDemandElement(containerParent) == nullptr) {
446 stackedCounter++;
447 }
448 }
449 }
450 // if we have more than two stacked elements, draw label
451 if (stackedCounter > 1) {
452 drawStackLabel(stackedCounter, "container", Position(containerPosition.x() - 2.5, containerPosition.y() - 0.8), -90, 1.3, 5, getExaggeration(s));
453 }
454 }
455 // draw flow label
456 if (myTagProperty.isFlow()) {
457 drawFlowLabel(Position(containerPosition.x() - 1, containerPosition.y() - 4.25), -90, 1.8, 2, getExaggeration(s));
458 }
459 // draw name
460 drawName(containerPosition, s.scale, s.containerName, s.angle);
461 if (s.personValue.show(this)) {
462 Position containerValuePosition = containerPosition + Position(0, 0.6 * s.containerName.scaledSize(s.scale));
463 const double value = getColorValue(s, s.containerColorer.getActive());
464 GLHelper::drawTextSettings(s.personValue, toString(value), containerValuePosition, s.scale, s.angle, GLO_MAX - getType());
465 }
466 // check if mouse is over element
467 mouseWithinGeometry(containerPosition, 0.5, 0.2, -2.5, 0, 0);
468 // draw lock icon
470 // inspect contour
472 // draw using drawDottedSquaredShape
473 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::INSPECT, containerPosition, 0.5, 0.2, -2.5, 0, 0, exaggeration);
474 }
475 // front element contour
476 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
477 // draw using drawDottedSquaredShape
478 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::FRONT, containerPosition, 0.5, 0.2, -2.5, 0, 0, exaggeration);
479 }
480 // delete contour
481 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
482 // draw using drawDottedSquaredShape
483 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::REMOVE, containerPosition, 0.5, 0.2, -2.5, 0, 0, exaggeration);
484 }
485 // select contour
486 if (myNet->getViewNet()->drawSelectContour(this, this)) {
487 // draw using drawDottedSquaredShape
488 GUIDottedGeometry::drawDottedSquaredShape(s, GUIDottedGeometry::DottedContourType::SELECT, containerPosition, 0.5, 0.2, -2.5, 0, 0, exaggeration);
489 }
490 }
491 }
492}
493
494
495void
497 // compute all container plan children (because aren't computed in "computeDemandElements()")
498 for (const auto& demandElement : getChildDemandElements()) {
499 demandElement->computePathElement();
500 }
501}
502
503
504void
505GNEContainer::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*lane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
506 // Stops don't use drawPartialGL
507}
508
509
510void
511GNEContainer::drawPartialGL(const GUIVisualizationSettings& /*s*/, const GNELane* /*fromLane*/, const GNELane* /*toLane*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
512 // Stops don't use drawPartialGL
513}
514
515
516GNELane*
518 // use path lane of first container plan
519 return getChildDemandElements().front()->getFirstPathLane();
520}
521
522
523GNELane*
525 // use path lane of first container plan
526 return getChildDemandElements().front()->getLastPathLane();
527}
528
529
530std::string
532 // declare string error
533 std::string error;
534 switch (key) {
535 case SUMO_ATTR_ID:
536 return getMicrosimID();
537 case SUMO_ATTR_TYPE:
538 return getTypeParent()->getID();
539 case SUMO_ATTR_COLOR:
541 return toString(color);
542 } else {
544 }
547 return getDepartPos();
548 } else {
550 }
551 // Specific of containers
552 case SUMO_ATTR_DEPART:
554 return "triggered";
556 return "containerTriggered";
558 return "now";
560 return "split";
562 return "begin";
563 } else {
564 return time2string(depart);
565 }
566 // Specific of containerFlows
567 case SUMO_ATTR_BEGIN:
568 return time2string(depart);
569 case SUMO_ATTR_END:
572 return toString(3600 / STEPS2TIME(repetitionOffset));
573 case SUMO_ATTR_PERIOD:
574 case GNE_ATTR_POISSON:
576 case SUMO_ATTR_PROB:
578 case SUMO_ATTR_NUMBER:
580 //
584 return getParametersStr();
585 default:
586 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
587 }
588}
589
590
591double
593 switch (key) {
595 return STEPS2TIME(depart);
596 default:
597 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
598 }
599}
600
601
604 switch (key) {
605 case SUMO_ATTR_DEPARTPOS: {
606 // get container plan
607 const GNEDemandElement* containerPlan = getChildDemandElements().front();
608 // first check if first container plan is a stop
609 if (containerPlan->getTagProperty().isStopContainer()) {
610 return containerPlan->getPositionInView();
611 } else {
612 // declare lane lane
613 const GNELane* lane = containerPlan->getParentEdges().front()->getLaneByAllowedVClass(SVC_IGNORING);
614 // get position over lane shape
615 if (departPos <= 0) {
616 return lane->getLaneShape().front();
617 } else if (departPos >= lane->getLaneShape().length2D()) {
618 return lane->getLaneShape().back();
619 } else {
621 }
622 }
623 }
624 default:
625 throw InvalidArgument(getTagStr() + " doesn't have a Position attribute of type '" + toString(key) + "'");
626 }
627}
628
629
630void
631GNEContainer::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
632 switch (key) {
633 case SUMO_ATTR_ID:
634 case SUMO_ATTR_TYPE:
635 case SUMO_ATTR_COLOR:
637 // Specific of containers
638 case SUMO_ATTR_DEPART:
639 // Specific of containerFlows
640 case SUMO_ATTR_BEGIN:
641 case SUMO_ATTR_END:
642 case SUMO_ATTR_NUMBER:
644 case SUMO_ATTR_PERIOD:
645 case GNE_ATTR_POISSON:
646 case SUMO_ATTR_PROB:
647 //
650 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
651 break;
652 default:
653 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
654 }
655}
656
657
658bool
659GNEContainer::isValid(SumoXMLAttr key, const std::string& value) {
660 // declare string error
661 std::string error;
662 switch (key) {
663 case SUMO_ATTR_ID:
664 if (value == getID()) {
665 return true;
666 } else if (SUMOXMLDefinitions::isValidVehicleID(value)) {
668 } else {
669 return false;
670 }
671 case SUMO_ATTR_TYPE:
674 } else {
675 return false;
676 }
677 case SUMO_ATTR_COLOR:
678 return canParse<RGBColor>(value);
679 case SUMO_ATTR_DEPARTPOS: {
680 double dummyDepartPos;
681 DepartPosDefinition dummyDepartPosProcedure;
682 parseDepartPos(value, toString(SUMO_TAG_VEHICLE), id, dummyDepartPos, dummyDepartPosProcedure, error);
683 // if error is empty, given value is valid
684 return error.empty();
685 }
686 // Specific of containers
687 case SUMO_ATTR_DEPART:
688 case SUMO_ATTR_BEGIN: {
689 SUMOTime dummyDepart;
690 DepartDefinition dummyDepartProcedure;
691 parseDepart(value, toString(SUMO_TAG_CONTAINER), id, dummyDepart, dummyDepartProcedure, error);
692 // if error is empty, given value is valid
693 return error.empty();
694 }
695 // Specific of containerflows
696 case SUMO_ATTR_END:
697 if (value.empty()) {
698 return true;
699 } else if (canParse<double>(value)) {
700 return (parse<double>(value) >= 0);
701 } else {
702 return false;
703 }
705 if (value.empty()) {
706 return true;
707 } else if (canParse<double>(value)) {
708 return (parse<double>(value) > 0);
709 } else {
710 return false;
711 }
712 case SUMO_ATTR_PERIOD:
713 case GNE_ATTR_POISSON:
714 if (value.empty()) {
715 return true;
716 } else if (canParse<double>(value)) {
717 return (parse<double>(value) > 0);
718 } else {
719 return false;
720 }
721 case SUMO_ATTR_PROB:
722 if (value.empty()) {
723 return true;
724 } else if (canParse<double>(value)) {
725 return (parse<double>(value) >= 0);
726 } else {
727 return false;
728 }
729 case SUMO_ATTR_NUMBER:
730 if (canParse<int>(value)) {
731 return (parse<int>(value) >= 0);
732 } else {
733 return false;
734 }
735 //
737 return canParse<bool>(value);
740 default:
741 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
742 }
743}
744
745
746void
748 switch (key) {
749 case SUMO_ATTR_END:
750 case SUMO_ATTR_NUMBER:
752 case SUMO_ATTR_PERIOD:
753 case GNE_ATTR_POISSON:
754 case SUMO_ATTR_PROB:
755 undoList->add(new GNEChange_EnableAttribute(this, key, true, parametersSet), true);
756 return;
757 default:
758 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
759 }
760}
761
762
763void
765 switch (key) {
766 case SUMO_ATTR_END:
767 case SUMO_ATTR_NUMBER:
769 case SUMO_ATTR_PERIOD:
770 case GNE_ATTR_POISSON:
771 case SUMO_ATTR_PROB:
772 undoList->add(new GNEChange_EnableAttribute(this, key, false, parametersSet), true);
773 return;
774 default:
775 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
776 }
777}
778
779
780bool
782 switch (key) {
783 case SUMO_ATTR_END:
784 return (parametersSet & VEHPARS_END_SET) != 0;
785 case SUMO_ATTR_NUMBER:
786 return (parametersSet & VEHPARS_NUMBER_SET) != 0;
788 return (parametersSet & VEHPARS_VPH_SET) != 0;
789 case SUMO_ATTR_PERIOD:
790 return (parametersSet & VEHPARS_PERIOD_SET) != 0;
791 case GNE_ATTR_POISSON:
792 return (parametersSet & VEHPARS_POISSON_SET) != 0;
793 case SUMO_ATTR_PROB:
794 return (parametersSet & VEHPARS_PROB_SET) != 0;
795 default:
796 return true;
797 }
798}
799
800
801std::string
803 return getTagStr();
804}
805
806
807std::string
809 // special case for Trips and flow
811 // check if we're inspecting a Edge
813 myNet->getViewNet()->getInspectedAttributeCarriers().front()->getTagProperty().getTag() == SUMO_TAG_EDGE) {
814 // check if edge correspond to a "from", "to" or "via" edge
816 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (from)";
818 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (to)";
819 } else {
820 // iterate over via
821 for (const auto& i : via) {
822 if (i == myNet->getViewNet()->getInspectedAttributeCarriers().front()->getID()) {
823 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID) + " (via)";
824 }
825 }
826 }
827 }
828 }
829 return getTagStr() + ": " + getAttribute(SUMO_ATTR_ID);
830}
831
832
837
838// ===========================================================================
839// protected
840// ===========================================================================
841
842void
844 // obtain width and length
845 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
846 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
847 // draw pedestrian shape
848 glScaled(length * 0.2, width * 0.2, 1);
849 glBegin(GL_QUADS);
850 glVertex2d(0, 0.5);
851 glVertex2d(0, -0.5);
852 glVertex2d(-1, -0.5);
853 glVertex2d(-1, 0.5);
854 glEnd();
855 GLHelper::setColor(GLHelper::getColor().changedBrightness(-30));
856 glTranslated(0, 0, .045);
857 glBegin(GL_QUADS);
858 glVertex2d(-0.1, 0.4);
859 glVertex2d(-0.1, -0.4);
860 glVertex2d(-0.9, -0.4);
861 glVertex2d(-0.9, 0.4);
862 glEnd();
863}
864
865
866void
868 const std::string& file = getTypeParent()->getAttribute(SUMO_ATTR_IMGFILE);
869 // obtain width and length
870 const double length = getTypeParent()->getAttributeDouble(SUMO_ATTR_LENGTH);
871 const double width = getTypeParent()->getAttributeDouble(SUMO_ATTR_WIDTH);
872 if (file != "") {
873 // @todo invent an option for controlling whether images should be rotated or not
874 //if (getVehicleType().getGuiShape() == SVS_CONTAINER) {
875 // glRotated(RAD2DEG(getAngle() + M_PI / 2.), 0, 0, 1);
876 //}
877 int textureID = GUITexturesHelper::getTextureID(file);
878 if (textureID > 0) {
879 const double exaggeration = s.personSize.getExaggeration(s, this);
880 const double halfLength = length / 2.0 * exaggeration;
881 const double halfWidth = width / 2.0 * exaggeration;
882 GUITexturesHelper::drawTexturedBox(textureID, -halfWidth, -halfLength, halfWidth, halfLength);
883 }
884 } else {
885 // fallback if no image is defined
887 }
888}
889
890// ===========================================================================
891// private
892// ===========================================================================
893
895 containerPlan(_containerPlan),
896 edge(nullptr),
897 arrivalPos(-1) {
898}
899
900
902 containerPlan(nullptr),
903 edge(nullptr),
904 arrivalPos(-1) {
905}
906
907
908void
909GNEContainer::setAttribute(SumoXMLAttr key, const std::string& value) {
910 // declare string error
911 std::string error;
912 switch (key) {
913 case SUMO_ATTR_ID:
914 // update microsimID
915 setMicrosimID(value);
916 // update id
917 id = value;
918 // Change IDs of all container plans children
919 for (const auto& containerPlans : getChildDemandElements()) {
920 containerPlans->setMicrosimID(getID());
921 }
922 break;
923 case SUMO_ATTR_TYPE:
924 if (getID().size() > 0) {
926 // set manually vtypeID (needed for saving)
927 vtypeid = value;
928 }
929 break;
930 case SUMO_ATTR_COLOR:
931 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
932 color = parse<RGBColor>(value);
933 // mark parameter as set
935 } else {
936 // set default value
937 color = parse<RGBColor>(myTagProperty.getDefaultValue(key));
938 // unset parameter
939 parametersSet &= ~VEHPARS_COLOR_SET;
940 }
941 break;
943 if (!value.empty() && (value != myTagProperty.getDefaultValue(key))) {
945 // mark parameter as set
947 } else {
948 // set default value
950 // unset parameter
951 parametersSet &= ~VEHPARS_DEPARTPOS_SET;
952 }
953 // compute container
955 break;
956 // Specific of containers
957 case SUMO_ATTR_DEPART:
958 case SUMO_ATTR_BEGIN: {
960 break;
961 }
962 case SUMO_ATTR_END:
963 repetitionEnd = string2time(value);
964 break;
966 repetitionOffset = TIME2STEPS(3600 / parse<double>(value));
967 break;
968 case SUMO_ATTR_PERIOD:
969 case GNE_ATTR_POISSON:
971 break;
972 case SUMO_ATTR_PROB:
973 repetitionProbability = parse<double>(value);
974 break;
975 case SUMO_ATTR_NUMBER:
976 repetitionNumber = parse<int>(value);
977 break;
978 //
980 if (parse<bool>(value)) {
982 } else {
984 }
985 break;
987 setParametersStr(value);
988 break;
989 default:
990 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
991 }
992}
993
994
995void
997 // set flow parameters
998 setFlowParameters(this, key, value);
999}
1000
1001
1003 // change departPos
1005 departPos = moveResult.newFirstPos;
1006 // update geometry
1008}
1009
1010
1011void
1013 undoList->begin(GUIIcon::CONTAINER, "departPos of " + getTagStr());
1014 // now set departPos
1015 setAttribute(SUMO_ATTR_DEPARTPOS, toString(moveResult.newFirstPos), undoList);
1016 undoList->end();
1017}
1018
1019/****************************************************************************/
FXDEFMAP(GNEContainer::GNEContainerPopupMenu) containerPopupMenuMap[]
long long int SUMOTime
Definition GUI.h:36
@ MID_GNE_CONTAINER_TRANSFORM
transform container to another container type (ej: container to containerflow)
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition GUIAppEnum.h:450
@ MID_COPY_NAME
Copy object name - popup entry.
Definition GUIAppEnum.h:448
@ GLO_MAX
empty max
@ GLO_CONTAINER
a container
@ GLO_CONTAINERFLOW
a person flow
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ CONTAINERFLOW
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define STEPS2TIME(x)
Definition SUMOTime.h:55
#define TIME2STEPS(x)
Definition SUMOTime.h:57
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
const std::string DEFAULT_CONTAINERTYPE_ID
const int VEHPARS_PROB_SET
const int VEHPARS_VPH_SET
const int VEHPARS_END_SET
const int VEHPARS_COLOR_SET
const int VEHPARS_POISSON_SET
DepartPosDefinition
Possible ways to choose the departure position.
@ GIVEN
The position is given.
const int VEHPARS_DEPARTPOS_SET
const int VEHPARS_NUMBER_SET
const int VEHPARS_PERIOD_SET
const int VEHPARS_VTYPE_SET
DepartDefinition
Possible ways to depart.
@ BEGIN
The departure is at simulation start.
@ NOW
The vehicle is discarded if emission fails (not fully implemented yet)
@ SPLIT
The departure is triggered by a train split.
@ CONTAINER_TRIGGERED
The departure is container triggered.
@ TRIGGERED
The departure is person triggered.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_CONTAINERFLOW
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_STOPCONTAINER_CONTAINERSTOP
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ 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.
@ SUMO_ATTR_NUMBER
@ SUMO_ATTR_DEPART
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ GNE_ATTR_POISSON
poisson definition (used in flow)
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_CONTAINERSPERHOUR
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_PERIOD
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_PROB
@ 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:78
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:300
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:583
static void pushName(unsigned int name)
push Name
Definition GLHelper.cpp:139
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static RGBColor getColor()
gets the gl-color
Definition GLHelper.cpp:589
static void popName()
pop Name
Definition GLHelper.cpp:148
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:716
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_EnableAttribute
friend class GNEChange_Attribute
declare friend class
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
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
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.
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
GNELane * getLastPathLane() const
get last path lane
void updateGeometry()
update pre-computed geometry information
std::string getBegin() const
get begin time of demand element
Position getAttributePosition(SumoXMLAttr key) const
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
const RGBColor & getColor() const
get color
GNEContainer(SumoXMLTag tag, GNENet *net)
default constructor
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
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
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
void drawAction_drawAsPoly() const
draw container as poly
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
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.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
SUMOVehicleClass getVClass() const
GNEMoveOperation * getMoveOperation()
get move operation
double getAttributeDouble(SumoXMLAttr key) const
bool isAttributeEnabled(SumoXMLAttr key) const
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GNELane * getFirstPathLane() const
get first path lane
const Parameterised::Map & getACParametersMap() const
get parameters map
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
An Element which don't belong to GNENet but has influence in the simulation.
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
void drawFlowLabel(const Position &position, const double rotation, const double width, const double length, const double exaggeration) const
draw flow label
void drawJunctionLine(const GNEDemandElement *element) const
draw line between junctions
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNEDemandElement * getTypeParent() const
get type parent (needed because first parent can be either type or typeDistribution)
bool demandElementExist(const std::string &id, const std::vector< SumoXMLTag > tags) const
check if the given demand element exist
int myStackedLabelNumber
stacked label number
virtual Position getPositionInView() const =0
Returns position of demand element in view.
Problem
enum class for demandElement problems
void adjustDefaultFlowAttributes(SUMOVehicleParameter *vehicleParameters)
adjust flow default attributes (called in vehicle/person/flow constructors)
void setFlowParameters(SUMOVehicleParameter *vehicleParameters, const SumoXMLAttr attribute, const bool value)
set flow parameters (used in toggleAttribute(...) function of vehicles, persons and containers
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
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
const PositionVector & getLaneShape() const
get elements shape
Definition GNELane.cpp:136
move operation
move result
double newFirstPos
new first position
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNEPathManager * getPathManager()
get path manager
Definition GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
PathElement()=delete
invalidate default constructor
bool isPathValid(const PathElement *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 isFlow() const
return true if tag correspond to a flow element
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an element
SumoXMLTag getXMLTag() const
get XML tag
bool isStopContainer() const
return true if tag correspond to a container stop element
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...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
static void drawDottedSquaredShape(const GUIVisualizationSettings &s, const DottedContourType type, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
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.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
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.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
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
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
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
GUIVisualizationTextSettings personValue
GUIVisualizationDetailSettings detailSettings
detail settings
int containerQuality
The quality of container drawing.
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
GUIVisualizationSizeSettings personSize
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 OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
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
double distanceSquaredTo(const Position &p2) const
returns the square of the distance to another position
Definition Position.h:249
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition RGBColor.cpp:92
Structure representing possible vehicle parameter.
double repetitionProbability
The probability for emitting a vehicle per second.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
SumoXMLTag tag
The vehicle tag.
std::string vtypeid
The vehicle's type id.
SUMOTime repetitionOffset
The time offset between vehicle reinsertions.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
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.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
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
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error, const std::string &attr="departure")
Validates a given depart value.
bool wasSet(int what) const
Returns whether the given parameter was set.
std::string getDepartPos() const
obtain depart pos parameter in string format
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
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 bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
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 GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, 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
static const double personExaggeration
Exaggeration for persons (only used in netedit)
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