Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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 LANE_START;
279 }
280 case SUMO_ATTR_ENDPOS:
282 return toString(myEndPosition);
283 } else {
284 return 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 adjustLength(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:
378 } else {
379 return isValidAdditionalID(value);
380 }
381 case SUMO_ATTR_LANE:
382 if (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr) {
383 return true;
384 } else {
385 return false;
386 }
388 if (value.empty() || (value == LANE_START)) {
389 return true;
390 } else if (canParse<double>(value)) {
391 return SUMORouteHandler::isStopPosValid(parse<double>(value), getAttributeDouble(SUMO_ATTR_ENDPOS), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, myFriendlyPosition);
392 } else {
393 return false;
394 }
395 case SUMO_ATTR_ENDPOS:
396 if (value.empty() || (value == LANE_END)) {
397 return true;
398 } else if (canParse<double>(value)) {
399 return SUMORouteHandler::isStopPosValid(getAttributeDouble(SUMO_ATTR_STARTPOS), parse<double>(value), getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(), POSITION_EPS, myFriendlyPosition);
400 } else {
401 return false;
402 }
403 case SUMO_ATTR_NAME:
406 return canParse<bool>(value);
407 case SUMO_ATTR_COLOR:
408 if (value.empty()) {
409 return true;
410 } else {
411 return canParse<RGBColor>(value);
412 }
413 // special attributes used during creation or edition
415 return true;
416 case GNE_ATTR_SIZE:
417 if (value.empty()) {
418 return true;
419 } else {
420 return canParse<double>(value) && parse<double>(value) >= POSITION_EPS;
421 }
423 return canParse<bool>(value);
426 default:
427 return isCommonValid(key, value);
428 }
429}
430
431
432void
433GNEStoppingPlace::setStoppingPlaceAttribute(Parameterised* parameterised, SumoXMLAttr key, const std::string& value) {
434 switch (key) {
435 case SUMO_ATTR_ID:
436 // update microsimID
437 setAdditionalID(value);
438 break;
439 case SUMO_ATTR_LANE:
441 break;
443 if (value.empty() || (value == LANE_START)) {
445 } else {
446 myStartPosition = parse<double>(value);
447 }
448 break;
449 case SUMO_ATTR_ENDPOS:
450 if (value.empty() || (value == LANE_END)) {
452 } else {
453 myEndPosition = parse<double>(value);
454 }
455 break;
456 case SUMO_ATTR_NAME:
457 myAdditionalName = value;
458 break;
460 myFriendlyPosition = parse<bool>(value);
461 break;
462 case SUMO_ATTR_COLOR:
463 if (value.empty()) {
465 } else {
466 myColor = GNEAttributeCarrier::parse<RGBColor>(value);
467 }
468 break;
469 // special attributes used during creation or edition
472 break;
473 case GNE_ATTR_SIZE:
474 if (value.empty()) {
475 mySize = 10;
476 } else {
477 mySize = parse<double>(value);
478 }
479 break;
481 myForceSize = parse<bool>(value);
482 break;
485 break;
486 default:
487 setCommonAttribute(parameterised, key, value);
488 break;
489 }
490}
491
492
493void
495 if (getParentLanes().empty() || getParentLanes().front() == nullptr) {
496 // may happen during initialization
497 return;
498 }
499 // Get value of option "lefthand"
500 const bool lefthandAttr = hasAttribute(SUMO_ATTR_LEFTHAND) && parse<bool>(getAttribute(SUMO_ATTR_LEFTHAND));
501 const double offsetSign = OptionsCont::getOptions().getBool("lefthand") != lefthandAttr ? -1 : 1;
502
503 // obtain laneShape
504 PositionVector laneShape = getParentLanes().front()->getLaneShape();
505
506 // Move shape to side
507 laneShape.move2side(movingToSide * offsetSign);
508
509 // Cut shape using as delimitators fixed start position and fixed end position
511}
512
513
518
519
520bool
522 switch (key) {
524 if (isTemplate()) {
525 return true;
526 } else {
528 }
529 case GNE_ATTR_SIZE:
530 if (isTemplate()) {
531 return true;
532 } else {
534 }
535 default:
536 return true;
537 }
538}
539
540
541std::string
543 return getTagStr() + ": " + getID();
544}
545
546
547std::string
551
552
553void
554GNEStoppingPlace::drawLines(const GUIVisualizationSettings::Detail d, const std::vector<std::string>& lines, const RGBColor& color) const {
555 // only draw in level 1
557 // calculate middle point
558 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
559 // calculate rotation
560 const double rot = (myAdditionalGeometry.getShape().size() <= 1) ? 0 : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint);
561 // Iterate over every line
562 for (int i = 0; i < (int)lines.size(); ++i) {
563 // push a new matrix for every line
565 // translate
566 glTranslated(mySymbolPosition.x(), mySymbolPosition.y(), 0);
567 // rotate over lane
569 // draw line with a color depending of the selection status
570 if (drawUsingSelectColor()) {
571 GLHelper::drawText(lines[i].c_str(), Position(1.2, (double)i), .1, 1.f, color, 0, FONS_ALIGN_LEFT);
572 } else {
573 GLHelper::drawText(lines[i].c_str(), Position(1.2, (double)i), .1, 1.f, color, 0, FONS_ALIGN_LEFT);
574 }
575 // pop matrix for every line
577 }
578 }
579}
580
581
582void
584 const RGBColor& baseColor, const RGBColor& signColor, const std::string& word) const {
585 // only draw in level 2
587 // calculate middle point
588 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
589 // calculate rotation
590 const double rotSign = OptionsCont::getOptions().getBool("lefthand") ? -1 : 1;
591 const double rot = (myAdditionalGeometry.getShape().size() <= 1) ? 0 : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint) - 180. * rotSign;
592 // push matrix
594 // Start drawing sign traslating matrix to signal position
595 glTranslated(mySymbolPosition.x(), mySymbolPosition.y(), 0);
596 // rotate over lane
598 // scale matrix depending of the exaggeration
599 glScaled(exaggeration, exaggeration, 1);
600 // set color
601 GLHelper::setColor(baseColor);
602 // Draw circle
604 // continue depending of rectangle selection
606 // Traslate to front
607 glTranslated(0, 0, .1);
608 // set color
609 GLHelper::setColor(signColor);
610 // draw another circle in the same position, but a little bit more small
612 // draw H depending of detailSettings
614 }
615 // pop draw matrix
617 }
618}
619
620
621void
623 const double width, const double exaggeration, const bool movingGeometryPoints) const {
624 // check if we're calculating the contour or the moving geometry points
625 if (movingGeometryPoints) {
629 }
630 if (movingGeometryPoints && (myEndPosition != INVALID_DOUBLE)) {
633 }
634 } else {
635 // don't exaggerate contour
637 nullptr, getParentLanes().front()->getParentEdge());
639 exaggeration, getParentLanes().front()->getParentEdge());
640 }
641}
642
643
644double
647 // get lane final and shape length
648 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
649 // get startPosition
650 double fixedPos = myStartPosition;
651 // adjust fixedPos
652 if (fixedPos < 0) {
653 fixedPos += laneLength;
654 }
655 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
656 // return depending of fixedPos
657 if (fixedPos < 0) {
658 return 0;
659 } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
660 return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
661 } else {
662 return fixedPos;
663 }
664 } else {
665 return 0;
666 }
667}
668
669
670double
673 // get lane final and shape length
674 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
675 // get endPosition
676 double fixedPos = myEndPosition;
677 // adjust fixedPos
678 if (fixedPos < 0) {
679 fixedPos += laneLength;
680 }
681 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
682 // return depending of fixedPos
683 if (fixedPos < POSITION_EPS) {
684 return POSITION_EPS;
685 } else if (fixedPos > getParentLanes().front()->getLaneShapeLength()) {
686 return getParentLanes().front()->getLaneShapeLength();
687 } else {
688 return fixedPos;
689 }
690 } else {
691 return getParentLanes().front()->getLaneShapeLength();
692 }
693}
694
695
696void
699 // change only start position
700 myStartPosition = moveResult.newFirstPos;
701 // adjust startPos
702 if (myStartPosition > (getAttributeDouble(SUMO_ATTR_ENDPOS) - POSITION_EPS)) {
704 }
706 // change only end position
707 myEndPosition = moveResult.newFirstPos;
708 // adjust endPos
709 if (myEndPosition < (getAttributeDouble(SUMO_ATTR_STARTPOS) + POSITION_EPS)) {
711 }
712 } else {
713 // change both position
714 myStartPosition = moveResult.newFirstPos;
715 myEndPosition = moveResult.newLastPos;
716 // set lateral offset
718 }
719 // update geometry
721}
722
723
724void
726 // begin change attribute
727 undoList->begin(this, "position of " + getTagStr());
728 // set attributes depending of operation type
730 // set only start position
731 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
733 // set only end position
734 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
735 } else {
736 // set both
737 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
738 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newLastPos), undoList);
739 // check if lane has to be changed
740 if (moveResult.newFirstLane) {
741 // set new lane
742 setAttribute(SUMO_ATTR_LANE, moveResult.newFirstLane->getID(), undoList);
743 }
744 }
745 // end change attribute
746 undoList->end();
747}
748
749
750void
751GNEStoppingPlace::adjustLength(const double newLength, GNEUndoList* undoList) {
752 const auto laneLength = getParentLanes().front()->getLaneShapeLength();
753 auto newStartPos = myStartPosition;
754 auto newEndPos = myEndPosition;
755 if ((newStartPos != INVALID_DOUBLE) && (newEndPos != INVALID_DOUBLE)) {
756 // get middle lengths
757 const auto middleLength = (newEndPos - newStartPos) * 0.5;
758 const auto middleNewLength = newLength * 0.5;
759 // set new start and end positions
760 newStartPos -= (middleNewLength - middleLength);
761 newEndPos += (middleNewLength - middleLength);
762 // now adjust both
763 if (newStartPos < 0) {
764 newEndPos += (newStartPos * -1);
765 newStartPos = 0;
766 if ((newStartPos < 0) && (newEndPos > laneLength)) {
767 newStartPos = 0;
768 newEndPos = laneLength;
769 }
770 } else if (newEndPos > laneLength) {
771 newStartPos -= (newEndPos - laneLength);
772 newStartPos = laneLength;
773 if ((newStartPos < 0) && (newEndPos > laneLength)) {
774 newStartPos = 0;
775 newEndPos = laneLength;
776 }
777 }
778 // set new start and end positions
779 undoList->begin(this, TLF(" %'s length", myTagProperty->getTagStr()));
782 undoList->end();
783 } else if (newStartPos != INVALID_DOUBLE) {
784 newStartPos = laneLength - newLength;
785 if (newStartPos < 0) {
786 newStartPos = 0;
787 }
788 undoList->begin(this, TLF(" %'s length", myTagProperty->getTagStr()));
790 undoList->end();
791 } else if (newEndPos != INVALID_DOUBLE) {
792 newEndPos = newLength;
793 if (newEndPos > laneLength) {
794 newEndPos = laneLength;
795 }
796 undoList->begin(this, TLF(" %'s length", myTagProperty->getTagStr()));
798 undoList->end();
799 }
800}
801
802/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
GUIViewObjectsHandler gViewObjectsHandler
#define TL(string)
Definition MsgHandler.h:305
#define TLF(string,...)
Definition MsgHandler.h:307
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:68
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:742
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)
static const std::string LANE_START
lane start
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
static const std::string LANE_END
lane end
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:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
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
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)
void adjustLength(const double length, GNEUndoList *undoList)
adjust length
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