Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-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//
19/****************************************************************************/
20#include <config.h>
21
22#include <netedit/GNENet.h>
23#include <netedit/GNESegment.h>
24#include <netedit/GNEUndoList.h>
25#include <netedit/GNEViewNet.h>
32
33#include "GNEOverheadWire.h"
35
36// ===========================================================================
37// member method definitions
38// ===========================================================================
39
43
44
45GNEOverheadWire::GNEOverheadWire(const std::string& id, GNENet* net, const std::string& filename, std::vector<GNELane*> lanes, GNEAdditional* substation,
46 const double startPos, const double endPos, const bool friendlyPos, const std::vector<std::string>& forbiddenInnerLanes,
47 const Parameterised::Map& parameters) :
48 GNEAdditional(id, net, filename, SUMO_TAG_OVERHEAD_WIRE_SECTION, ""),
49 Parameterised(parameters),
50 myStartPos(startPos),
51 myEndPos(endPos),
52 myFriendlyPosition(friendlyPos),
53 myForbiddenInnerLanes(forbiddenInnerLanes) {
54 // set parents
55 setParents<GNELane*>(lanes);
56 setParent<GNEAdditional*>(substation);
57 // update centering boundary without updating grid
59}
60
61
64
65
68 // check modes and detector type
72 } else {
73 return nullptr;
74 }
75}
76
77
78void
96
97
98bool
100 // first check if there is connection between all consecutive lanes
102 // with friendly position enabled position are "always fixed"
103 if (myFriendlyPosition) {
104 return true;
105 } else {
106 return (myStartPos >= 0) &&
107 (myEndPos >= 0) &&
108 ((myStartPos) <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) &&
109 ((myEndPos) <= getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
110 }
111 } else {
112 return false;
113 }
114}
115
116
117std::string
119 // declare variable for error position
120 std::string errorFirstLanePosition, separator, errorLastLanePosition;
121 // abort if lanes aren't consecutives
123 return TL("lanes aren't consecutives");
124 }
125 // abort if lanes aren't connected
127 return TL("lanes aren't connected");
128 }
129 // check positions over first lane
130 if (myStartPos < 0) {
131 errorFirstLanePosition = (toString(SUMO_ATTR_STARTPOS) + " < 0");
132 }
133 if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
134 errorFirstLanePosition = (toString(SUMO_ATTR_STARTPOS) + TL(" > lanes's length"));
135 }
136 // check positions over last lane
137 if (myEndPos < 0) {
138 errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + " < 0");
139 }
140 if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
141 errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + TL(" > lanes's length"));
142 }
143 // check separator
144 if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
145 separator = TL(" and ");
146 }
147 // return error message
148 return errorFirstLanePosition + separator + errorLastLanePosition;
149}
150
151
152void
155 // build connections between all consecutive lanes
156 bool foundConnection = true;
157 int i = 0;
158 // iterate over all lanes, and stop if myE2valid is false
159 while (i < ((int)getParentLanes().size() - 1)) {
160 // change foundConnection to false
161 foundConnection = false;
162 // if a connection between "from" lane and "to" lane of connection is found, change myE2valid to true again
163 for (const auto& connection : getParentLanes().at(i)->getParentEdge()->getGNEConnections()) {
164 if ((connection->getLaneFrom() == getParentLanes().at(i)) && (connection->getLaneTo() == getParentLanes().at(i + 1))) {
165 foundConnection = true;
166 }
167 }
168 // if connection wasn't found
169 if (!foundConnection) {
170 // create new connection manually
171 NBEdge::Connection newCon(getParentLanes().at(i)->getIndex(), getParentLanes().at(i + 1)->getParentEdge()->getNBEdge(), getParentLanes().at(i + 1)->getIndex());
172 // allow to undo creation of new lane
173 myNet->getViewNet()->getUndoList()->add(new GNEChange_Connection(getParentLanes().at(i)->getParentEdge(), newCon, false, true), true);
174 }
175 // update lane iterator
176 i++;
177 }
178 } else {
179 // declare new positions
180 double newPositionOverLane = myStartPos;
181 double newEndPositionOverLane = myEndPos;
182 // fix pos and length checkAndFixDetectorPosition
184 newPositionOverLane, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(),
185 newEndPositionOverLane, getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
186 // set new position and endPosition
188 setAttribute(SUMO_ATTR_ENDPOS, toString(newEndPositionOverLane), myNet->getViewNet()->getUndoList());
189 }
190}
191
192
193bool
195 return false;
196}
197
198
199void
201 // compute path
203}
204
205
210
211
212void
213GNEOverheadWire::updateCenteringBoundary(const bool /* updateGrid */) {
214 // nothing to update
215}
216
217
218void
219GNEOverheadWire::splitEdgeGeometry(const double /* splitPosition */, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList) {
220 // obtain new list of lanes
221 std::string newLanes = getNewListOfParents(originalElement, newElement);
222 // update Lanes
223 if (newLanes.size() > 0) {
224 setAttribute(SUMO_ATTR_LANES, newLanes, undoList);
225 }
226}
227
228
229void
231 // nothing to draw
232}
233
234
235void
240
241
242void
243GNEOverheadWire::drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
244 // calculate overheadWire width
245 const double overheadWireWidth = s.addSize.getExaggeration(s, segment->getLane());
246 // check if E2 can be drawn
247 if (segment->getLane() && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
248 // get detail level
249 const auto d = s.getDetailLevel(overheadWireWidth);
250 // calculate startPos
251 const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_STARTPOS);
252 // get endPos
253 const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
254 // declare path geometry
255 GUIGeometry overheadWireGeometry;
256 // update pathGeometry depending of first and last segment
257 if (segment->isFirstSegment() && segment->isLastSegment()) {
258 overheadWireGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
259 geometryDepartPos,
261 geometryEndPos,
263 } else if (segment->isFirstSegment()) {
264 overheadWireGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
265 geometryDepartPos,
267 -1,
269 } else if (segment->isLastSegment()) {
270 overheadWireGeometry.updateGeometry(segment->getLane()->getLaneGeometry().getShape(),
271 -1,
273 geometryEndPos,
275 } else {
276 overheadWireGeometry = segment->getLane()->getLaneGeometry();
277 }
278 // get both geometries
279 auto overheadWireGeometryTop = overheadWireGeometry;
280 auto overheadWireGeometryBot = overheadWireGeometry;
281 // move to sides
282 overheadWireGeometryTop.moveGeometryToSide(overheadWireWidth * 0.5);
283 overheadWireGeometryBot.moveGeometryToSide(overheadWireWidth * -0.5);
284 // draw geometry only if we'rent in drawForObjectUnderCursor mode
286 // obtain color
289 // push layer matrix
291 // Start with the drawing of the area traslating matrix to origin
292 glTranslated(0, 0, getType() + offsetFront);
293 // Set top color
294 GLHelper::setColor(overheadWireColorTop);
295 // draw top geometry
296 GUIGeometry::drawGeometry(d, overheadWireGeometryTop, 0.2);
297 // Set bot color
298 GLHelper::setColor(overheadWireColorBot);
299 // draw bot geometry
300 GUIGeometry::drawGeometry(d, overheadWireGeometryBot, 0.2);
301 // draw geometry points
302 if (segment->isFirstSegment() && segment->isLastSegment()) {
303 drawLeftGeometryPoint(s, d, overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
304 drawRightGeometryPoint(s, d, overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
305 } else if (segment->isFirstSegment()) {
306 drawLeftGeometryPoint(s, d, overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
307 } else if (segment->isLastSegment()) {
308 drawRightGeometryPoint(s, d, overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
309 }
310 // Pop layer matrix
312 // draw dotted contour
314 }
315 // declare trim geometry to draw
316 const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? overheadWireGeometry.getShape() : segment->getLane()->getLaneShape();
317 // calculate contour and draw dotted geometry
318 myAdditionalContour.calculateContourExtrudedShape(s, d, this, shape, getType(), overheadWireWidth, 1, true, true, 0, segment, segment->getLane()->getParentEdge());
319 }
320}
321
322
323void
324GNEOverheadWire::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const {
325 // calculate overheadWire width
326 const double overheadWireWidth = s.addSize.getExaggeration(s, segment->getPreviousLane());
327 // check if overhead wire can be drawn
328 if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && segment->getPreviousLane() && segment->getNextLane()) {
329 // obtain color
332 // declare geometry
333 GUIGeometry overheadWireGeometry({segment->getPreviousLane()->getLaneShape().back(), segment->getNextLane()->getLaneShape().front()});
334 // get detail level
335 const auto d = s.getDetailLevel(1);
336 // check if exist connection
337 if (segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane())) {
338 overheadWireGeometry = segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane());
339 }
340 // get both geometries
341 auto overheadWireGeometryTop = overheadWireGeometry;
342 auto overheadWireGeometryBot = overheadWireGeometry;
343 // move to sides
344 overheadWireGeometryTop.moveGeometryToSide(overheadWireWidth * 0.5);
345 overheadWireGeometryBot.moveGeometryToSide(overheadWireWidth * -0.5);
346 // draw geometry only if we'rent in drawForObjectUnderCursor mode
348 // Add a draw matrix
350 // Start with the drawing of the area traslating matrix to origin
351 glTranslated(0, 0, getType() + offsetFront);
352 // Set top color
353 GLHelper::setColor(overheadWireColorTop);
354 // draw top geometry
355 GUIGeometry::drawGeometry(d, overheadWireGeometryTop, 0.2);
356 // Set bot color
357 GLHelper::setColor(overheadWireColorBot);
358 // draw bot geometry
359 GUIGeometry::drawGeometry(d, overheadWireGeometryBot, 0.2);
360 // Pop last matrix
362 // draw dotted contour
364 }
365 // draw contours
366 if (segment->getPreviousLane()->getLane2laneConnections().exist(segment->getNextLane())) {
367 // get shape
368 const auto& shape = segment->getPreviousLane()->getLane2laneConnections().getLane2laneGeometry(segment->getNextLane()).getShape();
369 // calculate contour and draw dotted geometry
370 myAdditionalContour.calculateContourExtrudedShape(s, d, this, shape, getType(), overheadWireWidth, 1, true, true, 0, segment, segment->getJunction());
371 }
372 }
373}
374
375
376std::string
378 switch (key) {
379 case SUMO_ATTR_ID:
380 return getMicrosimID();
382 return getParentAdditionals().front()->getID();
383 case SUMO_ATTR_LANES:
384 return parseIDs(getParentLanes());
386 return toString(myStartPos);
387 case SUMO_ATTR_ENDPOS:
388 return toString(myEndPos);
394 return "";
395 default:
396 return getCommonAttribute(this, key);
397 }
398}
399
400
401double
403 switch (key) {
405 if (myStartPos < 0) {
406 return 0;
407 } else if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
408 return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
409 } else {
410 return myStartPos;
411 }
412 case SUMO_ATTR_ENDPOS:
413 if (myEndPos < 0) {
414 return 0;
415 } else if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
416 return getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
417 } else {
418 return myEndPos;
419 }
420 default:
421 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
422 }
423}
424
425
430
431
432void
433GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
434 switch (key) {
435 case SUMO_ATTR_ID:
437 case SUMO_ATTR_LANES:
439 case SUMO_ATTR_ENDPOS:
442 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
443 break;
444 default:
445 setCommonAttribute(key, value, undoList);
446 break;
447 }
448}
449
450
451bool
452GNEOverheadWire::isValid(SumoXMLAttr key, const std::string& value) {
453 switch (key) {
454 case SUMO_ATTR_ID:
455 return isValidAdditionalID(value);
457 if (value.empty()) {
458 return false;
459 } else {
460 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, value, false) != nullptr);
461 }
463 if (value.empty() || (value == TL("lane start"))) {
464 return true;
465 } else {
466 return canParse<double>(value);
467 }
468 case SUMO_ATTR_ENDPOS:
469 if (value.empty() || (value == TL("lane end"))) {
470 return true;
471 } else {
472 return canParse<double>(value);
473 }
475 return canParse<bool>(value);
477 return true;
478 default:
479 return isCommonValid(key, value);
480 }
481}
482
483
484std::string
486 return getTagStr() + ": " + getID();
487}
488
489
490std::string
492 return getTagStr();
493}
494
495// ===========================================================================
496// private
497// ===========================================================================
498
499void
500GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value) {
501 switch (key) {
502 case SUMO_ATTR_ID:
503 // update microsimID
504 setAdditionalID(value);
505 break;
508 break;
509 case SUMO_ATTR_LANES:
511 break;
513 if (value.empty() || (value == TL("lane start"))) {
515 } else {
516 myStartPos = parse<double>(value);
517 }
518 // update geometry (except for template)
519 if (getParentLanes().size() > 0) {
521 }
522 break;
523 case SUMO_ATTR_ENDPOS:
524 if (value.empty() || (value == TL("lane end"))) {
526 } else {
527 myEndPos = parse<double>(value);
528 }
529 // update geometry (except for template)
530 if (getParentLanes().size() > 0) {
532 }
533 break;
535 myFriendlyPosition = parse<bool>(value);
536 break;
538 myForbiddenInnerLanes = parse<std::vector<std::string> >(value);
539 break;
542 break;
543 default:
544 setCommonAttribute(this, key, value);
545 break;
546 }
547}
548
549void
553 // change only start position
554 myStartPos = moveResult.newFirstPos;
557 // change only end position
558 myEndPos = moveResult.newFirstPos;
559 } else {
560 // change both position
561 myStartPos = moveResult.newFirstPos;
562 myEndPos = moveResult.newLastPos;
563 }
564 // update geometry
566}
567
568
569void
571 // begin change attribute
572 undoList->begin(this, "position of " + getTagStr());
573 // set attributes depending of operation type
576 // set only start position
577 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
580 // set only end position
581 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
582 } else {
583 // set both positions
584 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
585 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newLastPos), undoList);
586 }
587 // end change attribute
588 undoList->end();
589}
590
591
592double
594 // get lane final and shape length
595 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
596 // get startPosition
597 double fixedPos = myStartPos;
598 // adjust fixedPos
599 if (fixedPos < 0) {
600 fixedPos += laneLength;
601 }
602 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
603 // return depending of fixedPos
604 if (fixedPos < 0) {
605 return 0;
606 } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
607 return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
608 } else {
609 return fixedPos;
610 }
611}
612
613
614double
616 // get lane final and shape length
617 const double laneLength = getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
618 // get endPosition
619 double fixedPos = myEndPos;
620 // adjust fixedPos
621 if (fixedPos < 0) {
622 fixedPos += laneLength;
623 }
624 fixedPos *= getParentLanes().back()->getLengthGeometryFactor();
625 // return depending of fixedPos
626 if (fixedPos < POSITION_EPS) {
627 return POSITION_EPS;
628 } else if (fixedPos > getParentLanes().back()->getLaneShapeLength()) {
629 return getParentLanes().back()->getLaneShapeLength();
630 } else {
631 return fixedPos;
632 }
633}
634
635/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
#define TL(string)
Definition MsgHandler.h:305
@ 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
@ 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)
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:64
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void 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
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
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 drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
bool isCommonValid(SumoXMLAttr key, const std::string &value) const
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
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 GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
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...
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:220
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition GNELane.cpp:692
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition GNELane.cpp:214
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:202
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:146
GNEPathManager * getNetworkPathManager()
get network path manager
Definition GNENet.cpp:170
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2194
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.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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:319
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