Eclipse SUMO - Simulation of Urban MObility
GNEPOI.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// A class for visualizing and editing POIS in netedit (adapted from
19// GUIPointOfInterest and NLHandler)
20/****************************************************************************/
21#include <config.h>
22
23#include <string>
24#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
37
38#include "GNEPOI.h"
39
40
41// ===========================================================================
42// method definitions
43// ===========================================================================
44
46 PointOfInterest("", "", RGBColor::BLACK, Position(0, 0), false, "", 0, false, 0, 0, 0, "", false, 0, 0, "", Parameterised::Map()),
47 GNEAdditional("", net, GLO_POI, tag, GUIIconSubSys::getIcon(GUIIcon::POI), "", {}, {}, {}, {}, {}, {}) {
48 // reset default values
49 resetDefaultValues();
50}
51
52
53GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, const double xLon,
54 const double yLat, const bool geo, const double layer, const double angle, const std::string& imgFile,
55 const bool relativePath, const double width, const double height, const std::string& name,
56 const Parameterised::Map& parameters) :
57 PointOfInterest(id, type, color, Position(xLon, yLat), geo, "", 0, false, 0, layer, angle, imgFile, relativePath, width, height, name, parameters),
59 "", {}, {}, {}, {}, {}, {}) {
60 // update position depending of GEO
61 if (geo) {
62 Position cartesian(x(), y());
64 set(cartesian.x(), cartesian.y());
65 }
66 // update centering boundary without updating grid
67 updateCenteringBoundary(false);
68}
69
70
71GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
72 const bool friendlyPos, const double posLat, const double layer, const double angle, const std::string& imgFile, const bool relativePath, const double width,
73 const double height, const std::string& name, const Parameterised::Map& parameters) :
74 PointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, friendlyPos, posLat, layer, angle, imgFile, relativePath, width, height, name, parameters),
75 GNEAdditional(id, net, GLO_POI, GNE_TAG_POILANE, GUIIconSubSys::getIcon(GUIIcon::POILANE), "", {}, {}, {lane}, {}, {}, {}) {
76 // update geometry (needed for POILanes)
77 updateGeometry();
78 // update centering boundary without updating grid
79 updateCenteringBoundary(false);
80}
81
82
84
85
91 // get snap radius
93 // get mouse position
94 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
95 // check if we're editing width or height
96 if ((myShapeWidth.size() == 0) || (myShapeHeight.size() == 0)) {
97 return nullptr;
98 } else if (myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
99 // edit height
101 } else if (myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
102 // edit height
104 } else if (myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
105 // edit width
107 } else if (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
108 // edit width
110 } else {
111 return nullptr;
112 }
113 } else if (getTagProperty().getTag() == GNE_TAG_POILANE) {
114 // return move operation for POI placed over lane
115 return new GNEMoveOperation(this, getParentLanes().front(), myPosOverLane,
117 } else {
118 // return move operation for a position in view
119 return new GNEMoveOperation(this, *this);
120 }
121}
122
123
124void
125GNEPOI::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
126 // nothing to remove
127}
128
129
130std::string
132 return "";
133}
134
135
139 POIBaseObject->setTag(SUMO_TAG_POI);
140 // fill attributes
141 POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
151 return POIBaseObject;
152}
153
154
155void
157 if (getParentLanes().size() > 0) {
158 // obtain fixed position over lane
159 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShape().length() ? getParentLanes().at(0)->getLaneShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
160 // write POILane using POI::writeXML
161 writeXML(device, false, 0, getParentLanes().at(0)->getID(), fixedPositionOverLane, myFriendlyPos, myPosLat);
162 } else {
163 writeXML(device, myGeo);
164 }
165}
166
167
168void
170 // set position
171 if (getParentLanes().size() > 0) {
172 // obtain fixed position over lane
173 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShapeLength() ? getParentLanes().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
174 // set new position regarding to lane
175 set(getParentLanes().at(0)->getLaneShape().positionAtOffset(fixedPositionOverLane * getParentLanes().at(0)->getLengthGeometryFactor(), -myPosLat));
176 }
177 // check if update width and height shapes
178 if ((getWidth() > 0) && (getHeight() > 0)) {
179 // calculate shape length
180 myShapeHeight.clear();
181 myShapeHeight.push_back(Position(0, getHeight() * -0.5));
182 myShapeHeight.push_back(Position(0, getHeight() * 0.5));
183 // move
184 myShapeHeight.add(*this);
185 // calculate shape width
186 PositionVector leftShape = myShapeHeight;
187 leftShape.move2side(getWidth() * -0.5);
188 PositionVector rightShape = myShapeHeight;
189 rightShape.move2side(getWidth() * 0.5);
190 myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
191 }
192}
193
194
197 return *this;
198}
199
200
201double
203 return s.poiSize.getExaggeration(s, this);
204}
205
206
207void
208GNEPOI::updateCenteringBoundary(const bool updateGrid) {
209 // Remove object from net
210 if (updateGrid) {
212 }
213 // reset boundary
215 // add position (this POI)
217 // grow boundary
218 myAdditionalBoundary.grow(10 + std::max(getWidth() * 0.5, getHeight() * 0.5));
219 // add object into net
220 if (updateGrid) {
222 }
223}
224
225
226void
227GNEPOI::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
228 // nothing to split
229}
230
231
234 return GUIGlObject::getGlID();
235}
236
237
238std::string
240 if (getParentLanes().size() > 0) {
241 return getParentLanes().front()->getID();
242 } else {
243 return myNet->getMicrosimID();
244 }
245}
246
247
250 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
251 buildPopupHeader(ret, app);
254 // build selection and show parameters menu
257 // continue depending of lane number
258 if (getParentLanes().size() > 0) {
259 // add option for convert to GNEPOI
261 return ret;
262 } else {
263 // add option for convert to GNEPOI
265 }
266 return ret;
267}
268
269
270void
272 // first check if POI can be drawn
274 // check if boundary has to be drawn
275 if (s.drawBoundaries) {
277 }
278 // check if POI can be drawn
279 if (GUIPointOfInterest::checkDraw(s, this)) {
280 // obtain POIExaggeration
281 const double POIExaggeration = getExaggeration(s);
282 // push name (needed for getGUIGlObjectsUnderCursor(...)
284 // draw inner polygon
285 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
288 } else {
291 }
292 // draw an orange square mode if there is an image(see #4036)
294 // Add a draw matrix for drawing logo
296 glTranslated(x(), y(), getType() + 0.01);
298 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
300 }
301 // draw geometry points
306 // pop name
308 // draw lock icon
310 // check if mouse is over element
311 if (getShapeImgFile().empty()) {
312 mouseWithinGeometry(*this, 1.3);
313 } else {
314 mouseWithinGeometry(*this, getHeight() * 0.5, getWidth() * 0.5, 0, 0, getShapeNaviDegree());
315 }
316 // inspect contour
318 if (getShapeImgFile().empty()) {
320 } else {
322 }
323 }
324 // front element contour
325 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
326 if (getShapeImgFile().empty()) {
328 } else {
330 }
331 }
332 // delete contour
333 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
334 if (getShapeImgFile().empty()) {
336 } else {
338 }
339 }
340 // select contour
341 if (myNet->getViewNet()->drawSelectContour(this, this)) {
342 if (getShapeImgFile().empty()) {
344 } else {
346 }
347 }
348 }
349 }
350}
351
352
353std::string
355 switch (key) {
356 case SUMO_ATTR_ID:
357 return myID;
358 case SUMO_ATTR_COLOR:
359 return toString(getShapeColor());
360 case SUMO_ATTR_LANE:
361 return myLane;
363 if (getParentLanes().size() > 0) {
364 return toString(myPosOverLane);
365 } else {
366 return toString(*this);
367 }
369 return toString(getFriendlyPos());
371 return toString(myPosLat);
372 case SUMO_ATTR_LON: {
373 // calculate geo position
374 Position GEOPosition(x(), y());
376 // return lon
377 return toString(GEOPosition.x(), 8);
378 }
379 case SUMO_ATTR_LAT: {
380 // calculate geo position
381 Position GEOPosition(x(), y());
383 // return lat
384 return toString(GEOPosition.y(), 8);
385 }
386 case SUMO_ATTR_TYPE:
387 return getShapeType();
388 case SUMO_ATTR_LAYER:
390 return "default";
391 } else {
392 return toString(getShapeLayer());
393 }
395 return getShapeImgFile();
398 case SUMO_ATTR_WIDTH:
399 return toString(getWidth());
400 case SUMO_ATTR_HEIGHT:
401 return toString(getHeight());
402 case SUMO_ATTR_ANGLE:
404 case SUMO_ATTR_NAME:
405 return getShapeName();
411 return "";
412 default:
413 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
414 }
415}
416
417
418double
420 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
421}
422
423
427}
428
429
430void
431GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
432 switch (key) {
433 case SUMO_ATTR_ID:
434 case SUMO_ATTR_COLOR:
435 case SUMO_ATTR_LANE:
439 case SUMO_ATTR_LON:
440 case SUMO_ATTR_LAT:
441 case SUMO_ATTR_TYPE:
442 case SUMO_ATTR_LAYER:
445 case SUMO_ATTR_WIDTH:
446 case SUMO_ATTR_HEIGHT:
447 case SUMO_ATTR_ANGLE:
448 case SUMO_ATTR_NAME:
452 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
453 break;
454 default:
455 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
456 }
457}
458
459
460bool
461GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
462 switch (key) {
463 case SUMO_ATTR_ID:
465 if (value == getID()) {
466 return true;
467 } else {
468 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_POI, value, false) == nullptr) &&
469 (myNet->getAttributeCarriers()->retrieveAdditional(GNE_TAG_POILANE, value, false) == nullptr) &&
470 (myNet->getAttributeCarriers()->retrieveAdditional(GNE_TAG_POIGEO, value, false) == nullptr);
471 }
472 } else {
473 // invalid id
474 return false;
475 }
476 case SUMO_ATTR_COLOR:
477 return canParse<RGBColor>(value);
478 case SUMO_ATTR_LANE:
479 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
481 if (getParentLanes().size() > 0) {
482 return canParse<double>(value);
483 } else {
484 return canParse<Position>(value);
485 }
487 return canParse<bool>(value);
489 return canParse<double>(value);
490 case SUMO_ATTR_LON:
491 return canParse<double>(value);
492 case SUMO_ATTR_LAT:
493 return canParse<double>(value);
494 case SUMO_ATTR_TYPE:
495 return true;
496 case SUMO_ATTR_LAYER:
497 if (value == "default") {
498 return true;
499 } else {
500 return canParse<double>(value);
501 }
503 if (value == "") {
504 return true;
505 } else {
506 // check that image can be loaded
507 return GUITexturesHelper::getTextureID(value) != -1;
508 }
510 return canParse<bool>(value);
511 case SUMO_ATTR_WIDTH:
512 return canParse<double>(value) && (parse<double>(value) > 0);
513 case SUMO_ATTR_HEIGHT:
514 return canParse<double>(value) && (parse<double>(value) > 0);
515 case SUMO_ATTR_ANGLE:
516 return canParse<double>(value);
517 case SUMO_ATTR_NAME:
520 return canParse<bool>(value);
522 return areParametersValid(value);
523 default:
524 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
525 }
526}
527
528
529bool
531 // check if we're in supermode Network
533 return true;
534 } else {
535 return false;
536 }
537}
538
539
540std::string
542 return getTagStr() + ": " + getID();
543}
544
545
546std::string
548 return getTagStr();
549}
550
551// ===========================================================================
552// private
553// ===========================================================================
554
555void
556GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
557 switch (key) {
558 case SUMO_ATTR_ID: {
559 // update microsimID
560 setMicrosimID(value);
561 // set named ID
562 myID = value;
563 break;
564 }
565 case SUMO_ATTR_COLOR:
566 setShapeColor(parse<RGBColor>(value));
567 break;
568 case SUMO_ATTR_LANE:
569 myLane = value;
571 break;
572 case SUMO_ATTR_POSITION: {
573 if (getParentLanes().size() > 0) {
574 if (canParse<double>(value)) {
575 myPosOverLane = parse<double>(value);
576 }
577 } else {
578 // set position
579 set(parse<Position>(value));
580 }
581 // update centering boundary
583 // update geometry
585 break;
586 }
588 setFriendlyPos(parse<bool>(value));
589 break;
591 myPosLat = parse<double>(value);
592 // update centering boundary
594 // update geometry
596 break;
597 case SUMO_ATTR_LON: {
598 // calculate cartesian
599 Position cartesian(parse<double>(value), parse<double>(getAttribute(SUMO_ATTR_LAT)));
601 // set cartesian
602 set(cartesian);
603 // update centering boundary
605 // update geometry
607 break;
608 }
609 case SUMO_ATTR_LAT: {
610 // calculate cartesian
611 Position cartesian(parse<double>(getAttribute(SUMO_ATTR_LON)), parse<double>(value));
613 // set cartesian
614 set(cartesian);
615 // update centering boundary
617 // update geometry
619 break;
620 }
621 case SUMO_ATTR_TYPE:
622 setShapeType(value);
623 break;
624 case SUMO_ATTR_LAYER:
625 if (value == "default") {
627 } else {
628 setShapeLayer(parse<double>(value));
629 }
630 break;
632 // first remove object from grid due img file affect to boundary
633 if (getID().size() > 0) {
635 }
636 setShapeImgFile(value);
637 // all textures must be refresh
639 // add object into grid again
640 if (getID().size() > 0) {
642 }
643 break;
645 setShapeRelativePath(parse<bool>(value));
646 break;
647 case SUMO_ATTR_WIDTH:
648 // set new width
649 setWidth(parse<double>(value));
650 // update centering boundary and geometry (except for templates)
651 if (getID().size() > 0) {
654 }
655 break;
656 case SUMO_ATTR_HEIGHT:
657 // set new height
658 setHeight(parse<double>(value));
659 // update centering boundary and geometry (except for templates)
660 if (getID().size() > 0) {
663 }
664 break;
665 case SUMO_ATTR_ANGLE:
666 setShapeNaviDegree(parse<double>(value));
667 break;
668 case SUMO_ATTR_NAME:
669 setShapeName(value);
670 break;
672 if (parse<bool>(value)) {
674 } else {
676 }
677 break;
680 break;
683 break;
684 default:
685 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
686 }
687}
688
689
690void
692 // check what are being updated
694 myShapeHeight = moveResult.shapeToUpdate;
695 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
696 myShapeWidth = moveResult.shapeToUpdate;
697 } else {
698 if (getTagProperty().getTag() == GNE_TAG_POILANE) {
699 myPosOverLane = moveResult.newFirstPos;
700 } else {
701 set(moveResult.shapeToUpdate.front());
702 }
703 // update geometry
705 }
706}
707
708
709void
710GNEPOI::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
711 // check what are being updated
713 undoList->begin(myTagProperty.getGUIIcon(), "height of " + getTagStr());
715 undoList->end();
716 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
717 undoList->begin(myTagProperty.getGUIIcon(), "width of " + getTagStr());
719 undoList->end();
720 } else {
721 undoList->begin(GUIIcon::POI, "position of " + getTagStr());
722 if (getTagProperty().getTag() == GNE_TAG_POILANE) {
724 } else {
725 undoList->changeAttribute(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(moveResult.shapeToUpdate.front())));
726 }
727 undoList->end();
728 }
729}
730
731/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:1233
unsigned int GUIGlID
Definition: GUIGlObject.h:43
@ GLO_DOTTEDCONTOUR_FRONT
dotted contour front element (used in NETEDIT)
@ GLO_POI
a poi
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_POILANE
Point of interest over Lane.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LANE
@ SUMO_ATTR_LON
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_NAME
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_LAT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_POSITION
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
@ SUMO_ATTR_RELATIVEPATH
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
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:894
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 drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:277
static void popName()
pop Name
Definition: GLHelper.cpp:148
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
static void drawRightGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false)
draw right geometry point
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
static void drawUpGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false)
draw up geometry point
static void drawDownGeometryPoint(const GNEViewNet *viewNet, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false)
draw down geometry point
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
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
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
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< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
bool getAllowChangeLane() const
allow change lane
CommonModeOptions * getCommonModeOptions() const
get common mode options
move operation
move result
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
PositionVector shapeToUpdate
shape to update (edited in moveElement)
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
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
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1245
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1257
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:132
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1987
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their correspond attribute are valids
Definition: GNEPOI.cpp:461
Position getPositionInView() const override
Returns position of shape in view.
Definition: GNEPOI.cpp:196
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPOI.cpp:541
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition: GNEPOI.cpp:271
const Parameterised::Map & getACParametersMap() const override
get parameters map
Definition: GNEPOI.cpp:425
PositionVector myShapeWidth
shape width of POI
Definition: GNEPOI.h:212
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList) override
commit move shape
Definition: GNEPOI.cpp:710
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition: GNEPOI.cpp:208
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPOI.cpp:547
std::string getParentName() const override
Returns the name of the parent object.
Definition: GNEPOI.cpp:239
std::string getAttribute(SumoXMLAttr key) const override
method for getting the Attribute of an XML key
Definition: GNEPOI.cpp:354
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition: GNEPOI.cpp:202
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:233
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:83
GNEMoveOperation * getMoveOperation() override
get move operation
Definition: GNEPOI.cpp:87
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition: GNEPOI.cpp:530
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList) override
remove geometry point in the clicked position
Definition: GNEPOI.cpp:125
double getAttributeDouble(SumoXMLAttr key) const override
Definition: GNEPOI.cpp:419
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEPOI.cpp:131
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition: GNEPOI.cpp:156
void updateGeometry() override
update pre-computed geometry information
Definition: GNEPOI.cpp:169
PositionVector myShapeHeight
shape height of POI
Definition: GNEPOI.h:215
void setMoveShape(const GNEMoveResult &moveResult) override
set move shape
Definition: GNEPOI.cpp:691
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition: GNEPOI.cpp:227
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
method for setting the attribute and letting the object perform additional changes
Definition: GNEPOI.cpp:431
GNEPOI(SumoXMLTag tag, GNENet *net)
Constructor.
Definition: GNEPOI.cpp:45
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition: GNEPOI.cpp:249
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition: GNEPOI.cpp:137
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 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
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:662
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
GNEViewParent * getViewParent() const
get the net object
const GNEViewNetHelper::TestingMode & getTestingMode() const
get testing mode
Definition: GNEViewNet.cpp:638
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:474
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:650
GNEMoveFrame * getMoveFrame() const
get frame for move elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedSquaredShape(const GUIVisualizationSettings &s, const DottedContourType type, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
static void drawDottedContourCircle(const GUIVisualizationSettings &s, const DottedContourType type, const Position &pos, const double radius, const double exaggeration)
draw dotted contour for the given Position and radius (used by Juctions and POIs)
The popup menu of a globject.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:141
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
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
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static bool checkDraw(const GUIVisualizationSettings &s, const GUIGlObject *o)
check if POI can be drawn
static void drawInnerPOI(const GUIVisualizationSettings &s, const PointOfInterest *POI, const GUIGlObject *o, const bool disableSelectionColor, const double layer, const double width, const double height)
draw inner POI (before pushName() )
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
static void clearTextures()
clears loaded textures
Stores the information about how to visualize structures.
bool drawBoundaries
enable or disable draw boundaries
GUIVisualizationSizeSettings poiSize
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
std::string myID
The name of the object.
Definition: Named.h:125
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
C++ TraCI client API implementation.
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.
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-of-interest.
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
bool getFriendlyPos() const
returns friendly position
void setHeight(double height)
set the image height of the POI
void setFriendlyPos(const bool friendlyPos)
set friendly position
double myPosLat
latereal position over lane in which this POI is placed (main used by netedit)
void setWidth(double width)
set the image width of the POI
double getHeight() const
Returns the image height of the POI.
bool myFriendlyPos
friendlyPos enable or disable friendly position for position over lane
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
double myPosOverLane
position over lane in which this POI is placed (main used by netedit)
double getWidth() const
Returns the image width of the POI.
void writeXML(OutputDevice &out, const bool geo=false, const double zOffset=0., const std::string laneID="", const double pos=0., const bool friendlyPos=false, const double posLat=0.) const
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Position()
default constructor
Definition: Position.h:40
void set(double x, double y)
set positions x and y
Definition: Position.h:85
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
void add(double xoff, double yoff, double zoff)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
static const RGBColor ORANGE
Definition: RGBColor.h:191
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
const std::string getShapeName() const
Returns the name of the Shape.
Definition: Shape.h:110
static const double DEFAULT_LAYER_POI
Definition: Shape.h:45
void setShapeName(const std::string &name)
Sets a new shape name.
Definition: Shape.h:169
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:150
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:117
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:77
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:129
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:176
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:157
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:164
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:136
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:91
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:105
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:84
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:98
bool showShapes() const
check if shapes has to be drawn
bool showShapes() const
check if shapes has to be drawn
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool isTestingEnabled() const
check if testing mode is enabled
static const double additionalGeometryPointRadius
moving additional geometry point radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values