Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A class for visualizing and editing POIS in netedit (adapted from
19// GUIPointOfInterest and NLHandler)
20/****************************************************************************/
21#include <config.h>
22
23#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
39
40#include "GNEPOI.h"
42
43// ===========================================================================
44// method definitions
45// ===========================================================================
46
48 PointOfInterest("", "", RGBColor::BLACK, Position(0, 0), false, "", 0, false, 0, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE),
49 0, 0, "", 0, 0, "", Parameterised::Map()),
50 GNEAdditional("", net, "", tag, "") {
51}
52
53
54GNEPOI::GNEPOI(const std::string& id, GNENet* net, const std::string& filename, const std::string& type, const RGBColor& color, const double xLon, const double yLat,
55 const bool geo, const std::string& icon, const double layer, const double angle, const std::string& imgFile, const double width, const double height,
56 const std::string& name, const Parameterised::Map& parameters) :
57 PointOfInterest(id, type, color, Position(xLon, yLat), geo, "", 0, false, 0, icon, layer, angle, imgFile, width, height, name, parameters),
58 GNEAdditional(id, net, filename, geo ? GNE_TAG_POIGEO : SUMO_TAG_POI, "") {
59 // update position depending of GEO
60 if (geo) {
61 Position cartesian(x(), y());
63 set(cartesian.x(), cartesian.y());
64 }
65 // update geometry (needed for adjust myShapeWidth and myShapeHeight)
67 // update centering boundary without updating grid
69}
70
71
72GNEPOI::GNEPOI(const std::string& id, GNENet* net, const std::string& filename, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
73 const bool friendlyPos, const double posLat, const std::string& icon, const double layer, const double angle, const std::string& imgFile, const double width,
74 const double height, const std::string& name, const Parameterised::Map& parameters) :
75 PointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, friendlyPos, posLat, icon, layer, angle, imgFile, width, height, name, parameters),
76 GNEAdditional(id, net, filename, GNE_TAG_POILANE, "") {
77 // set parents
78 setParent<GNELane*>(lane);
79 // update geometry (needed for adjust myShapeWidth and myShapeHeight)
81 // update centering boundary without updating grid
83}
84
85
87
88
94 // get snap radius
96 const double snapRadiusSquared = snapRadius * snapRadius;
97 // get mouse position
98 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
99 // check if we're editing width or height
100 if ((myShapeWidth.size() == 0) || (myShapeHeight.size() == 0)) {
101 return nullptr;
102 } else if (myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
103 // edit height
105 } else if (myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
106 // edit height
108 } else if (myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
109 // edit width
111 } else if (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
112 // edit width
114 } else {
115 return nullptr;
116 }
117 } else if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
118 // return move operation for POI placed over lane
119 return new GNEMoveOperation(this, getParentLanes().front(), myPosOverLane,
121 } else {
122 // return move operation for a position in view
123 return new GNEMoveOperation(this, *this);
124 }
125}
126
127
128void
129GNEPOI::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
130 // nothing to remove
131}
132
133
134std::string
136 return "";
137}
138
139
143 POIBaseObject->setTag(SUMO_TAG_POI);
144 // fill attributes
145 POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
155 return POIBaseObject;
156}
157
158
159void
161 if (getParentLanes().size() > 0) {
162 // obtain fixed position over lane
163 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShape().length() ? getParentLanes().at(0)->getLaneShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
164 // write POILane using POI::writeXML
165 writeXML(device, false, 0, getParentLanes().at(0)->getID(), fixedPositionOverLane, myFriendlyPos, myPosLat);
166 } else {
167 writeXML(device, myGeo);
168 }
169}
170
171
172bool
174 // only for POIS over lanes
175 if (getParentLanes().size() == 0) {
176 return true;
177 } else if (getFriendlyPos()) {
178 // with friendly position enabled position is "always fixed"
179 return true;
180 } else {
181 return fabs(myPosOverLane) <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
182 }
183}
184
185
186std::string
188 // only for POIS over lanes
189 if (getParentLanes().size() > 0) {
190 // obtain final length
191 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
192 // check if detector has a problem
194 return "";
195 } else {
196 // declare variable for error position
197 std::string errorPosition;
198 // check positions over lane
199 if (myPosOverLane < 0) {
200 errorPosition = (toString(SUMO_ATTR_POSITION) + " < 0");
201 }
202 if (myPosOverLane > len) {
203 errorPosition = (toString(SUMO_ATTR_POSITION) + TL(" > lanes's length"));
204 }
205 return errorPosition;
206 }
207 } else {
208 return "";
209 }
210}
211
212
213void
215 // only for POIS over lanes
216 if (getParentLanes().size() > 0) {
217 // declare new position
218 double newPositionOverLane = myPosOverLane;
219 // declare new length (but unsed in this context)
220 double length = 0;
221 // fix pos and length with fixLanePosition
222 GNEAdditionalHandler::fixLanePosition(newPositionOverLane, length, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
223 // set new position
225 }
226}
227
228
229void
231 // set position
232 if (getParentLanes().size() > 0) {
233 // obtain fixed position over lane
234 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShapeLength() ? getParentLanes().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
235 // set new position regarding to lane
236 set(getParentLanes().at(0)->getLaneShape().positionAtOffset(fixedPositionOverLane * getParentLanes().at(0)->getLengthGeometryFactor(), -myPosLat));
237 }
238 // check if update width and height shapes
239 if ((getWidth() > 0) && (getHeight() > 0)) {
240 // calculate shape length
241 myShapeHeight.clear();
242 myShapeHeight.push_back(Position(0, getHeight() * -0.5));
243 myShapeHeight.push_back(Position(0, getHeight() * 0.5));
244 // move
245 myShapeHeight.add(*this);
246 // calculate shape width
247 PositionVector leftShape = myShapeHeight;
248 leftShape.move2side(getWidth() * -0.5);
249 PositionVector rightShape = myShapeHeight;
250 rightShape.move2side(getWidth() * 0.5);
251 myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
252 }
253}
254
255
258 return *this;
259}
260
261
262double
264 return s.poiSize.getExaggeration(s, this);
265}
266
267
268void
269GNEPOI::updateCenteringBoundary(const bool updateGrid) {
270 // Remove object from net
271 if (updateGrid) {
273 }
274 // reset boundary
276 // add position (this POI)
278 // grow boundary
279 myAdditionalBoundary.grow(5 + std::max(getWidth() * 0.5, getHeight() * 0.5));
280 // add object into net
281 if (updateGrid) {
283 }
284}
285
286
287void
288GNEPOI::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
289 // nothing to split
290}
291
292
295 return GUIGlObject::getGlID();
296}
297
298
299bool
301 // get edit modes
302 const auto& editModes = myNet->getViewNet()->getEditModes();
303 // check if we're in move mode
304 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
306 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
307 // only move the first element
309 } else {
310 return false;
311 }
312}
313
314
315std::string
317 if (getParentLanes().size() > 0) {
318 return getParentLanes().front()->getID();
319 } else {
320 return myNet->getMicrosimID();
321 }
322}
323
324
327 // create popup
328 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
329 // build common options
331 // specific of non juPedSim polygons
333 // continue depending of lane number
334 if (getParentLanes().size() > 0) {
335 // add option for convert to GNEPOI
337 return ret;
338 } else {
339 // add option for convert to GNEPOI
341 }
342 }
343 return ret;
344}
345
346
347void
349 // first check if POI can be drawn
352 // draw boundaries
354 // obtain POIExaggeration
355 const double POIExaggeration = getExaggeration(s);
356 // get detail level
357 const auto d = s.getDetailLevel(POIExaggeration);
358 // check if draw moving geometry points (only if we have a defined image
359 const bool movingGeometryPoints = getShapeImgFile().empty() ? false : drawMovingGeometryPoints(false);
360 // draw geometry only if we'rent in drawForObjectUnderCursor mode
362 // draw POI
363 drawPOI(s, d, movingGeometryPoints);
364 // draw lock icon
366 // draw dotted contours
367 if (movingGeometryPoints) {
368 // get snap radius
370 const double snapRadiusSquared = snapRadius * snapRadius;
371 // get mouse position
372 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
373 // check if we're editing width or height
374 if ((myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
375 (myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
378 } else if ((myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
379 (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
382 }
383 } else {
385 }
386 }
387 // calculate contour
388 calculatePOIContour(s, d, POIExaggeration, movingGeometryPoints);
389 }
390}
391
392
393std::string
395 switch (key) {
396 case SUMO_ATTR_ID:
397 return myID;
398 case SUMO_ATTR_COLOR:
399 return toString(getShapeColor());
400 case SUMO_ATTR_LANE:
401 return myLane;
403 if (getParentLanes().size() > 0) {
404 return toString(myPosOverLane);
405 } else {
406 return toString(*this);
407 }
409 return toString(getFriendlyPos());
411 return toString(myPosLat);
412 case SUMO_ATTR_LON:
413 if (GeoConvHelper::getFinal().getProjString() != "!") {
414 // calculate geo position
415 Position GEOPosition(x(), y());
417 // return lon
418 return toString(GEOPosition.x(), 8);
419 } else {
420 return TL("No geo-conversion defined");
421 }
422 case SUMO_ATTR_LAT:
423 if (GeoConvHelper::getFinal().getProjString() != "!") {
424 // calculate geo position
425 Position GEOPosition(x(), y());
427 // return lat
428 return toString(GEOPosition.y(), 8);
429 } else {
430 return TL("No geo-conversion defined");
431 }
432 case SUMO_ATTR_TYPE:
433 return getShapeType();
434 case SUMO_ATTR_ICON:
435 return getIconStr();
436 case SUMO_ATTR_LAYER:
437 return toString(getShapeLayer());
439 return getShapeImgFile();
440 case SUMO_ATTR_WIDTH:
441 return toString(getWidth());
442 case SUMO_ATTR_HEIGHT:
443 return toString(getHeight());
444 case SUMO_ATTR_ANGLE:
446 case SUMO_ATTR_NAME:
447 return getShapeName();
449 return "";
450 default:
451 return getCommonAttribute(this, key);
452 }
453}
454
455
456double
458 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
459}
460
461
466
467
468void
469GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
470 switch (key) {
471 case SUMO_ATTR_ID:
472 case SUMO_ATTR_COLOR:
473 case SUMO_ATTR_LANE:
477 case SUMO_ATTR_LON:
478 case SUMO_ATTR_LAT:
479 case SUMO_ATTR_TYPE:
480 case SUMO_ATTR_ICON:
481 case SUMO_ATTR_LAYER:
483 case SUMO_ATTR_WIDTH:
484 case SUMO_ATTR_HEIGHT:
485 case SUMO_ATTR_ANGLE:
486 case SUMO_ATTR_NAME:
488 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
489 break;
490 default:
491 setCommonAttribute(key, value, undoList);
492 break;
493 }
494}
495
496
497bool
498GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
499 switch (key) {
500 case SUMO_ATTR_ID:
502 case SUMO_ATTR_COLOR:
503 return canParse<RGBColor>(value);
504 case SUMO_ATTR_LANE:
505 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
507 if (getParentLanes().size() > 0) {
508 return canParse<double>(value);
509 } else {
510 return canParse<Position>(value);
511 }
513 return canParse<bool>(value);
515 return canParse<double>(value);
516 case SUMO_ATTR_LON:
517 return canParse<double>(value);
518 case SUMO_ATTR_LAT:
519 return canParse<double>(value);
520 case SUMO_ATTR_TYPE:
521 return true;
522 case SUMO_ATTR_ICON:
524 case SUMO_ATTR_LAYER:
525 if (value.empty()) {
526 return true;
527 } else {
528 return canParse<double>(value);
529 }
531 if (value == "") {
532 return true;
533 } else {
534 // check that image can be loaded
535 return GUITexturesHelper::getTextureID(value) != -1;
536 }
537 case SUMO_ATTR_WIDTH:
538 return canParse<double>(value) && (parse<double>(value) > 0);
539 case SUMO_ATTR_HEIGHT:
540 return canParse<double>(value) && (parse<double>(value) > 0);
541 case SUMO_ATTR_ANGLE:
542 return canParse<double>(value);
543 case SUMO_ATTR_NAME:
545 default:
546 return isCommonValid(key, value);
547 }
548}
549
550
551bool
553 switch (key) {
556 return (GeoConvHelper::getFinal().getProjString() != "!");
557 } else {
558 return true;
559 }
560 case SUMO_ATTR_LON:
561 case SUMO_ATTR_LAT:
562 return (GeoConvHelper::getFinal().getProjString() != "!");
563 default:
564 return true;
565 }
566}
567
568
569std::string
571 return getTagStr() + ": " + getID();
572}
573
574
575std::string
577 return getTagStr();
578}
579
580// ===========================================================================
581// private
582// ===========================================================================
583
584void
586 const bool movingGeometryPoints) const {
587 if (GUIPointOfInterest::checkDraw(s, this)) {
588 // draw inner polygon
589 if (myDrawInFront) {
592 } else {
595 }
596 // draw geometry points
597 if (movingGeometryPoints) {
598 if (myShapeHeight.size() > 0) {
601 }
602 if (myShapeWidth.size() > 0) {
605 }
606 }
607 }
608}
609
610
611void
613 const double exaggeration, const bool movingGeometryPoints) const {
614 // check if we're calculating the contour or the moving geometry points
615 if (movingGeometryPoints) {
617 getShapeLayer(), exaggeration, nullptr);
619 getShapeLayer(), exaggeration, nullptr);
621 getShapeLayer(), exaggeration, nullptr);
623 getShapeLayer(), exaggeration, nullptr);
624 } else {
625 const auto parentEdgeBoundary = (getParentLanes().size() > 0) ? getParentLanes().front()->getParentEdge() : nullptr;
626 if (getShapeImgFile().empty()) {
627 const double radius = getWidth() > getHeight() ? getWidth() : getHeight();
628 myAdditionalContour.calculateContourCircleShape(s, d, this, *this, radius * 0.5, getShapeLayer(), exaggeration, parentEdgeBoundary);
629 } else {
630 myAdditionalContour.calculateContourRectangleShape(s, d, this, *this, getHeight() * 0.5, getWidth() * 0.5, getShapeLayer(), 0, 0, getShapeNaviDegree(), exaggeration, parentEdgeBoundary);
631 }
632 }
633}
634
635
636void
637GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
638 switch (key) {
639 case SUMO_ATTR_ID: {
640 // update microsimID
641 setAdditionalID(value);
642 // set named ID
643 myID = value;
644 break;
645 }
646 case SUMO_ATTR_COLOR:
647 setShapeColor(parse<RGBColor>(value));
648 break;
649 case SUMO_ATTR_LANE:
650 myLane = value;
652 break;
653 case SUMO_ATTR_POSITION: {
655 myPosOverLane = parse<double>(value);
656 } else {
657 // set position
658 set(parse<Position>(value));
659 }
660 // update centering boundary
662 // update geometry
664 break;
665 }
667 setFriendlyPos(parse<bool>(value));
668 break;
670 myPosLat = parse<double>(value);
671 // update centering boundary
673 // update geometry
675 break;
676 case SUMO_ATTR_LON: {
677 // calculate cartesian
678 Position cartesian(parse<double>(value), parse<double>(getAttribute(SUMO_ATTR_LAT)));
680 // set cartesian
681 set(cartesian);
682 // update centering boundary
684 // update geometry
686 break;
687 }
688 case SUMO_ATTR_LAT: {
689 // calculate cartesian
690 Position cartesian(parse<double>(getAttribute(SUMO_ATTR_LON)), parse<double>(value));
692 // set cartesian
693 set(cartesian);
694 // update centering boundary
696 // update geometry
698 break;
699 }
700 case SUMO_ATTR_TYPE:
701 setShapeType(value);
702 break;
703 case SUMO_ATTR_ICON:
704 setIcon(value);
705 break;
706 case SUMO_ATTR_LAYER:
707 if (value.empty()) {
709 } else {
710 setShapeLayer(parse<double>(value));
711 }
712 break;
714 // first remove object from grid due img file affect to boundary
715 if (getID().size() > 0) {
717 }
718 setShapeImgFile(value);
719 // all textures must be refresh
721 // add object into grid again
722 if (getID().size() > 0) {
724 }
725 break;
726 case SUMO_ATTR_WIDTH:
727 // set new width
728 setWidth(parse<double>(value));
729 // update centering boundary and geometry (except for templates)
730 if (getID().size() > 0) {
733 }
734 break;
735 case SUMO_ATTR_HEIGHT:
736 // set new height
737 setHeight(parse<double>(value));
738 // update centering boundary and geometry (except for templates)
739 if (getID().size() > 0) {
742 }
743 break;
744 case SUMO_ATTR_ANGLE:
745 setShapeNaviDegree(parse<double>(value));
746 break;
747 case SUMO_ATTR_NAME:
748 setShapeName(value);
749 break;
752 break;
753 default:
754 return setCommonAttribute(this, key, value);
755 }
756}
757
758
759void
761 // check what are being updated
763 myShapeHeight = moveResult.shapeToUpdate;
764 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
765 myShapeWidth = moveResult.shapeToUpdate;
766 } else {
767 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
768 myPosOverLane = moveResult.newFirstPos;
769 } else {
770 set(moveResult.shapeToUpdate.front());
771 }
772 // update geometry
774 }
775}
776
777
778void
779GNEPOI::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
780 // check what are being updated
782 undoList->begin(this, "height of " + getTagStr());
784 undoList->end();
785 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
786 undoList->begin(this, "width of " + getTagStr());
788 undoList->end();
789 } else {
790 undoList->begin(this, "position of " + getTagStr());
791 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
793 } else {
795 }
796 undoList->end();
797 }
798}
799
800/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
unsigned int GUIGlID
Definition GUIGlObject.h:44
@ GLO_FRONTELEMENT
front element (used in netedit)
#define TL(string)
Definition MsgHandler.h:305
POIIcon
POI icons.
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_ICON
icon
@ SUMO_ATTR_LANE
@ SUMO_ATTR_LON
@ 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)
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:75
void reset()
Resets the boundary.
Definition Boundary.cpp:63
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging)
Definition GLHelper.cpp:958
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
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void drawRightGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw right geometry point
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
void drawUpGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw up geometry point
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
bool drawMovingGeometryPoints(const bool ignoreShift) const
check if draw additional extrem geometry points
void drawDownGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw down geometry point
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid)
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool myDrawInFront
boolean to check if drawn this AC over other elements
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
std::string getCommonAttribute(const Parameterised *parameterised, SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
bool isCommonValid(SumoXMLAttr key, const std::string &value) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double layer, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (circle elements)
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double layer, const double offsetX, const double offsetY, const double rot, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (for rectangled elements)
const GNEHierarchicalContainerParents< 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
CommonMoveOptions * getCommonMoveOptions() 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
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1442
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1452
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:146
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2194
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their correspond attribute are valids
Definition GNEPOI.cpp:498
Position getPositionInView() const override
Returns position of shape in view.
Definition GNEPOI.cpp:257
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEPOI.cpp:570
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEPOI.cpp:348
const Parameterised::Map & getACParametersMap() const override
get parameters map
Definition GNEPOI.cpp:463
GNEContour myMovingContourRight
variable used for moving contour right
Definition GNEPOI.h:241
PositionVector myShapeWidth
shape width of POI
Definition GNEPOI.h:226
void drawPOI(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool movingGeometryPoints) const
draw POI
Definition GNEPOI.cpp:585
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList) override
commit move shape
Definition GNEPOI.cpp:779
void calculatePOIContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool movingGeometryPoints) const
calculate contour
Definition GNEPOI.cpp:612
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNEPOI.cpp:269
GNEContour myMovingContourLeft
variable used for moving contour left
Definition GNEPOI.h:238
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEPOI.cpp:576
std::string getParentName() const override
Returns the name of the parent object.
Definition GNEPOI.cpp:316
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:214
std::string getAttribute(SumoXMLAttr key) const override
method for getting the Attribute of an XML key
Definition GNEPOI.cpp:394
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNEPOI.cpp:263
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition GNEPOI.cpp:294
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:187
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:86
GNEMoveOperation * getMoveOperation() override
get move operation
Definition GNEPOI.cpp:90
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition GNEPOI.cpp:552
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList) override
remove geometry point in the clicked position
Definition GNEPOI.cpp:129
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEPOI.cpp:457
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition GNEPOI.cpp:135
GNEContour myMovingContourDown
variable used for moving contour down
Definition GNEPOI.h:235
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNEPOI.cpp:160
void updateGeometry() override
update pre-computed geometry information
Definition GNEPOI.cpp:230
bool checkDrawMoveContour() const override
check if draw move contour (red)
Definition GNEPOI.cpp:300
PositionVector myShapeHeight
shape height of POI
Definition GNEPOI.h:229
void setMoveShape(const GNEMoveResult &moveResult) override
set move shape
Definition GNEPOI.cpp:760
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEPOI.cpp:288
bool isAdditionalValid() const override
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
Definition GNEPOI.cpp:173
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:469
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:326
GNEContour myMovingContourUp
variable used for moving contour up
Definition GNEPOI.h:232
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition GNEPOI.cpp:141
double getDefaultDoubleValue(SumoXMLAttr attr) const
get default double value
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isJuPedSimElement() const
return true if tag correspond to a JuPedSim element
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...
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
GNEViewParent * getViewParent() const
get the net object
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
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, const bool disable=false)
build menu command
The popup menu of a globject.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, bool addSeparator=true)
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 poiUseCustomLayer
whether the rendering layer of POIs should be overriden
GUIVisualizationSizeSettings poiSize
bool checkDrawPOI(const double w, const double h, const Detail d, const bool selected) const
check if draw POI
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double poiCustomLayer
the custom layer for POIs
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 const std::vector< SumoXMLTag > POIs
POIs namespace.
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
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
lateral 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)
void setIcon(const std::string &icon)
set icon
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.
const std::string & getIconStr() const
get icon(in string format)
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
double length() const
Computes the length of the given vector.
Definition Position.h:169
Position()
default constructor
Definition Position.h:40
void set(double x, double y)
set positions x and y
Definition Position.h:82
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
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 amount
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
static const RGBColor ORANGE
Definition RGBColor.h:194
class for maintaining associations between enums and xml-strings
static StringBijection< POIIcon > POIIcons
POI icon values.
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:108
void setShapeName(const std::string &name)
Sets a new shape name.
Definition Shape.h:161
void setShapeLayer(const double layer)
Sets a new layer.
Definition Shape.h:142
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition Shape.h:75
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.h:121
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition Shape.h:149
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition Shape.h:156
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition Shape.h:128
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.h:89
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition Shape.h:103
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.h:82
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition Shape.h:96
bool hasString(const std::string &str) const
check if the given string exist
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
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, 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 segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
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