Eclipse SUMO - Simulation of Urban MObility
GNEOverheadWire.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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 <netedit/GNENet.h>
21#include <netedit/GNEUndoList.h>
22#include <netedit/GNEViewNet.h>
29
30#include "GNEOverheadWire.h"
32
33
34// ===========================================================================
35// member method definitions
36// ===========================================================================
37
40 GUIIconSubSys::getIcon(GUIIcon::OVERHEADWIRE), "", {}, {}, {}, {}, {}, {}),
41 myStartPos(0),
42 myEndPos(0),
43myFriendlyPosition(false) {
44 // reset default values
45 resetDefaultValues();
46}
47
48
49GNEOverheadWire::GNEOverheadWire(const std::string& id, std::vector<GNELane*> lanes, GNEAdditional* substation, GNENet* net,
50 const double startPos, const double endPos, const bool friendlyPos, const std::vector<std::string>& forbiddenInnerLanes,
51 const Parameterised::Map& parameters) :
53 GUIIconSubSys::getIcon(GUIIcon::OVERHEADWIRE), "", {}, {}, lanes, {substation}, {}, {}),
54Parameterised(parameters),
55myStartPos(startPos),
56myEndPos(endPos),
57myFriendlyPosition(friendlyPos),
58myForbiddenInnerLanes(forbiddenInnerLanes) {
59 // update centering boundary without updating grid
60 updateCenteringBoundary(false);
61}
62
63
65}
66
67
70 // check modes and detector type
74 } else {
75 return nullptr;
76 }
77}
78
79
80void
83 device.writeAttr(SUMO_ATTR_ID, getID());
90 }
91 if (!myForbiddenInnerLanes.empty()) {
93 }
94 // write parameters
95 writeParams(device);
96 device.closeTag();
97}
98
99
100bool
102 // first check if there is connection between all consecutive lanes
104 // with friendly position enabled position are "always fixed"
105 if (myFriendlyPosition) {
106 return true;
107 } else {
108 return (myStartPos >= 0) &&
109 (myEndPos >= 0) &&
110 ((myStartPos) <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) &&
111 ((myEndPos) <= getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
112 }
113 } else {
114 return false;
115 }
116}
117
118
119std::string
121 // declare variable for error position
122 std::string errorFirstLanePosition, separator, errorLastLanePosition;
123 // abort if lanes aren't consecutives
125 return "lanes aren't consecutives";
126 }
127 // abort if lanes aren't connected
129 return "lanes aren't connected";
130 }
131 // check positions over first lane
132 if (myStartPos < 0) {
133 errorFirstLanePosition = (toString(SUMO_ATTR_STARTPOS) + " < 0");
134 }
135 if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
136 errorFirstLanePosition = (toString(SUMO_ATTR_STARTPOS) + " > lanes's length");
137 }
138 // check positions over last lane
139 if (myEndPos < 0) {
140 errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + " < 0");
141 }
142 if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
143 errorLastLanePosition = (toString(SUMO_ATTR_ENDPOS) + " > lanes's length");
144 }
145 // check separator
146 if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
147 separator = " and ";
148 }
149 // return error message
150 return errorFirstLanePosition + separator + errorLastLanePosition;
151}
152
153
154void
157 // build connections between all consecutive lanes
158 bool foundConnection = true;
159 int i = 0;
160 // iterate over all lanes, and stop if myE2valid is false
161 while (i < ((int)getParentLanes().size() - 1)) {
162 // change foundConnection to false
163 foundConnection = false;
164 // if a connection betwen "from" lane and "to" lane of connection is found, change myE2valid to true again
165 for (const auto& connection : getParentLanes().at(i)->getParentEdge()->getGNEConnections()) {
166 if ((connection->getLaneFrom() == getParentLanes().at(i)) && (connection->getLaneTo() == getParentLanes().at(i + 1))) {
167 foundConnection = true;
168 }
169 }
170 // if connection wasn't found
171 if (!foundConnection) {
172 // create new connection manually
173 NBEdge::Connection newCon(getParentLanes().at(i)->getIndex(), getParentLanes().at(i + 1)->getParentEdge()->getNBEdge(), getParentLanes().at(i + 1)->getIndex());
174 // allow to undo creation of new lane
175 myNet->getViewNet()->getUndoList()->add(new GNEChange_Connection(getParentLanes().at(i)->getParentEdge(), newCon, false, true), true);
176 }
177 // update lane iterator
178 i++;
179 }
180 } else {
181 // declare new positions
182 double newPositionOverLane = myStartPos;
183 double newEndPositionOverLane = myEndPos;
184 // fix pos and length checkAndFixDetectorPosition
186 newPositionOverLane, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength(),
187 newEndPositionOverLane, getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength());
188 // set new position and endPosition
190 setAttribute(SUMO_ATTR_ENDPOS, toString(newEndPositionOverLane), myNet->getViewNet()->getUndoList());
191 }
192}
193
194
195void
197 // compute path
199}
200
201
205}
206
207
208void
209GNEOverheadWire::updateCenteringBoundary(const bool /* updateGrid */) {
211 // add center
213 // grow
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
237 // calculate path
239}
240
241
242void
243GNEOverheadWire::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const {
244 // calculate overheadWire width
245 const double overheadWireWidth = s.addSize.getExaggeration(s, lane);
246 // check if E2 can be drawn
247 if (s.drawAdditionals(overheadWireWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
248 // calculate startPos
249 const double geometryDepartPos = getAttributeDouble(SUMO_ATTR_STARTPOS);
250 // get endPos
251 const double geometryEndPos = getAttributeDouble(SUMO_ATTR_ENDPOS);
252 // declare path geometry
253 GUIGeometry overheadWireGeometry;
254 // update pathGeometry depending of first and last segment
255 if (segment->isFirstSegment() && segment->isLastSegment()) {
256 overheadWireGeometry.updateGeometry(lane->getLaneGeometry().getShape(),
257 geometryDepartPos, geometryEndPos, // extrem positions
258 Position::INVALID, Position::INVALID); // extra positions
259 } else if (segment->isFirstSegment()) {
260 overheadWireGeometry.updateGeometry(lane->getLaneGeometry().getShape(),
261 geometryDepartPos, -1, // extrem positions
262 Position::INVALID, Position::INVALID); // extra positions
263 } else if (segment->isLastSegment()) {
264 overheadWireGeometry.updateGeometry(lane->getLaneGeometry().getShape(),
265 -1, geometryEndPos, // extrem positions
266 Position::INVALID, Position::INVALID); // extra positions
267 } else {
268 overheadWireGeometry = lane->getLaneGeometry();
269 }
270 // get both geometries
271 auto overheadWireGeometryTop = overheadWireGeometry;
272 auto overheadWireGeometryBot = overheadWireGeometry;
273 // move to sides
274 overheadWireGeometryTop.moveGeometryToSide(overheadWireWidth * 0.5);
275 overheadWireGeometryBot.moveGeometryToSide(overheadWireWidth * -0.5);
276 // obtain color
279 // Start drawing adding an gl identificator
281 // push layer matrix
283 // Start with the drawing of the area traslating matrix to origin
284 glTranslated(0, 0, getType() + offsetFront);
285 // Set top color
286 GLHelper::setColor(overheadWireColorTop);
287 // draw top geometry
288 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryTop, 0.2);
289 // Set bot color
290 GLHelper::setColor(overheadWireColorBot);
291 // draw bot geometry
292 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryBot, 0.2);
293 // draw geometry points
294 if (segment->isFirstSegment() && segment->isLastSegment()) {
295 drawLeftGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
296 drawRightGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
297 } else if (segment->isFirstSegment()) {
298 drawLeftGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
299 } else if (segment->isLastSegment()) {
300 drawRightGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
301 }
302 // Pop layer matrix
304 // Pop name
306 // declare trim geometry to draw
307 const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? overheadWireGeometry.getShape() : lane->getLaneShape();
308 // check if mouse is over element
309 mouseWithinGeometry(shape, overheadWireWidth);
310 // inspect contour
313 }
314 // front contour
315 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
317 }
318 // delete contour
319 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
321 }
322 // select contour
323 if (myNet->getViewNet()->drawSelectContour(this, this)) {
325 }
326 }
327}
328
329
330void
331GNEOverheadWire::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* /*segment*/, const double offsetFront) const {
332 // calculate overheadWire width
333 const double overheadWireWidth = s.addSize.getExaggeration(s, fromLane);
334 // check if E2 can be drawn
335 if (s.drawAdditionals(overheadWireWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
336 // obtain color
339 // declare geometry
340 GUIGeometry overheadWireGeometry({fromLane->getLaneShape().back(), toLane->getLaneShape().front()});
341 // check if exist connection
342 if (fromLane->getLane2laneConnections().exist(toLane)) {
343 overheadWireGeometry = fromLane->getLane2laneConnections().getLane2laneGeometry(toLane);
344 }
345 // get both geometries
346 auto overheadWireGeometryTop = overheadWireGeometry;
347 auto overheadWireGeometryBot = overheadWireGeometry;
348 // move to sides
349 overheadWireGeometryTop.moveGeometryToSide(overheadWireWidth * 0.5);
350 overheadWireGeometryBot.moveGeometryToSide(overheadWireWidth * -0.5);
351 // Start drawing adding an gl identificator
353 // Add a draw matrix
355 // Start with the drawing of the area traslating matrix to origin
356 glTranslated(0, 0, getType() + offsetFront);
357 // Set top color
358 GLHelper::setColor(overheadWireColorTop);
359 // draw top geometry
360 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryTop, 0.2);
361 // Set bot color
362 GLHelper::setColor(overheadWireColorBot);
363 // draw bot geometry
364 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryBot, 0.2);
365 // Pop last matrix
367 // Pop name
369 // draw contours
370 if (fromLane->getLane2laneConnections().exist(toLane)) {
371 // check if mouse is over element
372 mouseWithinGeometry(fromLane->getLane2laneConnections().getLane2laneGeometry(toLane).getShape(), overheadWireWidth);
373 // inspect contour
376 overheadWireWidth, 1, false, false);
377 }
378 // front contour
379 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
381 overheadWireWidth, 1, false, false);
382 }
383 // delete contour
384 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
386 overheadWireWidth, 1, false, false);
387 }
388 // select contour
389 if (myNet->getViewNet()->drawSelectContour(this, this)) {
391 overheadWireWidth, 1, false, false);
392 }
393 }
394 }
395}
396
397
398std::string
400 switch (key) {
401 case SUMO_ATTR_ID:
402 return getMicrosimID();
404 return getParentAdditionals().front()->getID();
405 case SUMO_ATTR_LANES:
406 return parseIDs(getParentLanes());
408 return toString(myStartPos);
409 case SUMO_ATTR_ENDPOS:
410 return toString(myEndPos);
418 return getParametersStr();
420 return "";
421 default:
422 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
423 }
424}
425
426
427double
429 switch (key) {
431 if (myStartPos < 0) {
432 return 0;
433 } else if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
434 return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
435 } else {
436 return myStartPos;
437 }
438 case SUMO_ATTR_ENDPOS:
439 if (myEndPos < 0) {
440 return 0;
441 } else if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
442 return getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
443 } else {
444 return myEndPos;
445 }
446 default:
447 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
448 }
449}
450
451
454 return getParametersMap();
455}
456
457
458void
459GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
460 switch (key) {
461 case SUMO_ATTR_ID:
463 case SUMO_ATTR_LANES:
465 case SUMO_ATTR_ENDPOS:
470 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
471 break;
472 default:
473 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
474 }
475}
476
477
478bool
479GNEOverheadWire::isValid(SumoXMLAttr key, const std::string& value) {
480 switch (key) {
481 case SUMO_ATTR_ID:
482 if (value == getID()) {
483 return true;
484 } else if (isValidAdditionalID(value)) {
486 } else {
487 return false;
488 }
490 if (value.empty()) {
491 return false;
492 } else {
493 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, value, false) != nullptr);
494 }
495 case SUMO_ATTR_LANES:
496 if (value.empty()) {
497 return false;
498 } else if (canParse<std::vector<GNELane*> >(myNet, value, false)) {
499 // check if lanes are consecutives
500 return lanesConsecutives(parse<std::vector<GNELane*> >(myNet, value));
501 } else {
502 return false;
503 }
505 return canParse<double>(value);
506 case SUMO_ATTR_ENDPOS:
507 return canParse<double>(value);
509 return canParse<bool>(value);
511 return true;
513 return canParse<bool>(value);
515 return areParametersValid(value);
516 default:
517 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
518 }
519}
520
521
522std::string
524 return getTagStr() + ": " + getID();
525}
526
527
528std::string
530 return getTagStr();
531}
532
533// ===========================================================================
534// private
535// ===========================================================================
536
537void
538GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value) {
539 switch (key) {
540 case SUMO_ATTR_ID:
541 // update microsimID
542 setMicrosimID(value);
543 break;
546 break;
547 case SUMO_ATTR_LANES:
549 break;
551 myStartPos = parse<double>(value);
552 // update geometry (except for template)
553 if (getParentLanes().size() > 0) {
555 }
556 break;
557 case SUMO_ATTR_ENDPOS:
558 myEndPos = parse<double>(value);
559 // update geometry (except for template)
560 if (getParentLanes().size() > 0) {
562 }
563 break;
565 myFriendlyPosition = parse<bool>(value);
566 break;
568 myForbiddenInnerLanes = parse<std::vector<std::string> >(value);
569 break;
571 if (parse<bool>(value)) {
573 } else {
575 }
576 break;
578 setParametersStr(value);
579 break;
582 break;
583 default:
584 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
585 }
586}
587
588void
592 // change only start position
593 myStartPos = moveResult.newFirstPos;
596 // change only end position
597 myEndPos = moveResult.newFirstPos;
598 } else {
599 // change both position
600 myStartPos = moveResult.newFirstPos;
601 myEndPos = moveResult.newSecondPos;
602 }
603 // update geometry
605}
606
607
608void
610 // begin change attribute
611 undoList->begin(myTagProperty.getGUIIcon(), "position of " + getTagStr());
612 // set attributes depending of operation type
615 // set only start position
616 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
619 // set only end position
620 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
621 } else {
622 // set both positions
623 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
624 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newSecondPos), undoList);
625 }
626 // end change attribute
627 undoList->end();
628}
629
630
631double
633 // get lane final and shape length
634 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
635 // get startPosition
636 double fixedPos = myStartPos;
637 // adjust fixedPos
638 if (fixedPos < 0) {
639 fixedPos += laneLength;
640 }
641 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
642 // return depending of fixedPos
643 if (fixedPos < 0) {
644 return 0;
645 } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
646 return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
647 } else {
648 return fixedPos;
649 }
650}
651
652
653double
655 // get lane final and shape length
656 const double laneLength = getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
657 // get endPosition
658 double fixedPos = myEndPos;
659 // adjust fixedPos
660 if (fixedPos < 0) {
661 fixedPos += laneLength;
662 }
663 fixedPos *= getParentLanes().back()->getLengthGeometryFactor();
664 // return depending of fixedPos
665 if (fixedPos < POSITION_EPS) {
666 return POSITION_EPS;
667 } else if (fixedPos > getParentLanes().back()->getLaneShapeLength()) {
668 return getParentLanes().back()->getLaneShapeLength();
669 } else {
670 return fixedPos;
671 }
672}
673
674/****************************************************************************/
@ 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
@ 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
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:583
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:139
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void popName()
pop Name
Definition: GLHelper.cpp:148
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.
Definition: GNEAdditional.h:48
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
static void drawRightGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false)
draw right geometry point
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
Boundary myAdditionalBoundary
Additional Boundary.
static void drawLeftGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false)
draw left geometry point
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
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
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
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
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:142
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:917
const GUIGeometry & getLaneGeometry() const
Definition: GNELane.cpp:136
move operation
move result
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
double newSecondPos
new second 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:132
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:138
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
void updateGeometry()
update pre-computed geometry information
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.
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 drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object (lane)
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
double myEndPos
end position over lane
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 writed into XML
bool isLastSegment() const
check if segment is the last path's segment
bool isFirstSegment() const
check if segment is the first path's segment
void calculateConsecutivePathLanes(PathElement *pathElement, const std::vector< GNELane * > lanes)
calculate consecutive path lanes
GUIIcon getGUIIcon() const
get GUI icon associated to this Tag
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...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:656
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:632
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
GNEUndoList * getUndoList() const
get the undoList object
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
static void drawDottedContourShape(const GUIVisualizationSettings &s, const DottedContourType type, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given shape (used by additionals)
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 &s, const Position &mousePos, 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
Definition: GUIGeometry.cpp:58
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:141
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:154
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:102
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings addSize
bool drawAdditionals(const double exaggeration) const
check if additionals must be drawn
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:251
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.
Definition: Parameterised.h:41
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
Definition: Parameterised.h:45
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:298
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...)
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