Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEStoppingPlace.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// A abstract class to define common parameters of lane area in which vehicles can halt (GNE version)
19/****************************************************************************/
20#include <config.h>
21
23#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
36
37#include "GNEStoppingPlace.h"
39
40// ===========================================================================
41// member method definitions
42// ===========================================================================
43
45 GNEAdditional("", net, "", tag, "") {
46}
47
48
49GNEStoppingPlace::GNEStoppingPlace(const std::string& id, GNENet* net, const std::string& filename,
50 SumoXMLTag tag, GNELane* lane, const double startPos, const double endPos,
51 const std::string& name, bool friendlyPosition, const RGBColor& color,
52 const Parameterised::Map& parameters) :
53 GNEAdditional(id, net, filename, tag, name),
54 Parameterised(parameters),
55 myStartPosition(startPos),
56 myEndPosition(endPos),
57 myFriendlyPosition(friendlyPosition),
58 myColor(color) {
59 // set parents
60 setParent<GNELane*>(lane);
61}
62
63
65
66
69 // get allow change lane
70 const bool allowChangeLane = myNet->getViewNet()->getViewParent()->getMoveFrame()->getCommonMoveOptions()->getAllowChangeLane();
71 // fist check if we're moving only extremes
72 if (drawMovingGeometryPoints(false)) {
73 // get geometry points under cursor
74 const auto geometryPoints = gViewObjectsHandler.getSelectedGeometryPoints(this);
75 // continue depending of moved element
76 if (geometryPoints.empty()) {
77 return nullptr;
78 } else if (geometryPoints.front() == 0) {
79 // move start position
80 return new GNEMoveOperation(this, getParentLanes().front(), myStartPosition, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
82 } else {
83 // move end position
84 return new GNEMoveOperation(this, getParentLanes().front(), 0, myEndPosition,
86 }
88 // move both start and end positions
91 } else if (myStartPosition != INVALID_DOUBLE) {
92 // move only start position
93 return new GNEMoveOperation(this, getParentLanes().front(), myStartPosition, getParentLanes().front()->getLaneShape().length2D() - POSITION_EPS,
95 } else if (myEndPosition != INVALID_DOUBLE) {
96 // move only end position
97 return new GNEMoveOperation(this, getParentLanes().front(), 0, myEndPosition,
99 } else {
100 // start and end positions undefined, then nothing to move
101 return nullptr;
102 }
103}
104
105
106bool
111
112
113std::string
115 // obtain lane length
116 double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() * getParentLanes().front()->getLengthGeometryFactor();
117 // calculate start and end positions
118 double startPos = getAttributeDouble(SUMO_ATTR_STARTPOS);
119 double endPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
120 // check if position has to be fixed
121 if (startPos < 0) {
122 startPos += laneLength;
123 }
124 if (endPos < 0) {
125 endPos += laneLength;
126 }
127 // declare variables
128 std::string errorStart, separator, errorEnd;
129 // check positions over lane
130 if (startPos < 0) {
131 errorStart = (toString(SUMO_ATTR_STARTPOS) + " < 0");
132 } else if (startPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
133 errorStart = (toString(SUMO_ATTR_STARTPOS) + TL(" > lanes's length"));
134 }
135 if (endPos < 0) {
136 errorEnd = (toString(SUMO_ATTR_ENDPOS) + " < 0");
137 } else if (endPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
138 errorEnd = (toString(SUMO_ATTR_ENDPOS) + TL(" > lanes's length"));
139 }
140 // check separator
141 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
142 separator = TL(" and ");
143 }
144 return errorStart + separator + errorEnd;
145}
146
147
148void
150 // calculate start and end positions
151 double startPos = getAttributeDouble(SUMO_ATTR_STARTPOS);
152 double endPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
153 // fix start and end positions using fixLaneDoublePosition
154 GNEAdditionalHandler::fixLaneDoublePosition(startPos, endPos, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
155 // set new start and end positions
158}
159
160
161bool
163 // get edit modes
164 const auto& editModes = myNet->getViewNet()->getEditModes();
165 // check if we're in move mode
166 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
168 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
169 // only move the first element
171 } else {
172 return false;
173 }
174}
175
176
181
182
183void
185 // nothing to do
186}
187
188
189void
190GNEStoppingPlace::splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
191 // first check tat both network elements are lanes and originalElement correspond to stoppingPlace lane
192 if ((originalElement->getTagProperty()->getTag() == SUMO_TAG_LANE) &&
193 (newElement->getTagProperty()->getTag() == SUMO_TAG_LANE) &&
194 (getParentLanes().front() == originalElement)) {
195 // check if we have to change additional lane depending of split position
197 // calculate middle position
198 const double middlePosition = ((myEndPosition - myStartPosition) / 2.0) + myStartPosition;
199 // four cases:
200 if (splitPosition < myStartPosition) {
201 // change lane
202 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
203 // now adjust start and end position
204 setAttribute(SUMO_ATTR_STARTPOS, toString(myStartPosition - splitPosition), undoList);
205 setAttribute(SUMO_ATTR_ENDPOS, toString(myEndPosition - splitPosition), undoList);
206 } else if ((splitPosition > myStartPosition) && (splitPosition < middlePosition)) {
207 // change lane
208 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
209 // now adjust start and end position
210 setAttribute(SUMO_ATTR_STARTPOS, "0", undoList);
211 setAttribute(SUMO_ATTR_ENDPOS, toString(myEndPosition - splitPosition), undoList);
212 } else if ((splitPosition > middlePosition) && (splitPosition < myEndPosition)) {
213 // only adjust end position
214 setAttribute(SUMO_ATTR_ENDPOS, toString(splitPosition), undoList);
215 } else if ((splitPosition > myEndPosition)) {
216 // nothing to do
217 }
218 } else if ((myStartPosition != INVALID_DOUBLE) && (splitPosition < myStartPosition)) {
219 // change lane
220 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
221 // now adjust start position
222 setAttribute(SUMO_ATTR_STARTPOS, toString(myEndPosition - splitPosition), undoList);
223 } else if ((myEndPosition != INVALID_DOUBLE) && (splitPosition < myEndPosition)) {
224 // change lane
225 setAttribute(SUMO_ATTR_LANE, newElement->getID(), undoList);
226 // now adjust end position
227 setAttribute(SUMO_ATTR_ENDPOS, toString(myEndPosition - splitPosition), undoList);
228 }
229 }
230}
231
232
233std::string
235 return getParentLanes().front()->getID();
236}
237
238
239void
241 // id
242 device.writeAttr(SUMO_ATTR_ID, getID());
243 // name (if defined)
244 if (!myAdditionalName.empty()) {
246 }
247 // lane
248 device.writeAttr(SUMO_ATTR_LANE, getParentLanes().front()->getID());
249 // start and end positions
252 }
255 }
256 // friendly position (only if true)
257 if (myFriendlyPosition) {
259 }
260 // color (if defined)
261 if (getAttribute(SUMO_ATTR_COLOR).size() > 0) {
263 }
264}
265
266
267std::string
269 switch (key) {
270 case SUMO_ATTR_ID:
271 return getMicrosimID();
272 case SUMO_ATTR_LANE:
273 return getParentLanes().front()->getID();
277 } else {
278 return TL("lane start");
279 }
280 case SUMO_ATTR_ENDPOS:
282 return toString(myEndPosition);
283 } else {
284 return TL("lane end");
285 }
286 case SUMO_ATTR_NAME:
287 return myAdditionalName;
290 case SUMO_ATTR_COLOR:
292 return "";
293 } else {
294 return toString(myColor);
295 }
296 // special attributes used during creation or edition
298 return "";
299 case GNE_ATTR_SIZE:
300 if (isTemplate()) {
301 return toString(mySize);
304 } else if (myStartPosition != INVALID_DOUBLE) {
305 return toString(getParentLanes().front()->getLaneShapeLength() - myStartPosition);
306 } else if (myEndPosition != INVALID_DOUBLE) {
307 return toString(myEndPosition);
308 } else if (getParentLanes().size() > 0) {
309 return toString(getParentLanes().front()->getLaneShapeLength());
310 } else {
311 return "10";
312 }
314 return toString(myForceSize);
317 default:
318 return getCommonAttribute(parameterised, key);
319 }
320}
321
322
323double
325 switch (key) {
328 return myStartPosition;
329 } else {
330 return 0;
331 }
332 case SUMO_ATTR_ENDPOS:
334 return myEndPosition;
335 } else {
336 return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
337 }
338 case SUMO_ATTR_CENTER:
340 default:
341 throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
342 }
343}
344
345
346void
347GNEStoppingPlace::setStoppingPlaceAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
348 switch (key) {
349 case SUMO_ATTR_ID:
350 case SUMO_ATTR_LANE:
352 case SUMO_ATTR_ENDPOS:
353 case SUMO_ATTR_NAME:
355 case SUMO_ATTR_COLOR:
356 // special attributes used during creation or edition
360 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
361 break;
362 case GNE_ATTR_SIZE:
363 adjustLenght(parse<double>(value), undoList);
364 break;
365 default:
366 setCommonAttribute(key, value, undoList);
367 break;
368 }
369}
370
371
372bool
373GNEStoppingPlace::isStoppingPlaceValid(SumoXMLAttr key, const std::string& value) const {
374 switch (key) {
375 case SUMO_ATTR_ID:
377 case SUMO_ATTR_LANE:
378 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
379 return true;
380 } else {
381 return false;
382 }
384 if (value.empty() || (value == TL("lane start"))) {
385 return true;
386 } else if (canParse<double>(value)) {
387 return SUMORouteHandler::isStopPosValid(parse<double>(value), getAttributeDouble(SUMO_ATTR_ENDPOS), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, myFriendlyPosition);
388 } else {
389 return false;
390 }
391 case SUMO_ATTR_ENDPOS:
392 if (value.empty() || (value == TL("lane end"))) {
393 return true;
394 } else if (canParse<double>(value)) {
395 return SUMORouteHandler::isStopPosValid(getAttributeDouble(SUMO_ATTR_STARTPOS), parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, myFriendlyPosition);
396 } else {
397 return false;
398 }
399 case SUMO_ATTR_NAME:
402 return canParse<bool>(value);
403 case SUMO_ATTR_COLOR:
404 if (value.empty()) {
405 return true;
406 } else {
407 return canParse<RGBColor>(value);
408 }
409 // special attributes used during creation or edition
411 return true;
412 case GNE_ATTR_SIZE:
413 if (value.empty()) {
414 return true;
415 } else {
416 return canParse<double>(value) && parse<double>(value) >= POSITION_EPS;
417 }
419 return canParse<bool>(value);
422 default:
423 return isCommonValid(key, value);
424 }
425}
426
427
428void
429GNEStoppingPlace::setStoppingPlaceAttribute(Parameterised* parameterised, SumoXMLAttr key, const std::string& value) {
430 switch (key) {
431 case SUMO_ATTR_ID:
432 // update microsimID
433 setAdditionalID(value);
434 break;
435 case SUMO_ATTR_LANE:
437 break;
439 if (value.empty() || (value == TL("lane start"))) {
441 } else {
442 myStartPosition = parse<double>(value);
443 }
444 break;
445 case SUMO_ATTR_ENDPOS:
446 if (value.empty() || (value == TL("lane end"))) {
448 } else {
449 myEndPosition = parse<double>(value);
450 }
451 break;
452 case SUMO_ATTR_NAME:
453 myAdditionalName = value;
454 break;
456 myFriendlyPosition = parse<bool>(value);
457 break;
458 case SUMO_ATTR_COLOR:
459 if (value.empty()) {
461 } else {
462 myColor = GNEAttributeCarrier::parse<RGBColor>(value);
463 }
464 break;
465 // special attributes used during creation or edition
468 break;
469 case GNE_ATTR_SIZE:
470 if (value.empty()) {
471 mySize = 10;
472 } else {
473 mySize = parse<double>(value);
474 }
475 break;
477 myForceSize = parse<bool>(value);
478 break;
481 break;
482 default:
483 setCommonAttribute(parameterised, key, value);
484 break;
485 }
486}
487
488
489void
491 if (getParentLanes().empty() || getParentLanes().front() == nullptr) {
492 // may happen during initialization
493 return;
494 }
495 // Get value of option "lefthand"
496 const bool lefthandAttr = hasAttribute(SUMO_ATTR_LEFTHAND) && parse<bool>(getAttribute(SUMO_ATTR_LEFTHAND));
497 const double offsetSign = OptionsCont::getOptions().getBool("lefthand") != lefthandAttr ? -1 : 1;
498
499 // obtain laneShape
500 PositionVector laneShape = getParentLanes().front()->getLaneShape();
501
502 // Move shape to side
503 laneShape.move2side(movingToSide * offsetSign);
504
505 // Cut shape using as delimitators fixed start position and fixed end position
507}
508
509
514
515
516bool
518 switch (key) {
520 if (isTemplate()) {
521 return true;
522 } else {
524 }
525 case GNE_ATTR_SIZE:
526 if (isTemplate()) {
527 return true;
528 } else {
530 }
531 default:
532 return true;
533 }
534}
535
536
537std::string
539 return getTagStr() + ": " + getID();
540}
541
542
543std::string
547
548
549void
550GNEStoppingPlace::drawLines(const GUIVisualizationSettings::Detail d, const std::vector<std::string>& lines, const RGBColor& color) const {
551 // only draw in level 1
553 // calculate middle point
554 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
555 // calculate rotation
556 const double rot = (myAdditionalGeometry.getShape().size() <= 1) ? 0 : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint);
557 // Iterate over every line
558 for (int i = 0; i < (int)lines.size(); ++i) {
559 // push a new matrix for every line
561 // translate
562 glTranslated(mySymbolPosition.x(), mySymbolPosition.y(), 0);
563 // rotate over lane
565 // draw line with a color depending of the selection status
566 if (drawUsingSelectColor()) {
567 GLHelper::drawText(lines[i].c_str(), Position(1.2, (double)i), .1, 1.f, color, 0, FONS_ALIGN_LEFT);
568 } else {
569 GLHelper::drawText(lines[i].c_str(), Position(1.2, (double)i), .1, 1.f, color, 0, FONS_ALIGN_LEFT);
570 }
571 // pop matrix for every line
573 }
574 }
575}
576
577
578void
580 const RGBColor& baseColor, const RGBColor& signColor, const std::string& word) const {
581 // only draw in level 2
583 // calculate middle point
584 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
585 // calculate rotation
586 const double rotSign = OptionsCont::getOptions().getBool("lefthand") ? -1 : 1;
587 const double rot = (myAdditionalGeometry.getShape().size() <= 1) ? 0 : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint) - 180. * rotSign;
588 // push matrix
590 // Start drawing sign traslating matrix to signal position
591 glTranslated(mySymbolPosition.x(), mySymbolPosition.y(), 0);
592 // rotate over lane
594 // scale matrix depending of the exaggeration
595 glScaled(exaggeration, exaggeration, 1);
596 // set color
597 GLHelper::setColor(baseColor);
598 // Draw circle
600 // continue depending of rectangle selection
602 // Traslate to front
603 glTranslated(0, 0, .1);
604 // set color
605 GLHelper::setColor(signColor);
606 // draw another circle in the same position, but a little bit more small
608 // draw H depending of detailSettings
610 }
611 // pop draw matrix
613 }
614}
615
616
617void
619 const double width, const double exaggeration, const bool movingGeometryPoints) const {
620 // check if we're calculating the contour or the moving geometry points
621 if (movingGeometryPoints) {
625 }
626 if (movingGeometryPoints && (myEndPosition != INVALID_DOUBLE)) {
629 }
630 } else {
631 // don't exaggerate contour
633 nullptr, getParentLanes().front()->getParentEdge());
635 exaggeration, getParentLanes().front()->getParentEdge());
636 }
637}
638
639
640double
643 // get lane final and shape length
644 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
645 // get startPosition
646 double fixedPos = myStartPosition;
647 // adjust fixedPos
648 if (fixedPos < 0) {
649 fixedPos += laneLength;
650 }
651 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
652 // return depending of fixedPos
653 if (fixedPos < 0) {
654 return 0;
655 } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
656 return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
657 } else {
658 return fixedPos;
659 }
660 } else {
661 return 0;
662 }
663}
664
665
666double
669 // get lane final and shape length
670 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
671 // get endPosition
672 double fixedPos = myEndPosition;
673 // adjust fixedPos
674 if (fixedPos < 0) {
675 fixedPos += laneLength;
676 }
677 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
678 // return depending of fixedPos
679 if (fixedPos < POSITION_EPS) {
680 return POSITION_EPS;
681 } else if (fixedPos > getParentLanes().front()->getLaneShapeLength()) {
682 return getParentLanes().front()->getLaneShapeLength();
683 } else {
684 return fixedPos;
685 }
686 } else {
687 return getParentLanes().front()->getLaneShapeLength();
688 }
689}
690
691
692void
695 // change only start position
696 myStartPosition = moveResult.newFirstPos;
697 // adjust startPos
698 if (myStartPosition > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
700 }
702 // change only end position
703 myEndPosition = moveResult.newFirstPos;
704 // adjust endPos
705 if (myEndPosition < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
707 }
708 } else {
709 // change both position
710 myStartPosition = moveResult.newFirstPos;
711 myEndPosition = moveResult.newLastPos;
712 // set lateral offset
714 }
715 // update geometry
717}
718
719
720void
722 // begin change attribute
723 undoList->begin(this, "position of " + getTagStr());
724 // set attributes depending of operation type
726 // set only start position
727 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
729 // set only end position
730 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
731 } else {
732 // set both
733 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
734 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newLastPos), undoList);
735 // check if lane has to be changed
736 if (moveResult.newFirstLane) {
737 // set new lane
738 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
739 }
740 }
741 // end change attribute
742 undoList->end();
743}
744
745
746void
747GNEStoppingPlace::adjustLenght(const double newLength, GNEUndoList* undoList) {
748 const auto laneLenght = getParentLanes().front()->getLaneShapeLength();
749 auto newStartPos = myStartPosition;
750 auto newEndPos = myEndPosition;
751 if ((newStartPos != INVALID_DOUBLE) && (newEndPos != INVALID_DOUBLE)) {
752 // get middle lengths
753 const auto middleLength = (newEndPos - newStartPos) * 0.5;
754 const auto middleNewLength = newLength * 0.5;
755 // set new start and end positions
756 newStartPos -= (middleNewLength - middleLength);
757 newEndPos += (middleNewLength - middleLength);
758 // now adjust both
759 if (newStartPos < 0) {
760 newEndPos += (newStartPos * -1);
761 newStartPos = 0;
762 if ((newStartPos < 0) && (newEndPos > laneLenght)) {
763 newStartPos = 0;
764 newEndPos = laneLenght;
765 }
766 } else if (newEndPos > laneLenght) {
767 newStartPos -= (newEndPos - laneLenght);
768 newStartPos = laneLenght;
769 if ((newStartPos < 0) && (newEndPos > laneLenght)) {
770 newStartPos = 0;
771 newEndPos = laneLenght;
772 }
773 }
774 // set new start and end positions
775 undoList->begin(this, TLF(" %'s lenght", myTagProperty->getTagStr()));
778 undoList->end();
779 } else if (newStartPos != INVALID_DOUBLE) {
780 newStartPos = laneLenght - newLength;
781 if (newStartPos < 0) {
782 newStartPos = 0;
783 }
784 undoList->begin(this, TLF(" %'s lenght", myTagProperty->getTagStr()));
786 undoList->end();
787 } else if (newEndPos != INVALID_DOUBLE) {
788 newEndPos = newLength;
789 if (newEndPos > laneLenght) {
790 newEndPos = laneLenght;
791 }
792 undoList->begin(this, TLF(" %'s lenght", myTagProperty->getTagStr()));
794 undoList->end();
795 }
796}
797
798/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
GUIViewObjectsHandler gViewObjectsHandler
#define TL(string)
Definition MsgHandler.h:301
#define TLF(string,...)
Definition MsgHandler.h:303
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_LANE
begin/end of the description of a single lane
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_LANE
@ GNE_ATTR_FORCESIZE
size (used in stopping places)
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_SIZE
size (used in stopping places)
@ SUMO_ATTR_LEFTHAND
@ GNE_ATTR_REFERENCE
reference position (used creating stoppingPlaces)
@ SUMO_ATTR_NAME
@ SUMO_ATTR_CENTER
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition GLHelper.cpp:534
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition GLHelper.cpp:748
static void fixLaneDoublePosition(double &from, double &to, const double laneLengt)
fix the given positions over lane
static bool checkLaneDoublePosition(double from, const double to, const double laneLength, const bool friendlyPos)
check if the given positions over a lane is valid
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
std::string myAdditionalName
name of additional
bool drawMovingGeometryPoints(const bool ignoreShift) const
check if draw additional extrem geometry points
const std::string getID() const
get ID (all Attribute Carriers have one)
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
std::string getCommonAttribute(const Parameterised *parameterised, SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
bool hasAttribute(SumoXMLAttr key) const
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
bool isCommonValid(SumoXMLAttr key, const std::string &value) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourLastGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale) const
calculate contour for last geometry point
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
void calculateContourFirstGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale) const
calculate contour for first geometry point
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double layer, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (circle elements)
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
bool getAllowChangeLane() const
allow change lane
CommonMoveOptions * getCommonMoveOptions() const
get common mode options
move operation
move result
const GNELane * newFirstLane
new first Lane
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
double firstLaneOffset
lane offset
double newLastPos
new last position
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:146
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2194
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
bool isStoppingPlaceValid(SumoXMLAttr key, const std::string &value) const
void setStoppingPlaceAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GNEMoveOperation * getMoveOperation()
get move operation
void writeStoppingPlaceAttributes(OutputDevice &device) const
write common stoppingPlace attributes
Position getPositionInView() const
Returns position of additional in view.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
bool checkDrawMoveContour() const
check if draw move contour (red)
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void drawSign(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const RGBColor &baseColor, const RGBColor &signColor, const std::string &word) const
draw sign
~GNEStoppingPlace()
Destructor.
std::string getStoppingPlaceAttribute(const Parameterised *parameterised, SumoXMLAttr key) const
GNEStoppingPlace(GNENet *net, SumoXMLTag tag)
Default constructor.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
double getStoppingPlaceAttributeDouble(SumoXMLAttr key) const
bool myForceSize
force size (only used in templates
RGBColor myColor
RGB color.
const Parameterised::Map & getACParametersMap() const
get parameters map
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void calculateStoppingPlaceContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width, const double exaggeration, const bool movingGeometryPoints) const
check object in view
virtual void updateGeometry()=0
update pre-computed geometry information
bool myFriendlyPosition
Flag for friendly position.
void drawLines(const GUIVisualizationSettings::Detail d, const std::vector< std::string > &lines, const RGBColor &color) const
draw lines
void adjustLenght(const double length, GNEUndoList *undoList)
adjust lenght
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Position mySymbolPosition
The position of the sign.
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
ReferencePosition myReferencePosition
reference position
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
bool isAttributeEnabled(SumoXMLAttr key) const
double myEndPosition
The position this stopping place is located at (-1 means empty)
GNEContour mySymbolContour
circle contour
std::string getParentName() const
Returns the name of the parent object (if any)
virtual std::string getAttribute(SumoXMLAttr key) const =0
double mySize
size (only use in templates)
double myStartPosition
The relative start position this stopping place is located at (-1 means empty)
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
double getDefaultDoubleValue(SumoXMLAttr attr) const
get default double value
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
GNEViewParent * getViewParent() const
get the net object
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
GNEMoveFrame * getMoveFrame() const
get frame for move elements
static void rotateOverLane(const double rot)
rotate over lane (used by Lock icons, detector logos, etc.)
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
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.
const std::vector< int > & getSelectedGeometryPoints(const GUIGlObject *GLObject) const
get geometry points for the given glObject
Stores the information about how to visualize structures.
GUIVisualizationStoppingPlaceSettings stoppingPlaceSettings
StoppingPlace settings.
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static const std::vector< SumoXMLTag > busStops
busStops namespace
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
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
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
A list of positions.
double length2D() const
Returns the length.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
static const RGBColor INVISIBLE
Definition RGBColor.h:198
static bool isStopPosValid(const double startPos, const double endPos, const double laneLength, const double minLength, const bool friendlyPos)
check if start and end position of a stop is valid
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
static StringBijection< ReferencePosition > ReferencePositions
reference positions (used creating certain elements in netedit)
const std::string & getString(const T key) const
get string
bool hasString(const std::string &str) const
check if the given string exist
T get(const std::string &str) const
get key
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
@ FONS_ALIGN_LEFT
Definition fontstash.h:42
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static const double additionalGeometryPointRadius
moving additional geometry point radius
static const double symbolInternalRadius
symbol internal radius
static const double symbolExternalRadius
symbol external radius
static const double symbolInternalTextSize
symbol internal text size