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-2023 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
66
67
70 // check modes and detector type
74 } else {
75 return nullptr;
76 }
77}
78
79
80void
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 TL("lanes aren't consecutives");
126 }
127 // abort if lanes aren't connected
129 return TL("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) + TL(" > 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) + TL(" > lanes's length"));
144 }
145 // check separator
146 if ((errorFirstLanePosition.size() > 0) && (errorLastLanePosition.size() > 0)) {
147 separator = TL(" 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
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
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 // avoid draw invisible elements
280 if (overheadWireColorTop.alpha() != 0) {
281 // Start drawing adding an gl identificator
283 // push layer matrix
285 // Start with the drawing of the area traslating matrix to origin
286 glTranslated(0, 0, getType() + offsetFront);
287 // Set top color
288 GLHelper::setColor(overheadWireColorTop);
289 // draw top geometry
290 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryTop, 0.2);
291 // Set bot color
292 GLHelper::setColor(overheadWireColorBot);
293 // draw bot geometry
294 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryBot, 0.2);
295 // draw geometry points
296 if (segment->isFirstSegment() && segment->isLastSegment()) {
297 drawLeftGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
298 drawRightGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
299 } else if (segment->isFirstSegment()) {
300 drawLeftGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().front(), overheadWireGeometry.getShapeRotations().front(), overheadWireColorTop, true);
301 } else if (segment->isLastSegment()) {
302 drawRightGeometryPoint(myNet->getViewNet(), overheadWireGeometry.getShape().back(), overheadWireGeometry.getShapeRotations().back(), overheadWireColorTop, true);
303 }
304 // Pop layer matrix
306 // Pop name
308 }
309 // declare trim geometry to draw
310 const auto shape = (segment->isFirstSegment() || segment->isLastSegment()) ? overheadWireGeometry.getShape() : lane->getLaneShape();
311 // check if mouse is over element
312 mouseWithinGeometry(shape, overheadWireWidth);
313 // inspect contour
316 }
317 // front contour
318 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
320 }
321 // delete contour
322 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
324 }
325 // select contour
326 if (myNet->getViewNet()->drawSelectContour(this, this)) {
328 }
329 }
330}
331
332
333void
334GNEOverheadWire::drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* /*segment*/, const double offsetFront) const {
335 // calculate overheadWire width
336 const double overheadWireWidth = s.addSize.getExaggeration(s, fromLane);
337 // check if E2 can be drawn
338 if (s.drawAdditionals(overheadWireWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
339 // obtain color
342 // avoid draw invisible elements
343 if (overheadWireColorTop.alpha() != 0) {
344 // declare geometry
345 GUIGeometry overheadWireGeometry({fromLane->getLaneShape().back(), toLane->getLaneShape().front()});
346 // check if exist connection
347 if (fromLane->getLane2laneConnections().exist(toLane)) {
348 overheadWireGeometry = fromLane->getLane2laneConnections().getLane2laneGeometry(toLane);
349 }
350 // get both geometries
351 auto overheadWireGeometryTop = overheadWireGeometry;
352 auto overheadWireGeometryBot = overheadWireGeometry;
353 // move to sides
354 overheadWireGeometryTop.moveGeometryToSide(overheadWireWidth * 0.5);
355 overheadWireGeometryBot.moveGeometryToSide(overheadWireWidth * -0.5);
356 // Start drawing adding an gl identificator
358 // Add a draw matrix
360 // Start with the drawing of the area traslating matrix to origin
361 glTranslated(0, 0, getType() + offsetFront);
362 // Set top color
363 GLHelper::setColor(overheadWireColorTop);
364 // draw top geometry
365 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryTop, 0.2);
366 // Set bot color
367 GLHelper::setColor(overheadWireColorBot);
368 // draw bot geometry
369 GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), overheadWireGeometryBot, 0.2);
370 // Pop last matrix
372 // Pop name
374 }
375 // draw contours
376 if (fromLane->getLane2laneConnections().exist(toLane)) {
377 // check if mouse is over element
378 mouseWithinGeometry(fromLane->getLane2laneConnections().getLane2laneGeometry(toLane).getShape(), overheadWireWidth);
379 // inspect contour
382 overheadWireWidth, 1, false, false);
383 }
384 // front contour
385 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
387 overheadWireWidth, 1, false, false);
388 }
389 // delete contour
390 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
392 overheadWireWidth, 1, false, false);
393 }
394 // select contour
395 if (myNet->getViewNet()->drawSelectContour(this, this)) {
397 overheadWireWidth, 1, false, false);
398 }
399 }
400 }
401}
402
403
404std::string
406 switch (key) {
407 case SUMO_ATTR_ID:
408 return getMicrosimID();
410 return getParentAdditionals().front()->getID();
411 case SUMO_ATTR_LANES:
412 return parseIDs(getParentLanes());
414 return toString(myStartPos);
415 case SUMO_ATTR_ENDPOS:
416 return toString(myEndPos);
424 return getParametersStr();
426 return "";
427 default:
428 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
429 }
430}
431
432
433double
435 switch (key) {
437 if (myStartPos < 0) {
438 return 0;
439 } else if (myStartPos > getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
440 return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
441 } else {
442 return myStartPos;
443 }
444 case SUMO_ATTR_ENDPOS:
445 if (myEndPos < 0) {
446 return 0;
447 } else if (myEndPos > getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength()) {
448 return getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
449 } else {
450 return myEndPos;
451 }
452 default:
453 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
454 }
455}
456
457
462
463
464void
465GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
466 switch (key) {
467 case SUMO_ATTR_ID:
469 case SUMO_ATTR_LANES:
471 case SUMO_ATTR_ENDPOS:
476 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
477 break;
478 default:
479 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
480 }
481}
482
483
484bool
485GNEOverheadWire::isValid(SumoXMLAttr key, const std::string& value) {
486 switch (key) {
487 case SUMO_ATTR_ID:
488 if (value == getID()) {
489 return true;
490 } else if (isValidAdditionalID(value)) {
492 } else {
493 return false;
494 }
496 if (value.empty()) {
497 return false;
498 } else {
499 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_TRACTION_SUBSTATION, value, false) != nullptr);
500 }
501 case SUMO_ATTR_LANES:
502 if (value.empty()) {
503 return false;
504 } else if (canParse<std::vector<GNELane*> >(myNet, value, false)) {
505 // check if lanes are consecutives
506 return lanesConsecutives(parse<std::vector<GNELane*> >(myNet, value));
507 } else {
508 return false;
509 }
511 return canParse<double>(value);
512 case SUMO_ATTR_ENDPOS:
513 return canParse<double>(value);
515 return canParse<bool>(value);
517 return true;
519 return canParse<bool>(value);
521 return areParametersValid(value);
522 default:
523 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
524 }
525}
526
527
528std::string
530 return getTagStr() + ": " + getID();
531}
532
533
534std::string
536 return getTagStr();
537}
538
539// ===========================================================================
540// private
541// ===========================================================================
542
543void
544GNEOverheadWire::setAttribute(SumoXMLAttr key, const std::string& value) {
545 switch (key) {
546 case SUMO_ATTR_ID:
547 // update microsimID
548 setMicrosimID(value);
549 break;
552 break;
553 case SUMO_ATTR_LANES:
555 break;
557 myStartPos = parse<double>(value);
558 // update geometry (except for template)
559 if (getParentLanes().size() > 0) {
561 }
562 break;
563 case SUMO_ATTR_ENDPOS:
564 myEndPos = parse<double>(value);
565 // update geometry (except for template)
566 if (getParentLanes().size() > 0) {
568 }
569 break;
571 myFriendlyPosition = parse<bool>(value);
572 break;
574 myForbiddenInnerLanes = parse<std::vector<std::string> >(value);
575 break;
577 if (parse<bool>(value)) {
579 } else {
581 }
582 break;
584 setParametersStr(value);
585 break;
588 break;
589 default:
590 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
591 }
592}
593
594void
598 // change only start position
599 myStartPos = moveResult.newFirstPos;
602 // change only end position
603 myEndPos = moveResult.newFirstPos;
604 } else {
605 // change both position
606 myStartPos = moveResult.newFirstPos;
607 myEndPos = moveResult.newSecondPos;
608 }
609 // update geometry
611}
612
613
614void
616 // begin change attribute
617 undoList->begin(myTagProperty.getGUIIcon(), "position of " + getTagStr());
618 // set attributes depending of operation type
621 // set only start position
622 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
625 // set only end position
626 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newFirstPos), undoList);
627 } else {
628 // set both positions
629 setAttribute(SUMO_ATTR_STARTPOS, toString(moveResult.newFirstPos), undoList);
630 setAttribute(SUMO_ATTR_ENDPOS, toString(moveResult.newSecondPos), undoList);
631 }
632 // end change attribute
633 undoList->end();
634}
635
636
637double
639 // get lane final and shape length
640 const double laneLength = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
641 // get startPosition
642 double fixedPos = myStartPos;
643 // adjust fixedPos
644 if (fixedPos < 0) {
645 fixedPos += laneLength;
646 }
647 fixedPos *= getParentLanes().front()->getLengthGeometryFactor();
648 // return depending of fixedPos
649 if (fixedPos < 0) {
650 return 0;
651 } else if (fixedPos > (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS)) {
652 return (getParentLanes().front()->getLaneShapeLength() - POSITION_EPS);
653 } else {
654 return fixedPos;
655 }
656}
657
658
659double
661 // get lane final and shape length
662 const double laneLength = getParentLanes().back()->getParentEdge()->getNBEdge()->getFinalLength();
663 // get endPosition
664 double fixedPos = myEndPos;
665 // adjust fixedPos
666 if (fixedPos < 0) {
667 fixedPos += laneLength;
668 }
669 fixedPos *= getParentLanes().back()->getLengthGeometryFactor();
670 // return depending of fixedPos
671 if (fixedPos < POSITION_EPS) {
672 return POSITION_EPS;
673 } else if (fixedPos > getParentLanes().back()->getLaneShapeLength()) {
674 return getParentLanes().back()->getLaneShapeLength();
675 } else {
676 return fixedPos;
677 }
678}
679
680/****************************************************************************/
@ 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:287
@ 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.
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:136
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition GNELane.cpp:829
const GUIGeometry & getLaneGeometry() const
Definition GNELane.cpp:130
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:120
GNEPathManager * getPathManager()
get path manager
Definition GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
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
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
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
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
GUIGlID getGlID() const
Returns the numerical id of the object.
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.
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:300
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition RGBColor.cpp:92
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