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, segment->getLane()->getParentEdge());
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, segment->getJunction());
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);
398 return getParametersStr();
400 return "";
401 default:
402 return getCommonAttribute(key);
403 }
404}
405
406
407double
409 switch (key) {
411 if (myStartPos < 0) {
412 return 0;
413 } else if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
414 return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
415 } else {
416 return myStartPos;
417 }
418 case SUMO_ATTR_ENDPOS:
419 if (myEndPos < 0) {
420 return 0;
421 } else if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
422 return getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
423 } else {
424 return myEndPos;
425 }
426 default:
427 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
428 }
429}
430
431
436
437
438void
439GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
440 switch (key) {
441 case SUMO_ATTR_ID:
443 case SUMO_ATTR_LANES:
445 case SUMO_ATTR_ENDPOS:
449 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
450 break;
451 default:
452 setCommonAttribute(key, value, undoList);
453 break;
454 }
455}
456
457
458bool
459GNEOverheadWire::isValid(SumoXMLAttr key, const std::string& value) {
460 switch (key) {
461 case SUMO_ATTR_ID:
462 return isValidAdditionalID(value);
464 if (value.empty()) {
465 return false;
466 } else {
467 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, value, false) != nullptr);
468 }
469 case SUMO_ATTR_LANES:
470 if (value.empty()) {
471 return false;
472 } else if (canParse<std::vector<GNELane*> >(myNet, value, false)) {
473 // check if lanes are consecutives
474 return lanesConsecutives(parse<std::vector<GNELane*> >(myNet, value));
475 } else {
476 return false;
477 }
479 return canParse<double>(value);
480 case SUMO_ATTR_ENDPOS:
481 return canParse<double>(value);
483 return canParse<bool>(value);
485 return true;
487 return areParametersValid(value);
488 default:
489 return isCommonValid(key, value);
490 }
491}
492
493
494std::string
496 return getTagStr() + ": " + getID();
497}
498
499
500std::string
502 return getTagStr();
503}
504
505// ===========================================================================
506// private
507// ===========================================================================
508
509void
510GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value) {
511 switch (key) {
512 case SUMO_ATTR_ID:
513 // update microsimID
514 setAdditionalID(value);
515 break;
518 break;
519 case SUMO_ATTR_LANES:
521 break;
523 myStartPos = parse<double>(value);
524 // update geometry (except for template)
525 if (getParentLanes().size() > 0) {
527 }
528 break;
529 case SUMO_ATTR_ENDPOS:
530 myEndPos = parse<double>(value);
531 // update geometry (except for template)
532 if (getParentLanes().size() > 0) {
534 }
535 break;
537 myFriendlyPosition = parse<bool>(value);
538 break;
540 myForbiddenInnerLanes = parse<std::vector<std::string> >(value);
541 break;
543 setParametersStr(value);
544 break;
547 break;
548 default:
549 setCommonAttribute(key, value);
550 break;
551 }
552}
553
554void
558 // change only start position
559 myStartPos = moveResult.newFirstPos;
562 // change only end position
563 myEndPos = moveResult.newFirstPos;
564 } else {
565 // change both position
566 myStartPos = moveResult.newFirstPos;
567 myEndPos = moveResult.newLastPos;
568 }
569 // update geometry
571}
572
573
574void
576 // begin change attribute
577 undoList->begin(this, "position of " + getTagStr());
578 // set attributes depending of operation type
581 // set only start position
582 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
585 // set only end position
586 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
587 } else {
588 // set both positions
589 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
590 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newLastPos), undoList);
591 }
592 // end change attribute
593 undoList->end();
594}
595
596
597double
599 // get lane final and shape length
600 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
601 // get startPosition
602 double fixedPos = myStartPos;
603 // adjust fixedPos
604 if (fixedPos < 0) {
605 fixedPos += laneLength;
606 }
607 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
608 // return depending of fixedPos
609 if (fixedPos < 0) {
610 return 0;
611 } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
612 return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
613 } else {
614 return fixedPos;
615 }
616}
617
618
619double
621 // get lane final and shape length
622 const double laneLength = getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
623 // get endPosition
624 double fixedPos = myEndPos;
625 // adjust fixedPos
626 if (fixedPos < 0) {
627 fixedPos += laneLength;
628 }
629 fixedPos *= getParentLanes().back()->getLengthGeometryFactor();
630 // return depending of fixedPos
631 if (fixedPos < POSITION_EPS) {
632 return POSITION_EPS;
633 } else if (fixedPos > getParentLanes().back()->getLaneShapeLength()) {
634 return getParentLanes().back()->getLaneShapeLength();
635 } else {
636 return fixedPos;
637 }
638}
639
640/****************************************************************************/
@ 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_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:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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....
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 drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
bool isCommonValid(SumoXMLAttr key, const std::string &value)
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
std::string getCommonAttribute(SumoXMLAttr key) const
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 GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
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
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:196
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:2163
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 GNEJunction * getJunction() const
get junction 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