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-2026 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
19/****************************************************************************/
20
22
26#include <netedit/GNENet.h>
36
37#include "GNEPOI.h"
38
39// ===========================================================================
40// method definitions
41// ===========================================================================
42
43#ifdef _MSC_VER
44#pragma warning(push)
45#pragma warning(disable: 4355) // mask warning about "this" in initializers
46#endif
48 Shape(""),
49 GNEAdditional(net, tag),
50 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
51 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, (tag == GNE_TAG_POIGEO) ? GNEMoveElementView::AttributesFormat::GEO : GNEMoveElementView::AttributesFormat::CARTESIAN,
52 GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT, SUMO_ATTR_POSITION, myPosOverView)) {
53}
54
55
56GNEPOI::GNEPOI(const std::string& id, GNENet* net, FileBucket* fileBucket, const std::string& type, const RGBColor& color, const Position& pos,
57 const bool geo, POIIcon icon, const double layer, const double angle, const std::string& imgFile, const double width,
58 const double height, const std::string& name, const Parameterised::Map& parameters) :
59 Shape(id, type, color, layer, angle, imgFile, ""),
60 GNEAdditional(id, net, geo ? GNE_TAG_POIGEO : SUMO_TAG_POI, fileBucket, name),
61 Parameterised(parameters),
62 myPosOverView(pos),
63 myWidth(width),
64 myHeight(height),
65 myPOIIcon(icon),
66 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
67 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, geo ? GNEMoveElementView::AttributesFormat::GEO : GNEMoveElementView::AttributesFormat::CARTESIAN,
68 GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT, SUMO_ATTR_POSITION, myPosOverView)) {
69 // update position depending of GEO
70 if (geo) {
71 Position cartesian = myPosOverView;
73 myPosOverView = cartesian;
74 }
75 // update centering boundary without updating grid
77}
78
79
80GNEPOI::GNEPOI(const std::string& id, GNENet* net, FileBucket* fileBucket, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
81 const bool friendlyPos, const double posLat, POIIcon icon, const double layer, const double angle, const std::string& imgFile, const double width,
82 const double height, const std::string& name, const Parameterised::Map& parameters) :
83 Shape(id, type, color, layer, angle, imgFile, ""),
84 GNEAdditional(id, net, GNE_TAG_POILANE, fileBucket, name),
85 Parameterised(parameters),
86 myPosOverLane(posOverLane),
87 myFriendlyPos(friendlyPos),
88 myWidth(width),
89 myHeight(height),
90 myPosLat(posLat),
91 myPOIIcon(icon),
92 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
93 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, GNEMoveElementView::AttributesFormat::POSITION, GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT,
94 SUMO_ATTR_POSITION, myPosOverView)) {
95 // set parents
96 setParent<GNELane*>(lane);
97 // update centering boundary without updating grid
99}
100#ifdef _MSC_VER
101#pragma warning(pop)
102#endif
103
104
109
110
113 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
115 } else {
117 }
118}
119
120
123 return this;
124}
125
126
127const Parameterised*
129 return this;
130}
131
132
133std::string
135 return "";
136}
137
138
142 POIBaseObject->setTag(SUMO_TAG_POI);
143 // fill attributes
144 POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
154 return POIBaseObject;
155}
156
157
158void
160 device.openTag(SUMO_TAG_POI);
161 // write common additional attributes
163 // specific of poi lanes
164 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
165 // write move attributes
167 // write specific attributes
168 if (myPosLat != 0) {
170 }
171 } else {
172 // write move attributes
174 }
175 // write shape attributes
177 // width
180 }
181 // height
184 }
185 // Icon
186 if (myPOIIcon != POIIcon::NONE) {
188 }
189 // params
190 XMLHelpers::writeParams(device, *this);
191 device.closeTag();
192}
193
194
195bool
197 // only for POIS over lanes
198 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
199 // only movement problems
201 } else {
202 return true;
203 }
204}
205
206
207std::string
209 // only for POIS over lanes
210 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
211 // only movement problems
213 } else {
214 return "";
215 }
216}
217
218
219void
221 // only for POIS over lanes
222 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
223 // only movement problems
225 }
226}
227
228
229void
231 // check if update width and height shapes
232 if ((myWidth > 0) && (myHeight > 0)) {
233 // calculate shape length
237 // move
239 // calculate shape width
241 leftShape.move2side(myWidth * -0.5);
243 rightShape.move2side(myWidth * 0.5);
244 myMoveElementViewResizable->myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
245 }
246 // set additional geometry
247 if (getParentLanes().size() > 0) {
248 myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(),
250 } else {
252 }
253}
254
255
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 // update geometry
276 // reset boundary
278 // add center
280 // add width
281 for (const auto& pos : myMoveElementViewResizable->myShapeWidth) {
283 }
284 // add height
285 for (const auto& pos : myMoveElementViewResizable->myShapeHeight) {
287 }
288 // grow boundary
290 // add object into net
291 if (updateGrid) {
293 }
294}
295
296
297void
298GNEPOI::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
299 // nothing to split
300}
301
302
305 return GUIGlObject::getGlID();
306}
307
308
309bool
311 // get edit modes
312 const auto& editModes = myNet->getViewNet()->getEditModes();
313 // check if we're in move mode
314 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
316 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
317 // only move the first element
319 } else {
320 return false;
321 }
322}
323
324
325std::string
327 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
328 return getParentLanes().front()->getID();
329 } else {
330 return myNet->getMicrosimID();
331 }
332}
333
334
337 // create popup
338 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
339 // build common options
341 // specific of non juPedSim polygons
343 // continue depending of lane number
344 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
345 // add option for convert to GNEPOI
347 } else {
348 // add option for convert to GNEPOI
350 // check if transform
351 if (GeoConvHelper::getFinal().getProjString() != "!") {
352 if (getTagProperty()->getTag() == GNE_TAG_POIGEO) {
354 } else {
356 }
357 }
358 }
359 }
360 return ret;
361}
362
363
364void
366 // first check if POI can be drawn
369 // draw boundaries
371 // obtain POIExaggeration
372 const double POIExaggeration = getExaggeration(s);
373 // get detail level
374 const auto d = s.getDetailLevel(POIExaggeration);
375 // check if draw moving geometry points (only if we have a defined image
376 const bool movingGeometryPoints = getShapeImgFile().empty() ? false : drawMovingGeometryPoints();
377 // draw geometry only if we'rent in drawForObjectUnderCursor mode
379 // draw POI
380 drawPOI(s, d, movingGeometryPoints);
381 // draw lock icon
383 // draw dotted contours
384 if (movingGeometryPoints) {
385 // get snap radius
387 const double snapRadiusSquared = snapRadius * snapRadius;
388 // get mouse position
389 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
390 // check if we're editing width or height
391 if ((myMoveElementViewResizable->myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
392 (myMoveElementViewResizable->myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
395 } else if ((myMoveElementViewResizable->myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
396 (myMoveElementViewResizable->myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
399 }
400 } else {
402 }
403 }
404 // calculate contour
405 calculatePOIContour(s, d, POIExaggeration, movingGeometryPoints);
406 }
407}
408
409
410std::string
412 switch (key) {
413 case SUMO_ATTR_ID:
414 return myID;
415 case SUMO_ATTR_COLOR:
416 return toString(getShapeColor());
418 return toString(myPosLat);
419 case SUMO_ATTR_LON:
420 if (GeoConvHelper::getFinal().getProjString() != "!") {
421 return toString(getAttributeDouble(key), 8);
422 } else {
423 return TL("No geo-conversion defined");
424 }
425 case SUMO_ATTR_LAT:
426 if (GeoConvHelper::getFinal().getProjString() != "!") {
427 return toString(getAttributeDouble(key), 8);
428 } else {
429 return TL("No geo-conversion defined");
430 }
431 case SUMO_ATTR_TYPE:
432 return getShapeType();
433 case SUMO_ATTR_ICON:
435 case SUMO_ATTR_LAYER:
436 return toString(getShapeLayer());
438 return getShapeImgFile();
439 case SUMO_ATTR_WIDTH:
440 return toString(myWidth);
441 case SUMO_ATTR_HEIGHT:
442 return toString(myHeight);
443 case SUMO_ATTR_ANGLE:
445 case SUMO_ATTR_NAME:
446 return myAdditionalName;
448 return "";
449 default:
450 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
452 } else {
454 }
455 }
456}
457
458
459double
461 switch (key) {
463 return myPosLat;
464 case SUMO_ATTR_LON:
465 if (GeoConvHelper::getFinal().getProjString() != "!") {
466 // calculate geo position
467 Position GEOPosition = myPosOverView;
469 // return lon
470 return GEOPosition.x();
471 } else {
472 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
473 }
474 case SUMO_ATTR_LAT:
475 if (GeoConvHelper::getFinal().getProjString() != "!") {
476 // calculate geo position
477 Position GEOPosition = myPosOverView;
479 // return lat
480 return GEOPosition.y();
481 } else {
482 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
483 }
484 case SUMO_ATTR_LAYER:
485 return getShapeLayer();
486 case SUMO_ATTR_WIDTH:
487 return myWidth;
488 case SUMO_ATTR_HEIGHT:
489 return myHeight;
490 case SUMO_ATTR_ANGLE:
491 return getShapeNaviDegree();
492 default:
493 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
495 } else {
497 }
498 }
499}
500
501
510
511
516
517
518void
519GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
520 switch (key) {
521 case SUMO_ATTR_ID:
522 case SUMO_ATTR_COLOR:
524 case SUMO_ATTR_LON:
525 case SUMO_ATTR_LAT:
526 case SUMO_ATTR_TYPE:
527 case SUMO_ATTR_ICON:
528 case SUMO_ATTR_LAYER:
530 case SUMO_ATTR_WIDTH:
531 case SUMO_ATTR_HEIGHT:
532 case SUMO_ATTR_ANGLE:
533 case SUMO_ATTR_NAME:
535 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
536 break;
537 default:
538 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
539 return myMoveElementLaneSingle->setMovingAttribute(key, value, undoList);
540 } else {
541 return myMoveElementViewResizable->setMovingAttribute(key, value, undoList);
542 }
543 }
544}
545
546
547bool
548GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
549 switch (key) {
550 case SUMO_ATTR_ID:
552 case SUMO_ATTR_COLOR:
553 return canParse<RGBColor>(value);
555 return canParse<double>(value);
556 case SUMO_ATTR_LON:
557 return canParse<double>(value);
558 case SUMO_ATTR_LAT:
559 return canParse<double>(value);
560 case SUMO_ATTR_TYPE:
561 return true;
562 case SUMO_ATTR_ICON:
564 case SUMO_ATTR_LAYER:
565 if (value.empty()) {
566 return true;
567 } else {
568 return canParse<double>(value);
569 }
571 if (value == "") {
572 return true;
573 } else {
574 // check that image can be loaded
575 return GUITexturesHelper::getTextureID(value) != -1;
576 }
577 case SUMO_ATTR_WIDTH:
578 return canParse<double>(value) && (parse<double>(value) > 0);
579 case SUMO_ATTR_HEIGHT:
580 return canParse<double>(value) && (parse<double>(value) > 0);
581 case SUMO_ATTR_ANGLE:
582 return canParse<double>(value);
583 case SUMO_ATTR_NAME:
584 return StringUtils::isValidAttribute(value);
585 default:
586 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
588 } else {
590 }
591 }
592}
593
594
595bool
597 switch (key) {
600 return (GeoConvHelper::getFinal().getProjString() != "!");
601 } else {
602 return true;
603 }
604 case SUMO_ATTR_LON:
605 case SUMO_ATTR_LAT:
606 return (GeoConvHelper::getFinal().getProjString() != "!");
607 default:
608 return true;
609 }
610}
611
612
613std::string
615 return getTagStr() + ": " + getID();
616}
617
618
619std::string
621 return getTagStr();
622}
623
624// ===========================================================================
625// private
626// ===========================================================================
627
628void
630 const bool movingGeometryPoints) const {
631 if (GUIPointOfInterest::checkDraw(s, this)) {
632 const double exaggeration = getExaggeration(s);
633 const auto position = getPositionInView();
634 // push matrix
636 // set POI color
638 // add extra offset z provided by icon to avoid overlapping
639 if (myDrawInFront) {
640 glTranslated(position.x(), position.y(), GLO_FRONTELEMENT + (double)myPOIIcon);
641 } else {
642 glTranslated(position.x(), position.y(), s.poiUseCustomLayer ? s.poiCustomLayer : getShapeLayer() + (double)myPOIIcon);
643 }
644 glRotated(-getShapeNaviDegree(), 0, 0, 1);
645 // check if has to be drawn as a circle or with an image
648 if (textureID > 0) {
650 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration,
651 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration);
652 } else {
653 // draw box
654 GLHelper::drawRectangle(Position(0, 0), myWidth * exaggeration, myHeight * exaggeration);
655 }
656 } else {
657 // fallback if no image is defined
658 GLHelper::drawFilledCircle(std::max(myWidth, myHeight) * 0.5 * exaggeration, s.poiDetail);
659 // check if draw polygon
660 if (myPOIIcon != POIIcon::NONE) {
661 // translate
662 glTranslated(0, 0, 0.1);
663 // rotate
664 glRotated(180, 0, 0, 1);
665 // draw texture
667 }
668 }
669 // pop matrix
672 const Position namePos = position;
673 drawName(namePos, s.scale, s.poiName, s.angle);
674 if (s.poiType.show(this)) {
675 const Position p = namePos + Position(0, -0.6 * s.poiType.size / s.scale);
677 }
678 if (s.poiText.show(this)) {
680 glTranslated(namePos.x(), namePos.y(), 0);
681 std::string value = getParameter(s.poiTextParam, "");
682 if (value != "") {
684 glRotated(-s.angle, 0, 0, 1);
685 glTranslated(0, 0.7 * s.poiText.scaledSize(s.scale) * (double)lines.size(), 0);
686 glRotated(s.angle, 0, 0, 1);
687 // FONS_ALIGN_LEFT = 1
688 // FONS_ALIGN_CENTER = 2
689 // FONS_ALIGN_MIDDLE = 16
690 const int align = (lines.size() > 1 ? 1 : 2) | 16;
691 for (std::string& line : lines) {
692 GLHelper::drawTextSettings(s.poiText, line, Position(0, 0), s.scale, s.angle, GLO_MAX, align);
693 glRotated(-s.angle, 0, 0, 1);
694 glTranslated(0, -0.7 * s.poiText.scaledSize(s.scale), 0);
695 glRotated(s.angle, 0, 0, 1);
696 }
697 }
699 }
700 }
701 // draw geometry points
702 if (movingGeometryPoints) {
706 }
710 }
711 }
712 }
713}
714
715
716void
718 const double exaggeration, const bool movingGeometryPoints) const {
719 // check if we're calculating the contour or the moving geometry points
720 if (movingGeometryPoints) {
722 getShapeLayer(), exaggeration, nullptr);
724 getShapeLayer(), exaggeration, nullptr);
726 getShapeLayer(), exaggeration, nullptr);
728 getShapeLayer(), exaggeration, nullptr);
729 } else {
730 const auto parentEdgeBoundary = (getTagProperty()->getTag() == GNE_TAG_POILANE) ? getParentLanes().front()->getParentEdge() : nullptr;
731 if (getShapeImgFile().empty()) {
732 myAdditionalContour.calculateContourCircleShape(s, d, this, getPositionInView(), std::max(myWidth, myHeight) * 0.5, getShapeLayer(), exaggeration, parentEdgeBoundary);
733 } else {
734 myAdditionalContour.calculateContourRectangleShape(s, d, this, getPositionInView(), myHeight * 0.5, myWidth * 0.5, getShapeLayer(), 0, 0, getShapeNaviDegree(), exaggeration, parentEdgeBoundary);
735 }
736 }
737}
738
739
740void
741GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
742 switch (key) {
743 case SUMO_ATTR_ID: {
744 // update microsimID
745 setAdditionalID(value);
746 // set named ID
747 myID = value;
748 break;
749 }
750 case SUMO_ATTR_COLOR:
751 setShapeColor(parse<RGBColor>(value));
752 break;
753 case SUMO_ATTR_LANE:
755 break;
756 case SUMO_ATTR_POSITION: {
758 myPosOverLane = parse<double>(value);
759 } else {
760 myPosOverView = parse<Position>(value);
761 }
762 break;
763 }
765 myPosLat = parse<double>(value);
766 break;
767 case SUMO_ATTR_LON: {
768 // parse geo attributes
769 Position pos(parse<double>(value), getAttributeDouble(SUMO_ATTR_LAT));
770 // transform to cartesian
772 // update view position
773 myPosOverView = pos;
774 break;
775 }
776 case SUMO_ATTR_LAT: {
777 // parse geo attributes
778 Position pos(getAttributeDouble(SUMO_ATTR_LON), parse<double>(value));
779 // transform to cartesian
781 // update view position
782 myPosOverView = pos;
783 break;
784 }
785 case SUMO_ATTR_TYPE:
786 setShapeType(value);
787 break;
788 case SUMO_ATTR_ICON:
790 break;
791 case SUMO_ATTR_LAYER:
792 if (value.empty()) {
794 } else {
795 setShapeLayer(parse<double>(value));
796 }
797 break;
799 // first remove object from grid due img file affect to boundary
800 if (getID().size() > 0) {
802 }
803 setShapeImgFile(value);
804 // all textures must be refresh
806 // add object into grid again
807 if (getID().size() > 0) {
809 }
810 break;
811 case SUMO_ATTR_WIDTH:
812 // set new width
813 myWidth = parse<double>(value);
814 break;
815 case SUMO_ATTR_HEIGHT:
816 // set new height
817 myHeight = parse<double>(value);
818 break;
819 case SUMO_ATTR_ANGLE:
820 setShapeNaviDegree(parse<double>(value));
821 break;
822 case SUMO_ATTR_NAME:
823 myAdditionalName = value;
824 break;
827 break;
828 default:
829 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
831 } else {
833 }
834 }
835 // update boundary (except for template)
836 if (getID().size() > 0) {
838 }
839}
840
841/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_POI_ATTACH
attach POI to lane
@ MID_GNE_POI_TRANSFORM_POIGEO
Transform to POI Geo.
@ MID_GNE_POI_RELEASE
release POI from lane
@ MID_GNE_POI_TRANSFORM_POI
Transform to POI.
unsigned int GUIGlID
Definition GUIGlObject.h:44
@ GLO_MAX
empty max
@ GLO_FRONTELEMENT
front element (used in netedit)
#define TL(string)
Definition MsgHandler.h:316
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_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:57
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 drawFilledCircle(const double widradiusth, const int steps=8)
Draws a filled circle around (0,0)
Definition GLHelper.cpp:564
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging)
Definition GLHelper.cpp:952
static void drawRectangle(const Position &center, const double width, const double height)
Draws a rectangle line.
Definition GLHelper.cpp:278
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition GLHelper.cpp:773
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
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
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
std::string myAdditionalName
name of additional
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
void writeAdditionalAttributes(OutputDevice &device) const
write common additional attributes
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
bool drawMovingGeometryPoints() const
check if draw moving geometry points
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)
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
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
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
bool isMoveElementValid() const
check if current moving element is valid to be written into XML
double getMovingAttributeDouble(SumoXMLAttr key) const override
get moving attribute double
std::string getMovingProblem() const
return a string with the current moving problem
std::string getMovingAttribute(SumoXMLAttr key) const override
get moving attribute
void setMovingAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
set moving attribute (using undo-list)
bool isMovingAttributeValid(SumoXMLAttr key, const std::string &value) const override
check if the given moving attribute is valid
void writeMoveAttributes(OutputDevice &device) const
write move attributes
double getFixedPositionOverLane(const bool adjustGeometryFactor) const
get fixed offset position over lane
Position getMovingAttributePosition(SumoXMLAttr key) const override
get moving attribute position
void fixMovingProblem()
fix moving problem
Position getMovingAttributePosition(SumoXMLAttr key) const override
get moving attribute position
void writeMoveAttributes(OutputDevice &device) const
write move attributes
void setMovingAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
set moving attribute (using undo-list)
double getMovingAttributeDouble(SumoXMLAttr key) const override
get moving attribute double
std::string getMovingAttribute(SumoXMLAttr key) const override
get moving attribute
bool isMovingAttributeValid(SumoXMLAttr key, const std::string &value) const override
check if the given moving attribute is valid
GNEContour myMovingContourLeft
variable used for moving geometry point contour left
GNEContour myMovingContourRight
variable used for moving geometry point contour right
GNEContour myMovingContourUp
variable used for moving geometry point contour up
GNEContour myMovingContourDown
variable used for moving geometry point contour down
PositionVector myShapeWidth
shape width
PositionVector myShapeHeight
shape height
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1476
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1486
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their correspond attribute are valids
Definition GNEPOI.cpp:548
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:614
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEPOI.cpp:365
void drawPOI(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool movingGeometryPoints) const
draw POI
Definition GNEPOI.cpp:629
void calculatePOIContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool movingGeometryPoints) const
calculate contour
Definition GNEPOI.cpp:717
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNEPOI.cpp:269
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEPOI.cpp:503
Parameterised * getParameters() override
get parameters associated with this POI
Definition GNEPOI.cpp:122
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEPOI.cpp:620
std::string getParentName() const override
Returns the name of the parent object.
Definition GNEPOI.cpp:326
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:220
std::string getAttribute(SumoXMLAttr key) const override
method for getting the Attribute of an XML key
Definition GNEPOI.cpp:411
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:304
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:208
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
Definition GNEPOI.cpp:513
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:105
const std::string getID() const override
get ID (all Attribute Carriers have one)
GNEMoveElementLaneSingle * myMoveElementLaneSingle
move element over single lane
Definition GNEPOI.h:262
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition GNEPOI.cpp:596
GNEMoveElementViewResizable * myMoveElementViewResizable
move element view resizable
Definition GNEPOI.h:265
double myPosLat
lateral position;
Definition GNEPOI.h:256
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this POI
Definition GNEPOI.cpp:112
double myWidth
width
Definition GNEPOI.h:250
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEPOI.cpp:460
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition GNEPOI.cpp:134
POIIcon myPOIIcon
POI icon.
Definition GNEPOI.h:259
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNEPOI.cpp:159
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:310
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEPOI.cpp:298
double myHeight
height
Definition GNEPOI.h:253
Position myPosOverView
position over view
Definition GNEPOI.h:241
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:196
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:519
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:336
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition GNEPOI.cpp:140
double myPosOverLane
position over lane
Definition GNEPOI.h:244
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
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
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
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.
void updateSinglePosGeometry(const Position &position, const double rotation)
update position and rotation
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, const bool allowDelete, const bool addSeparator)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void setPOIColor(const GUIVisualizationSettings &s, const RGBColor &shapeColor, const GUIGlObject *o, const bool forceSelectionColor)
set POI color
static bool checkDraw(const GUIVisualizationSettings &s, const GUIGlObject *o)
check if POI can be drawn
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static GUIGlID getPOITexture(POIIcon POIIcon)
returns texture associated to the given POI image
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
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
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationTextSettings poiType
GUIVisualizationSizeSettings poiSize
GUIVisualizationTextSettings poiName
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
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationTextSettings poiText
std::string poiTextParam
key for rendering poi textual parameter
int poiDetail
The detail level for drawing POIs.
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
double angle
The current view rotation angle.
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:124
static const std::vector< SumoXMLTag > POIs
POIs namespace.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
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.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
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:210
static const RGBColor RED
named colors
Definition RGBColor.h:204
static StringBijection< POIIcon > POIIcons
POI icon values.
A 2D- or 3D-Shape.
Definition Shape.h:44
static const double DEFAULT_LAYER_POI
Definition Shape.h:51
void setShapeLayer(const double layer)
Sets a new layer.
Definition Shape.cpp:153
void writeShapeAttributes(OutputDevice &device, const RGBColor &defaultColor, const double defaultLayer) const
write shape attributes in a xml file
Definition Shape.cpp:70
static const double DEFAULT_IMG_WIDTH
Definition Shape.h:54
static const std::string DEFAULT_IMG_FILE
Definition Shape.h:53
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition Shape.cpp:99
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.cpp:135
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition Shape.cpp:159
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition Shape.cpp:165
static const double DEFAULT_IMG_HEIGHT
Definition Shape.h:55
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition Shape.cpp:141
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.cpp:111
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition Shape.cpp:123
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.cpp:105
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition Shape.cpp:117
const std::string & getString(const T key) const
get string
bool hasString(const std::string &str) const
check if the given string exist
T get(const std::string &str) const
get key
static const int NEWLINE
identifier for splitting the given string at all newline characters
std::vector< std::string > getVector()
return vector of strings
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
static OutputDevice & writeParams(OutputDevice &device, const Parameterised &params)
write the parameters of the given object as param tags
bool showShapes() const
check if shapes has to be drawn
bool showShapes() const
check if shapes has to be drawn
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
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
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size