Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEPOI.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// 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>
38
39#include "GNEPOI.h"
41
42
43// ===========================================================================
44// method definitions
45// ===========================================================================
46
48 PointOfInterest("", "", RGBColor::BLACK, Position(0, 0), false, "", 0, false, 0, 0, 0, "", false, 0, 0, "", Parameterised::Map()),
49 GNEAdditional("", net, GLO_POI, tag, GUIIconSubSys::getIcon(GUIIcon::POI), "", {}, {}, {}, {}, {}, {}) {
50 // reset default values
51 resetDefaultValues();
52}
53
54
55GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, const double xLon,
56 const double yLat, const bool geo, const double layer, const double angle, const std::string& imgFile,
57 const bool relativePath, const double width, const double height, const std::string& name,
58 const Parameterised::Map& parameters) :
59 PointOfInterest(id, type, color, Position(xLon, yLat), geo, "", 0, false, 0, layer, angle, imgFile, relativePath, width, height, name, parameters),
61 "", {}, {}, {}, {}, {}, {}) {
62 // update position depending of GEO
63 if (geo) {
64 Position cartesian(x(), y());
66 set(cartesian.x(), cartesian.y());
67 }
68 // update centering boundary without updating grid
69 updateCenteringBoundary(false);
70}
71
72
73GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
74 const bool friendlyPos, const double posLat, const double layer, const double angle, const std::string& imgFile, const bool relativePath, const double width,
75 const double height, const std::string& name, const Parameterised::Map& parameters) :
76 PointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, friendlyPos, posLat, layer, angle, imgFile, relativePath, width, height, name, parameters),
77 GNEAdditional(id, net, GLO_POI, GNE_TAG_POILANE, GUIIconSubSys::getIcon(GUIIcon::POILANE), "", {}, {}, {lane}, {}, {}, {}) {
78 // update geometry (needed for POILanes)
79 updateGeometry();
80 // update centering boundary without updating grid
81 updateCenteringBoundary(false);
82}
83
84
86
87
93 // get snap radius
95 // get mouse position
96 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
97 // check if we're editing width or height
98 if ((myShapeWidth.size() == 0) || (myShapeHeight.size() == 0)) {
99 return nullptr;
100 } else if (myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
101 // edit height
103 } else if (myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
104 // edit height
106 } else if (myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
107 // edit width
109 } else if (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
110 // edit width
112 } else {
113 return nullptr;
114 }
115 } else if (getTagProperty().getTag() == GNE_TAG_POILANE) {
116 // return move operation for POI placed over lane
117 return new GNEMoveOperation(this, getParentLanes().front(), myPosOverLane,
119 } else {
120 // return move operation for a position in view
121 return new GNEMoveOperation(this, *this);
122 }
123}
124
125
126void
127GNEPOI::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
128 // nothing to remove
129}
130
131
132std::string
134 return "";
135}
136
137
141 POIBaseObject->setTag(SUMO_TAG_POI);
142 // fill attributes
143 POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
153 return POIBaseObject;
154}
155
156
157void
159 if (getParentLanes().size() > 0) {
160 // obtain fixed position over lane
161 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShape().length() ? getParentLanes().at(0)->getLaneShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
162 // write POILane using POI::writeXML
163 writeXML(device, false, 0, getParentLanes().at(0)->getID(), fixedPositionOverLane, myFriendlyPos, myPosLat);
164 } else {
165 writeXML(device, myGeo);
166 }
167}
168
169
170bool
172 // only for POIS over lanes
173 if (getParentLanes().size() == 0) {
174 return true;
175 } else if (getFriendlyPos()) {
176 // with friendly position enabled position is "always fixed"
177 return true;
178 } else {
179 return fabs(myPosOverLane) <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
180 }
181}
182
183
184std::string
186 // only for POIS over lanes
187 if (getParentLanes().size() > 0) {
188 // obtain final length
189 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
190 // check if detector has a problem
192 return "";
193 } else {
194 // declare variable for error position
195 std::string errorPosition;
196 // check positions over lane
197 if (myPosOverLane < 0) {
198 errorPosition = (toString(SUMO_ATTR_POSITION) + " < 0");
199 }
200 if (myPosOverLane > len) {
201 errorPosition = (toString(SUMO_ATTR_POSITION) + TL(" > lanes's length"));
202 }
203 return errorPosition;
204 }
205 } else {
206 return "";
207 }
208}
209
210
211void
213 // only for POIS over lanes
214 if (getParentLanes().size() > 0) {
215 // declare new position
216 double newPositionOverLane = myPosOverLane;
217 // declare new lenght (but unsed in this context)
218 double length = 0;
219 // fix pos and length with fixLanePosition
220 GNEAdditionalHandler::fixLanePosition(newPositionOverLane, length, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
221 // set new position
223 }
224}
225
226
227void
229 // set position
230 if (getParentLanes().size() > 0) {
231 // obtain fixed position over lane
232 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShapeLength() ? getParentLanes().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
233 // set new position regarding to lane
234 set(getParentLanes().at(0)->getLaneShape().positionAtOffset(fixedPositionOverLane * getParentLanes().at(0)->getLengthGeometryFactor(), -myPosLat));
235 }
236 // check if update width and height shapes
237 if ((getWidth() > 0) && (getHeight() > 0)) {
238 // calculate shape length
239 myShapeHeight.clear();
240 myShapeHeight.push_back(Position(0, getHeight() * -0.5));
241 myShapeHeight.push_back(Position(0, getHeight() * 0.5));
242 // move
243 myShapeHeight.add(*this);
244 // calculate shape width
245 PositionVector leftShape = myShapeHeight;
246 leftShape.move2side(getWidth() * -0.5);
247 PositionVector rightShape = myShapeHeight;
248 rightShape.move2side(getWidth() * 0.5);
249 myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
250 }
251}
252
253
256 return *this;
257}
258
259
260double
262 return s.poiSize.getExaggeration(s, this);
263}
264
265
266void
267GNEPOI::updateCenteringBoundary(const bool updateGrid) {
268 // Remove object from net
269 if (updateGrid) {
271 }
272 // reset boundary
274 // add position (this POI)
276 // grow boundary
277 myAdditionalBoundary.grow(10 + std::max(getWidth() * 0.5, getHeight() * 0.5));
278 // add object into net
279 if (updateGrid) {
281 }
282}
283
284
285void
286GNEPOI::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
287 // nothing to split
288}
289
290
293 return GUIGlObject::getGlID();
294}
295
296
297std::string
299 if (getParentLanes().size() > 0) {
300 return getParentLanes().front()->getID();
301 } else {
302 return myNet->getMicrosimID();
303 }
304}
305
306
309 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
310 buildPopupHeader(ret, app);
313 // build selection and show parameters menu
316 // continue depending of lane number
317 if (getParentLanes().size() > 0) {
318 // add option for convert to GNEPOI
320 return ret;
321 } else {
322 // add option for convert to GNEPOI
324 }
325 return ret;
326}
327
328
329void
331 // first check if POI can be drawn
333 // check if boundary has to be drawn
334 if (s.drawBoundaries) {
336 }
337 // check if POI can be drawn
338 if (GUIPointOfInterest::checkDraw(s, this)) {
339 // obtain POIExaggeration
340 const double POIExaggeration = getExaggeration(s);
341 // push name (needed for getGUIGlObjectsUnderCursor(...)
343 // draw inner polygon
344 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
347 } else {
350 }
351 // draw an orange square mode if there is an image(see #4036)
352 if (!getShapeImgFile().empty() && OptionsCont::getOptions().getBool("gui-testing")) {
353 // Add a draw matrix for drawing logo
355 glTranslated(x(), y(), getType() + 0.01);
357 GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
359 }
360 // draw geometry points
365 // pop name
367 // draw lock icon
369 // check if mouse is over element
370 if (getShapeImgFile().empty()) {
371 mouseWithinGeometry(*this, 1.3);
372 } else {
373 mouseWithinGeometry(*this, getHeight() * 0.5, getWidth() * 0.5, 0, 0, getShapeNaviDegree());
374 }
375 // inspect contour
377 if (getShapeImgFile().empty()) {
379 } else {
381 }
382 }
383 // front element contour
384 if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
385 if (getShapeImgFile().empty()) {
387 } else {
389 }
390 }
391 // delete contour
392 if (myNet->getViewNet()->drawDeleteContour(this, this)) {
393 if (getShapeImgFile().empty()) {
395 } else {
397 }
398 }
399 // select contour
400 if (myNet->getViewNet()->drawSelectContour(this, this)) {
401 if (getShapeImgFile().empty()) {
403 } else {
405 }
406 }
407 }
408 }
409}
410
411
412std::string
414 switch (key) {
415 case SUMO_ATTR_ID:
416 return myID;
417 case SUMO_ATTR_COLOR:
418 return toString(getShapeColor());
419 case SUMO_ATTR_LANE:
420 return myLane;
422 if (getParentLanes().size() > 0) {
423 return toString(myPosOverLane);
424 } else {
425 return toString(*this);
426 }
428 return toString(getFriendlyPos());
430 return toString(myPosLat);
431 case SUMO_ATTR_LON: {
432 // calculate geo position
433 Position GEOPosition(x(), y());
435 // return lon
436 return toString(GEOPosition.x(), 8);
437 }
438 case SUMO_ATTR_LAT: {
439 // calculate geo position
440 Position GEOPosition(x(), y());
442 // return lat
443 return toString(GEOPosition.y(), 8);
444 }
445 case SUMO_ATTR_TYPE:
446 return getShapeType();
447 case SUMO_ATTR_LAYER:
449 return "default";
450 } else {
451 return toString(getShapeLayer());
452 }
454 return getShapeImgFile();
457 case SUMO_ATTR_WIDTH:
458 return toString(getWidth());
459 case SUMO_ATTR_HEIGHT:
460 return toString(getHeight());
461 case SUMO_ATTR_ANGLE:
463 case SUMO_ATTR_NAME:
464 return getShapeName();
470 return "";
471 default:
472 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
473 }
474}
475
476
477double
479 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
480}
481
482
487
488
489void
490GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
491 switch (key) {
492 case SUMO_ATTR_ID:
493 case SUMO_ATTR_COLOR:
494 case SUMO_ATTR_LANE:
498 case SUMO_ATTR_LON:
499 case SUMO_ATTR_LAT:
500 case SUMO_ATTR_TYPE:
501 case SUMO_ATTR_LAYER:
504 case SUMO_ATTR_WIDTH:
505 case SUMO_ATTR_HEIGHT:
506 case SUMO_ATTR_ANGLE:
507 case SUMO_ATTR_NAME:
511 undoList->changeAttribute(new GNEChange_Attribute(this, key, value));
512 break;
513 default:
514 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
515 }
516}
517
518
519bool
520GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
521 switch (key) {
522 case SUMO_ATTR_ID:
524 if (value == getID()) {
525 return true;
526 } else {
527 return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_POI, value, false) == nullptr) &&
528 (myNet->getAttributeCarriers()->retrieveAdditional(GNE_TAG_POILANE, value, false) == nullptr) &&
529 (myNet->getAttributeCarriers()->retrieveAdditional(GNE_TAG_POIGEO, value, false) == nullptr);
530 }
531 } else {
532 // invalid id
533 return false;
534 }
535 case SUMO_ATTR_COLOR:
536 return canParse<RGBColor>(value);
537 case SUMO_ATTR_LANE:
538 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
540 if (getParentLanes().size() > 0) {
541 return canParse<double>(value);
542 } else {
543 return canParse<Position>(value);
544 }
546 return canParse<bool>(value);
548 return canParse<double>(value);
549 case SUMO_ATTR_LON:
550 return canParse<double>(value);
551 case SUMO_ATTR_LAT:
552 return canParse<double>(value);
553 case SUMO_ATTR_TYPE:
554 return true;
555 case SUMO_ATTR_LAYER:
556 if (value == "default") {
557 return true;
558 } else {
559 return canParse<double>(value);
560 }
562 if (value == "") {
563 return true;
564 } else {
565 // check that image can be loaded
566 return GUITexturesHelper::getTextureID(value) != -1;
567 }
569 return canParse<bool>(value);
570 case SUMO_ATTR_WIDTH:
571 return canParse<double>(value) && (parse<double>(value) > 0);
572 case SUMO_ATTR_HEIGHT:
573 return canParse<double>(value) && (parse<double>(value) > 0);
574 case SUMO_ATTR_ANGLE:
575 return canParse<double>(value);
576 case SUMO_ATTR_NAME:
579 return canParse<bool>(value);
581 return areParametersValid(value);
582 default:
583 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
584 }
585}
586
587
588bool
590 // check if we're in supermode Network
592 return true;
593 } else {
594 return false;
595 }
596}
597
598
599std::string
601 return getTagStr() + ": " + getID();
602}
603
604
605std::string
607 return getTagStr();
608}
609
610// ===========================================================================
611// private
612// ===========================================================================
613
614void
615GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
616 switch (key) {
617 case SUMO_ATTR_ID: {
618 // update microsimID
619 setMicrosimID(value);
620 // set named ID
621 myID = value;
622 break;
623 }
624 case SUMO_ATTR_COLOR:
625 setShapeColor(parse<RGBColor>(value));
626 break;
627 case SUMO_ATTR_LANE:
628 myLane = value;
630 break;
631 case SUMO_ATTR_POSITION: {
632 if (getParentLanes().size() > 0) {
633 if (canParse<double>(value)) {
634 myPosOverLane = parse<double>(value);
635 }
636 } else {
637 // set position
638 set(parse<Position>(value));
639 }
640 // update centering boundary
642 // update geometry
644 break;
645 }
647 setFriendlyPos(parse<bool>(value));
648 break;
650 myPosLat = parse<double>(value);
651 // update centering boundary
653 // update geometry
655 break;
656 case SUMO_ATTR_LON: {
657 // calculate cartesian
658 Position cartesian(parse<double>(value), parse<double>(getAttribute(SUMO_ATTR_LAT)));
660 // set cartesian
661 set(cartesian);
662 // update centering boundary
664 // update geometry
666 break;
667 }
668 case SUMO_ATTR_LAT: {
669 // calculate cartesian
670 Position cartesian(parse<double>(getAttribute(SUMO_ATTR_LON)), parse<double>(value));
672 // set cartesian
673 set(cartesian);
674 // update centering boundary
676 // update geometry
678 break;
679 }
680 case SUMO_ATTR_TYPE:
681 setShapeType(value);
682 break;
683 case SUMO_ATTR_LAYER:
684 if (value == "default") {
686 } else {
687 setShapeLayer(parse<double>(value));
688 }
689 break;
691 // first remove object from grid due img file affect to boundary
692 if (getID().size() > 0) {
694 }
695 setShapeImgFile(value);
696 // all textures must be refresh
698 // add object into grid again
699 if (getID().size() > 0) {
701 }
702 break;
704 setShapeRelativePath(parse<bool>(value));
705 break;
706 case SUMO_ATTR_WIDTH:
707 // set new width
708 setWidth(parse<double>(value));
709 // update centering boundary and geometry (except for templates)
710 if (getID().size() > 0) {
713 }
714 break;
715 case SUMO_ATTR_HEIGHT:
716 // set new height
717 setHeight(parse<double>(value));
718 // update centering boundary and geometry (except for templates)
719 if (getID().size() > 0) {
722 }
723 break;
724 case SUMO_ATTR_ANGLE:
725 setShapeNaviDegree(parse<double>(value));
726 break;
727 case SUMO_ATTR_NAME:
728 setShapeName(value);
729 break;
731 if (parse<bool>(value)) {
733 } else {
735 }
736 break;
739 break;
742 break;
743 default:
744 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
745 }
746}
747
748
749void
751 // check what are being updated
753 myShapeHeight = moveResult.shapeToUpdate;
754 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
755 myShapeWidth = moveResult.shapeToUpdate;
756 } else {
757 if (getTagProperty().getTag() == GNE_TAG_POILANE) {
758 myPosOverLane = moveResult.newFirstPos;
759 } else {
760 set(moveResult.shapeToUpdate.front());
761 }
762 // update geometry
764 }
765}
766
767
768void
769GNEPOI::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
770 // check what are being updated
772 undoList->begin(myTagProperty.getGUIIcon(), "height of " + getTagStr());
774 undoList->end();
775 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
776 undoList->begin(myTagProperty.getGUIIcon(), "width of " + getTagStr());
778 undoList->end();
779 } else {
780 undoList->begin(GUIIcon::POI, "position of " + getTagStr());
781 if (getTagProperty().getTag() == GNE_TAG_POILANE) {
783 } else {
784 undoList->changeAttribute(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(moveResult.shapeToUpdate.front())));
785 }
786 undoList->end();
787 }
788}
789
790/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
unsigned int GUIGlID
Definition GUIGlObject.h:43
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_POI
a poi
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
#define TL(string)
Definition MsgHandler.h:287
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.
@ 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:897
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
static bool checkLanePosition(double pos, const double length, const double laneLength, const bool friendlyPos)
check if the given position over a lane is valid
static void fixLanePosition(double &pos, double &length, const double laneLength)
fix given position over lane
An Element which don't belong to GNENet but has influence in the simulation.
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:1248
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1260
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:120
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2030
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their correspond attribute are valids
Definition GNEPOI.cpp:520
Position getPositionInView() const override
Returns position of shape in view.
Definition GNEPOI.cpp:255
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEPOI.cpp:600
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEPOI.cpp:330
const Parameterised::Map & getACParametersMap() const override
get parameters map
Definition GNEPOI.cpp:484
PositionVector myShapeWidth
shape width of POI
Definition GNEPOI.h:224
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList) override
commit move shape
Definition GNEPOI.cpp:769
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNEPOI.cpp:267
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEPOI.cpp:606
std::string getParentName() const override
Returns the name of the parent object.
Definition GNEPOI.cpp:298
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:212
std::string getAttribute(SumoXMLAttr key) const override
method for getting the Attribute of an XML key
Definition GNEPOI.cpp:413
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNEPOI.cpp:261
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition GNEPOI.cpp:292
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:185
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:85
GNEMoveOperation * getMoveOperation() override
get move operation
Definition GNEPOI.cpp:89
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition GNEPOI.cpp:589
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList) override
remove geometry point in the clicked position
Definition GNEPOI.cpp:127
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEPOI.cpp:478
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition GNEPOI.cpp:133
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNEPOI.cpp:158
void updateGeometry() override
update pre-computed geometry information
Definition GNEPOI.cpp:228
PositionVector myShapeHeight
shape height of POI
Definition GNEPOI.h:227
void setMoveShape(const GNEMoveResult &moveResult) override
set move shape
Definition GNEPOI.cpp:750
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEPOI.cpp:286
bool isAdditionalValid() const override
check if current additional is valid to be writed into XML (must be reimplemented in all detector chi...
Definition GNEPOI.cpp:171
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:490
GNEPOI(SumoXMLTag tag, GNENet *net)
Constructor.
Definition GNEPOI.cpp:47
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition GNEPOI.cpp:308
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition GNEPOI.cpp:139
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
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
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
GNEUndoList * getUndoList() const
get the undoList object
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
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
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.
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 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.
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.
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 OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
C++ TraCI client API implementation.
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.
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
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