Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEOverheadWire.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-2024 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//
19/****************************************************************************/
20
21#include <netedit/GNENet.h>
22#include <netedit/GNESegment.h>
23#include <netedit/GNEUndoList.h>
24#include <netedit/GNEViewNet.h>
31
32#include "GNEOverheadWire.h"
34
35
36// ===========================================================================
37// member method definitions
38// ===========================================================================
39
42 GUIIconSubSys::getIcon(GUIIcon::OVERHEADWIRE), "", {}, {}, {}, {}, {}, {}),
43 myStartPos(0),
44 myEndPos(0),
45myFriendlyPosition(false) {
46 // reset default values
47 resetDefaultValues();
48}
49
50
51GNEOverheadWire::GNEOverheadWire(const std::string& id, std::vector<GNELane*> lanes, GNEAdditional* substation, GNENet* net,
52 const double startPos, const double endPos, const bool friendlyPos, const std::vector<std::string>& forbiddenInnerLanes,
53 const Parameterised::Map& parameters) :
55 GUIIconSubSys::getIcon(GUIIcon::OVERHEADWIRE), "", {}, {}, lanes, {substation}, {}, {}),
56Parameterised(parameters),
57myStartPos(startPos),
58myEndPos(endPos),
59myFriendlyPosition(friendlyPos),
60myForbiddenInnerLanes(forbiddenInnerLanes) {
61 // update centering boundary without updating grid
62 updateCenteringBoundary(false);
63}
64
65
68
69
72 // check modes and detector type
76 } else {
77 return nullptr;
78 }
79}
80
81
82void
100
101
102bool
104 // first check if there is connection between all consecutive lanes
106 // with friendly position enabled position are "always fixed"
107 if (myFriendlyPosition) {
108 return true;
109 } else {
110 return (myStartPos >= 0) &&
111 (myEndPos >= 0) &&
112 ((myStartPos) <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) &&
113 ((myEndPos) <= getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
114 }
115 } else {
116 return false;
117 }
118}
119
120
121std::string
123 // declare variable for error position
124 std::string errorFirstLanePosition, separator, errorLastLanePosition;
125 // abort if lanes aren't consecutives
127 return TL("lanes aren't consecutives");
128 }
129 // abort if lanes aren't connected
131 return TL("lanes aren't connected");
132 }
133 // check positions over first lane
134 if (myStartPos < 0) {
135 errorFirstLanePosition = (toString(SUMO_ATTR_STARTPOS) + " < 0");
136 }
137 if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
138 errorFirstLanePosition = (toString(SUMO_ATTR_STARTPOS) + TL(" > lanes's length"));
139 }
140 // check positions over last lane
141 if (myEndPos < 0) {
142 errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + " < 0");
143 }
144 if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
145 errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + TL(" > lanes's length"));
146 }
147 // check separator
148 if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
149 separator = TL(" and ");
150 }
151 // return error message
152 return errorFirstLanePosition + separator + errorLastLanePosition;
153}
154
155
156void
159 // build connections between all consecutive lanes
160 bool foundConnection = true;
161 int i = 0;
162 // iterate over all lanes, and stop if myE2valid is false
163 while (i < ((int)getParentLanes().size() - 1)) {
164 // change foundConnection to false
165 foundConnection = false;
166 // if a connection between "from" lane and "to" lane of connection is found, change myE2valid to true again
167 for (const auto& connection : getParentLanes().at(i)->getParentEdge()->getGNEConnections()) {
168 if ((connection->getLaneFrom() == getParentLanes().at(i)) && (connection->getLaneTo() == getParentLanes().at(i + 1))) {
169 foundConnection = true;
170 }
171 }
172 // if connection wasn't found
173 if (!foundConnection) {
174 // create new connection manually
175 NBEdge::Connection newCon(getParentLanes().at(i)->getIndex(), getParentLanes().at(i + 1)->getParentEdge()->getNBEdge(), getParentLanes().at(i + 1)->getIndex());
176 // allow to undo creation of new lane
177 myNet->getViewNet()->getUndoList()->add(new GNEChange_Connection(getParentLanes().at(i)->getParentEdge(), newCon, false, true), true);
178 }
179 // update lane iterator
180 i++;
181 }
182 } else {
183 // declare new positions
184 double newPositionOverLane = myStartPos;
185 double newEndPositionOverLane = myEndPos;
186 // fix pos and length checkAndFixDetectorPosition
188 newPositionOverLane, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(),
189 newEndPositionOverLane, getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
190 // set new position and endPosition
192 setAttribute(SUMO_ATTR_ENDPOS, toString(newEndPositionOverLane), myNet->getViewNet()->getUndoList());
193 }
194}
195
196
197bool
199 return false;
200}
201
202
203void
205 // compute path
207}
208
209
214
215
216void
217GNEOverheadWire::updateCenteringBoundary(const bool /* updateGrid */) {
218 // nothing to update
219}
220
221
222void
223GNEOverheadWire::splitEdgeGeometry(const double /* splitPosition */, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
224 // obtain new list of lanes
225 std::string newLanes = getNewListOfParents(originalElement, newElement);
226 // update Lanes
227 if (newLanes.size() > 0) {
228 setAttribute(SUMO_ATTR_LANES, newLanes, undoList);
229 }
230}
231
232
233void
235 // nothing to draw
236}
237
238
239void
244
245
246void
247GNEOverheadWire::drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
248 // calculate overheadWire width
249 const double overheadWireWidth = s.addSize.getExaggeration(s, segment->getLane());
250 // check if E2 can be drawn
251 if (segment->getLane() && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
252 // get detail level
253 const auto d = s.getDetailLevel(overheadWireWidth);
254 // calculate startPos
255 const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_STARTPOS);
256 // get endPos
257 const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
258 // declare path geometry
259 GUIGeometry overheadWireGeometry;
260 // update pathGeometry depending of first and last segment
261 if (segment->isFirstSegment() && segment->isLastSegment()) {
262 overheadWireGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
263 geometryDepartPos,
265 geometryEndPos,
267 } else if (segment->isFirstSegment()) {
268 overheadWireGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
269 geometryDepartPos,
271 -1,
273 } else if (segment->isLastSegment()) {
274 overheadWireGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
275 -1,
277 geometryEndPos,
279 } else {
280 overheadWireGeometry = segment->getLane()->getLaneGeometry();
281 }
282 // get both geometries
283 auto overheadWireGeometryTop = overheadWireGeometry;
284 auto overheadWireGeometryBot = overheadWireGeometry;
285 // move to sides
286 overheadWireGeometryTop.moveGeometryToSide(overheadWireWidth * 0.5);
287 overheadWireGeometryBot.moveGeometryToSide(overheadWireWidth * -0.5);
288 // draw geometry only if we'rent in drawForObjectUnderCursor mode
290 // obtain color
293 // push layer matrix
295 // Start with the drawing of the area traslating matrix to origin
296 glTranslated(0, 0, getType() + offsetFront);
297 // Set top color
298 GLHelper::setColor(overheadWireColorTop);
299 // draw top geometry
300 GUIGeometry::drawGeometry(d, overheadWireGeometryTop, 0.2);
301 // Set bot color
302 GLHelper::setColor(overheadWireColorBot);
303 // draw bot geometry
304 GUIGeometry::drawGeometry(d, overheadWireGeometryBot, 0.2);
305 // draw geometry points
306 if (segment->isFirstSegment() && segment->isLastSegment()) {
307 drawLeftGeometryPoint(s, d, overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
308 drawRightGeometryPoint(s, d, overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
309 } else if (segment->isFirstSegment()) {
310 drawLeftGeometryPoint(s, d, overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
311 } else if (segment->isLastSegment()) {
312 drawRightGeometryPoint(s, d, overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
313 }
314 // Pop layer matrix
316 // draw dotted contour
318 }
319 // declare trim geometry to draw
320 const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? overheadWireGeometry.getShape() : segment->getLane()->getLaneShape();
321 // calculate contour and draw dotted geometry
322 myAdditionalContour.calculateContourExtrudedShape(s, d, this, shape, getType(), overheadWireWidth, 1, true, true, 0, segment);
323 }
324}
325
326
327void
328GNEOverheadWire::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
329 // calculate overheadWire width
330 const double overheadWireWidth = s.addSize.getExaggeration(s, segment->getPreviousLane());
331 // check if overhead wire can be drawn
332 if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && segment->getPreviousLane() && segment->getNextLane()) {
333 // obtain color
336 // declare geometry
337 GUIGeometry overheadWireGeometry({segment->getPreviousLane()->getLaneShape().back(), segment->getNextLane()->getLaneShape().front()});
338 // get detail level
339 const auto d = s.getDetailLevel(1);
340 // check if exist connection
341 if (segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane())) {
342 overheadWireGeometry = segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane());
343 }
344 // get both geometries
345 auto overheadWireGeometryTop = overheadWireGeometry;
346 auto overheadWireGeometryBot = overheadWireGeometry;
347 // move to sides
348 overheadWireGeometryTop.moveGeometryToSide(overheadWireWidth * 0.5);
349 overheadWireGeometryBot.moveGeometryToSide(overheadWireWidth * -0.5);
350 // draw geometry only if we'rent in drawForObjectUnderCursor mode
352 // Add a draw matrix
354 // Start with the drawing of the area traslating matrix to origin
355 glTranslated(0, 0, getType() + offsetFront);
356 // Set top color
357 GLHelper::setColor(overheadWireColorTop);
358 // draw top geometry
359 GUIGeometry::drawGeometry(d, overheadWireGeometryTop, 0.2);
360 // Set bot color
361 GLHelper::setColor(overheadWireColorBot);
362 // draw bot geometry
363 GUIGeometry::drawGeometry(d, overheadWireGeometryBot, 0.2);
364 // Pop last matrix
366 // draw dotted contour
368 }
369 // draw contours
370 if (segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane())) {
371 // get shape
372 const auto& shape = segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()).getShape();
373 // calculate contour and draw dotted geometry
374 myAdditionalContour.calculateContourExtrudedShape(s, d, this, shape, getType(), overheadWireWidth, 1, true, true, 0, segment);
375 }
376 }
377}
378
379
380std::string
382 switch (key) {
383 case SUMO_ATTR_ID:
384 return getMicrosimID();
386 return getParentAdditionals().front()->getID();
387 case SUMO_ATTR_LANES:
388 return parseIDs(getParentLanes());
390 return toString(myStartPos);
391 case SUMO_ATTR_ENDPOS:
392 return toString(myEndPos);
400 return getParametersStr();
402 return "";
403 default:
404 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
405 }
406}
407
408
409double
411 switch (key) {
413 if (myStartPos < 0) {
414 return 0;
415 } else if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
416 return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
417 } else {
418 return myStartPos;
419 }
420 case SUMO_ATTR_ENDPOS:
421 if (myEndPos < 0) {
422 return 0;
423 } else if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
424 return getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
425 } else {
426 return myEndPos;
427 }
428 default:
429 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
430 }
431}
432
433
438
439
440void
441GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
442 switch (key) {
443 case SUMO_ATTR_ID:
445 case SUMO_ATTR_LANES:
447 case SUMO_ATTR_ENDPOS:
452 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
453 break;
454 default:
455 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
456 }
457}
458
459
460bool
461GNEOverheadWire::isValid(SumoXMLAttr key, const std::string& value) {
462 switch (key) {
463 case SUMO_ATTR_ID:
464 return isValidAdditionalID(value);
466 if (value.empty()) {
467 return false;
468 } else {
469 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, value, false) != nullptr);
470 }
471 case SUMO_ATTR_LANES:
472 if (value.empty()) {
473 return false;
474 } else if (canParse<std::vector<GNELane*> >(myNet, value, false)) {
475 // check if lanes are consecutives
476 return lanesConsecutives(parse<std::vector<GNELane*> >(myNet, value));
477 } else {
478 return false;
479 }
481 return canParse<double>(value);
482 case SUMO_ATTR_ENDPOS:
483 return canParse<double>(value);
485 return canParse<bool>(value);
487 return true;
489 return canParse<bool>(value);
491 return areParametersValid(value);
492 default:
493 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
494 }
495}
496
497
498std::string
500 return getTagStr() + ": " + getID();
501}
502
503
504std::string
506 return getTagStr();
507}
508
509// ===========================================================================
510// private
511// ===========================================================================
512
513void
514GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value) {
515 switch (key) {
516 case SUMO_ATTR_ID:
517 // update microsimID
518 setAdditionalID(value);
519 break;
522 break;
523 case SUMO_ATTR_LANES:
525 break;
527 myStartPos = parse<double>(value);
528 // update geometry (except for template)
529 if (getParentLanes().size() > 0) {
531 }
532 break;
533 case SUMO_ATTR_ENDPOS:
534 myEndPos = parse<double>(value);
535 // update geometry (except for template)
536 if (getParentLanes().size() > 0) {
538 }
539 break;
541 myFriendlyPosition = parse<bool>(value);
542 break;
544 myForbiddenInnerLanes = parse<std::vector<std::string> >(value);
545 break;
547 if (parse<bool>(value)) {
549 } else {
551 }
552 break;
554 setParametersStr(value);
555 break;
558 break;
559 default:
560 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
561 }
562}
563
564void
568 // change only start position
569 myStartPos = moveResult.newFirstPos;
572 // change only end position
573 myEndPos = moveResult.newFirstPos;
574 } else {
575 // change both position
576 myStartPos = moveResult.newFirstPos;
577 myEndPos = moveResult.newLastPos;
578 }
579 // update geometry
581}
582
583
584void
586 // begin change attribute
587 undoList->begin(this, "position of " + getTagStr());
588 // set attributes depending of operation type
591 // set only start position
592 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
595 // set only end position
596 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
597 } else {
598 // set both positions
599 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
600 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newLastPos), undoList);
601 }
602 // end change attribute
603 undoList->end();
604}
605
606
607double
609 // get lane final and shape length
610 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
611 // get startPosition
612 double fixedPos = myStartPos;
613 // adjust fixedPos
614 if (fixedPos < 0) {
615 fixedPos += laneLength;
616 }
617 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
618 // return depending of fixedPos
619 if (fixedPos < 0) {
620 return 0;
621 } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
622 return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
623 } else {
624 return fixedPos;
625 }
626}
627
628
629double
631 // get lane final and shape length
632 const double laneLength = getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
633 // get endPosition
634 double fixedPos = myEndPos;
635 // adjust fixedPos
636 if (fixedPos < 0) {
637 fixedPos += laneLength;
638 }
639 fixedPos *= getParentLanes().back()->getLengthGeometryFactor();
640 // return depending of fixedPos
641 if (fixedPos < POSITION_EPS) {
642 return POSITION_EPS;
643 } else if (fixedPos > getParentLanes().back()->getLaneShapeLength()) {
644 return getParentLanes().back()->getLaneShapeLength();
645 } else {
646 return fixedPos;
647 }
648}
649
650/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ GLO_OVERHEAD_WIRE_SEGMENT
a segment of an overhead line
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ OVERHEADWIRE
#define TL(string)
Definition MsgHandler.h:315
@ SUMO_TAG_TRACTION_SUBSTATION
A traction substation.
@ SUMO_TAG_OVERHEAD_WIRE_SECTION
An overhead wire section.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_STARTPOS
@ SUMO_ATTR_SUBSTATIONID
id of a traction substation substation
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_OVERHEAD_WIRE_FORBIDDEN
forbidden lanes for overhead wire segment
@ SUMO_ATTR_LANES
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_ID
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
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:654
static void popMatrix()
pop matrix
Definition GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition GLHelper.cpp:117
static void fixMultiLanePosition(double fromPos, const double fromLaneLength, double toPos, const double tolaneLength)
fix the given positions over two lanes
An Element which don't belong to GNENet but has influence in the simulation.
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
static bool areLaneConnected(const std::vector< GNELane * > &lanes)
check if the given lanes are connected
void drawRightGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw right geometry point
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
GNEMoveOperation * getMoveOperationMultiLane(const double startPos, const double endPos)
get moveOperation for an element over multi lane
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
static bool lanesConsecutives(const std::vector< GNELane * > &lanes)
check if lanes are consecutives
GNENet * myNet
pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
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
calculate contour extruded (used in elements formed by a central shape)
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given toLane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
const PositionVector & getLaneShape() const
get elements shape
Definition GNELane.cpp:214
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition GNELane.cpp:662
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition GNELane.cpp:208
move operation
move result
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
double newLastPos
new last position
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
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:127
GNEPathManager * getNetworkPathManager()
get network path manager
Definition GNENet.cpp:139
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2155
void updateGeometry()
update pre-computed geometry information
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
void fixAdditionalProblem()
fix additional problem
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
~GNEOverheadWire()
Destructor.
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
double myEndPos
end position over lane
bool checkDrawMoveContour() const
check if draw move contour (red)
const Parameterised::Map & getACParametersMap() const
get parameters map
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void computePathElement()
compute pathElement
GNEMoveOperation * getMoveOperation()
get move operation
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Position getPositionInView() const
Returns position of additional in view.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
double myStartPos
start position over lane
double getAttributeDouble(SumoXMLAttr key) const
GNEOverheadWire(GNENet *net)
default Constructor
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getAdditionalProblem() const
return a string with the current additional problem
std::string getAttribute(SumoXMLAttr key) const
bool myFriendlyPosition
friendly position
std::vector< std::string > myForbiddenInnerLanes
forbidden inner lanes
bool isAdditionalValid() const
check if current additional is valid to be written into XML
void calculateConsecutivePathLanes(GNEPathElement *pathElement, const std::vector< GNELane * > &lanes)
calculate consecutive path lanes
const GNELane * getLane() const
get lane associated with this segment
const GNELane * getNextLane() const
get next lane
const GNELane * getPreviousLane() const
get previous lane
bool isFirstSegment() const
check if segment is the first path's segment
bool isLastSegment() const
check if segment is the last path's segment
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...
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEUndoList * getUndoList() const
get the undoList object
void moveGeometryToSide(const double amount)
move current shape to side
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
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.
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings addSize
bool checkDrawAdditional(Detail d, const bool selected) const
check if draw additionals
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
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
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:322
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
bool showAdditionals() const
check if additionals has to be drawn
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static const RGBColor overheadWireColorBot
overhead wire color bot
static const RGBColor overheadWireColorTop
overhead wire color top
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const double segmentWidth
width of dotted contour segments
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
A structure which describes a connection between edges or lanes.
Definition NBEdge.h:201