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-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
19/****************************************************************************/
20
24#include <netedit/GNENet.h>
34
35#include "GNEPOI.h"
36
37// ===========================================================================
38// method definitions
39// ===========================================================================
40
42 Shape(""),
43 GNEAdditional("", net, "", tag, ""),
44 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
45 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, (tag == GNE_TAG_POIGEO) ? GNEMoveElementView::AttributesFormat::GEO : GNEMoveElementView::AttributesFormat::CARTESIAN,
46 GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT, SUMO_ATTR_POSITION, myPosOverView, myWidth, myHeight)) {
47}
48
49
50GNEPOI::GNEPOI(const std::string& id, GNENet* net, const std::string& filename, const std::string& type, const RGBColor& color, const Position& pos,
51 const bool geo, POIIcon icon, const double layer, const double angle, const std::string& imgFile, const double width,
52 const double height, const std::string& name, const Parameterised::Map& parameters) :
53 Shape(id, type, color, layer, angle, imgFile, ""),
54 GNEAdditional(id, net, filename, geo ? GNE_TAG_POIGEO : SUMO_TAG_POI, name),
55 Parameterised(parameters),
56 myPosOverView(pos),
57 myWidth(width),
58 myHeight(height),
59 myPOIIcon(icon),
60 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
61 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, geo ? GNEMoveElementView::AttributesFormat::GEO : GNEMoveElementView::AttributesFormat::CARTESIAN,
62 GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT, SUMO_ATTR_POSITION, myPosOverView, myWidth, myHeight)) {
63 // update position depending of GEO
64 if (geo) {
65 Position cartesian = myPosOverView;
67 myPosOverView = cartesian;
68 }
69 // update centering boundary without updating grid
71}
72
73
74GNEPOI::GNEPOI(const std::string& id, GNENet* net, const std::string& filename, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
75 const bool friendlyPos, const double posLat, POIIcon icon, const double layer, const double angle, const std::string& imgFile, const double width,
76 const double height, const std::string& name, const Parameterised::Map& parameters) :
77 Shape(id, type, color, layer, angle, imgFile, name),
78 GNEAdditional(id, net, filename, GNE_TAG_POILANE, ""),
79 Parameterised(parameters),
80 myPosOverLane(posOverLane),
81 myFriendlyPos(friendlyPos),
82 myWidth(width),
83 myHeight(height),
84 myPosLat(posLat),
85 myPOIIcon(icon),
86 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
87 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, GNEMoveElementView::AttributesFormat::POSITION, GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT,
88 SUMO_ATTR_POSITION, myPosOverView, myWidth, myHeight)) {
89 // set parents
90 setParent<GNELane*>(lane);
91 // update centering boundary without updating grid
93}
94
95
100
101
104 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
106 } else {
108 }
109}
110
111
114 return this;
115}
116
117
118const Parameterised*
120 return this;
121}
122
123
124std::string
126 return "";
127}
128
129
133 POIBaseObject->setTag(SUMO_TAG_POI);
134 // fill attributes
135 POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
145 return POIBaseObject;
146}
147
148
149void
151 device.openTag(SUMO_TAG_POI);
152 // write common additional attributes
154 // specific of poi lanes
155 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
156 // write move attributes
158 // write specific attributes
159 if (myPosLat != 0) {
161 }
162 } else {
163 // write move attributes
165 }
166 // write shape attributes
168 // width
171 }
172 // height
175 }
176 // Icon
177 if (myPOIIcon != POIIcon::NONE) {
179 }
180 // params
181 writeParams(device);
182 device.closeTag();
183}
184
185
186bool
188 // only for POIS over lanes
189 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
190 // only movement problems
192 } else {
193 return true;
194 }
195}
196
197
198std::string
200 // only for POIS over lanes
201 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
202 // only movement problems
204 } else {
205 return "";
206 }
207}
208
209
210void
212 // only for POIS over lanes
213 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
214 // only movement problems
216 }
217}
218
219
220void
222 // check if update width and height shapes
223 if ((myWidth > 0) && (myHeight > 0)) {
224 // calculate shape length
228 // move
230 // calculate shape width
232 leftShape.move2side(myWidth * -0.5);
234 rightShape.move2side(myWidth * 0.5);
235 myMoveElementViewResizable->myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
236 }
237 // set additional geometry
238 if (getParentLanes().size() > 0) {
239 myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(),
241 } else {
243 }
244}
245
246
251
252
253double
255 return s.poiSize.getExaggeration(s, this);
256}
257
258
259void
260GNEPOI::updateCenteringBoundary(const bool updateGrid) {
261 // Remove object from net
262 if (updateGrid) {
264 }
265 // update geometry
267 // reset boundary
269 // add center
271 // add width
272 for (const auto& pos : myMoveElementViewResizable->myShapeWidth) {
274 }
275 // add height
276 for (const auto& pos : myMoveElementViewResizable->myShapeHeight) {
278 }
279 // grow boundary
281 // add object into net
282 if (updateGrid) {
284 }
285}
286
287
288void
289GNEPOI::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
290 // nothing to split
291}
292
293
296 return GUIGlObject::getGlID();
297}
298
299
300bool
302 // get edit modes
303 const auto& editModes = myNet->getViewNet()->getEditModes();
304 // check if we're in move mode
305 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
307 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
308 // only move the first element
310 } else {
311 return false;
312 }
313}
314
315
316std::string
318 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
319 return getParentLanes().front()->getID();
320 } else {
321 return myNet->getMicrosimID();
322 }
323}
324
325
328 // create popup
329 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
330 // build common options
332 // specific of non juPedSim polygons
334 // continue depending of lane number
335 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
336 // add option for convert to GNEPOI
338 return ret;
339 } else {
340 // add option for convert to GNEPOI
342 }
343 }
344 return ret;
345}
346
347
348void
350 // first check if POI can be drawn
353 // draw boundaries
355 // obtain POIExaggeration
356 const double POIExaggeration = getExaggeration(s);
357 // get detail level
358 const auto d = s.getDetailLevel(POIExaggeration);
359 // check if draw moving geometry points (only if we have a defined image
360 const bool movingGeometryPoints = getShapeImgFile().empty() ? false : drawMovingGeometryPoints();
361 // draw geometry only if we'rent in drawForObjectUnderCursor mode
363 // draw POI
364 drawPOI(s, d, movingGeometryPoints);
365 // draw lock icon
367 // draw dotted contours
368 if (movingGeometryPoints) {
369 // get snap radius
371 const double snapRadiusSquared = snapRadius * snapRadius;
372 // get mouse position
373 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
374 // check if we're editing width or height
375 if ((myMoveElementViewResizable->myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
376 (myMoveElementViewResizable->myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
379 } else if ((myMoveElementViewResizable->myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
380 (myMoveElementViewResizable->myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
383 }
384 } else {
386 }
387 }
388 // calculate contour
389 calculatePOIContour(s, d, POIExaggeration, movingGeometryPoints);
390 }
391}
392
393
394std::string
396 switch (key) {
397 case SUMO_ATTR_ID:
398 return myID;
399 case SUMO_ATTR_COLOR:
400 return toString(getShapeColor());
402 return toString(myPosLat);
403 case SUMO_ATTR_LON:
404 if (GeoConvHelper::getFinal().getProjString() != "!") {
405 return toString(getAttributeDouble(key), 8);
406 } else {
407 return TL("No geo-conversion defined");
408 }
409 case SUMO_ATTR_LAT:
410 if (GeoConvHelper::getFinal().getProjString() != "!") {
411 return toString(getAttributeDouble(key), 8);
412 } else {
413 return TL("No geo-conversion defined");
414 }
415 case SUMO_ATTR_TYPE:
416 return getShapeType();
417 case SUMO_ATTR_ICON:
419 case SUMO_ATTR_LAYER:
420 return toString(getShapeLayer());
422 return getShapeImgFile();
423 case SUMO_ATTR_WIDTH:
424 return toString(myWidth);
425 case SUMO_ATTR_HEIGHT:
426 return toString(myHeight);
427 case SUMO_ATTR_ANGLE:
429 case SUMO_ATTR_NAME:
430 return myAdditionalName;
432 return "";
433 default:
434 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
436 } else {
438 }
439 }
440}
441
442
443double
445 switch (key) {
447 return myPosLat;
448 case SUMO_ATTR_LON:
449 if (GeoConvHelper::getFinal().getProjString() != "!") {
450 // calculate geo position
451 Position GEOPosition = myPosOverView;
453 // return lon
454 return GEOPosition.x();
455 } else {
456 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
457 }
458 case SUMO_ATTR_LAT:
459 if (GeoConvHelper::getFinal().getProjString() != "!") {
460 // calculate geo position
461 Position GEOPosition = myPosOverView;
463 // return lat
464 return GEOPosition.y();
465 } else {
466 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
467 }
468 case SUMO_ATTR_LAYER:
469 return getShapeLayer();
470 case SUMO_ATTR_WIDTH:
471 return myWidth;
472 case SUMO_ATTR_HEIGHT:
473 return myHeight;
474 case SUMO_ATTR_ANGLE:
475 return getShapeNaviDegree();
476 default:
477 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
479 } else {
481 }
482 }
483}
484
485
494
495
500
501
502void
503GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
504 switch (key) {
505 case SUMO_ATTR_ID:
506 case SUMO_ATTR_COLOR:
508 case SUMO_ATTR_LON:
509 case SUMO_ATTR_LAT:
510 case SUMO_ATTR_TYPE:
511 case SUMO_ATTR_ICON:
512 case SUMO_ATTR_LAYER:
514 case SUMO_ATTR_WIDTH:
515 case SUMO_ATTR_HEIGHT:
516 case SUMO_ATTR_ANGLE:
517 case SUMO_ATTR_NAME:
519 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
520 break;
521 default:
522 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
523 return myMoveElementLaneSingle->setMovingAttribute(key, value, undoList);
524 } else {
525 return myMoveElementViewResizable->setMovingAttribute(key, value, undoList);
526 }
527 break;
528 }
529}
530
531
532bool
533GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
534 switch (key) {
535 case SUMO_ATTR_ID:
537 case SUMO_ATTR_COLOR:
538 return canParse<RGBColor>(value);
540 return canParse<double>(value);
541 case SUMO_ATTR_LON:
542 return canParse<double>(value);
543 case SUMO_ATTR_LAT:
544 return canParse<double>(value);
545 case SUMO_ATTR_TYPE:
546 return true;
547 case SUMO_ATTR_ICON:
549 case SUMO_ATTR_LAYER:
550 if (value.empty()) {
551 return true;
552 } else {
553 return canParse<double>(value);
554 }
556 if (value == "") {
557 return true;
558 } else {
559 // check that image can be loaded
560 return GUITexturesHelper::getTextureID(value) != -1;
561 }
562 case SUMO_ATTR_WIDTH:
563 return canParse<double>(value) && (parse<double>(value) > 0);
564 case SUMO_ATTR_HEIGHT:
565 return canParse<double>(value) && (parse<double>(value) > 0);
566 case SUMO_ATTR_ANGLE:
567 return canParse<double>(value);
568 case SUMO_ATTR_NAME:
570 default:
571 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
573 } else {
575 }
576 break;
577 }
578}
579
580
581bool
583 switch (key) {
586 return (GeoConvHelper::getFinal().getProjString() != "!");
587 } else {
588 return true;
589 }
590 case SUMO_ATTR_LON:
591 case SUMO_ATTR_LAT:
592 return (GeoConvHelper::getFinal().getProjString() != "!");
593 default:
594 return true;
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
616 const bool movingGeometryPoints) const {
617 if (GUIPointOfInterest::checkDraw(s, this)) {
618 const double exaggeration = getExaggeration(s);
619 const auto position = getPositionInView();
620 // push matrix
622 // set POI color
624 // add extra offset z provided by icon to avoid overlapping
625 if (myDrawInFront) {
626 glTranslated(position.x(), position.y(), GLO_FRONTELEMENT + (double)myPOIIcon);
627 } else {
628 glTranslated(position.x(), position.y(), s.poiUseCustomLayer ? s.poiCustomLayer : getShapeLayer() + (double)myPOIIcon);
629 }
630 glRotated(-getShapeNaviDegree(), 0, 0, 1);
631 // check if has to be drawn as a circle or with an image
634 if (textureID > 0) {
636 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration,
637 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration);
638 } else {
639 // draw box
640 GLHelper::drawRectangle(Position(0, 0), myWidth * exaggeration, myHeight * exaggeration);
641 }
642 } else {
643 // fallback if no image is defined
644 GLHelper::drawFilledCircle(std::max(myWidth, myHeight) * 0.5 * exaggeration, s.poiDetail);
645 // check if draw polygon
646 if (myPOIIcon != POIIcon::NONE) {
647 // translate
648 glTranslated(0, 0, 0.1);
649 // rotate
650 glRotated(180, 0, 0, 1);
651 // draw texture
653 }
654 }
655 // pop matrix
658 const Position namePos = position;
659 drawName(namePos, s.scale, s.poiName, s.angle);
660 if (s.poiType.show(this)) {
661 const Position p = namePos + Position(0, -0.6 * s.poiType.size / s.scale);
663 }
664 if (s.poiText.show(this)) {
666 glTranslated(namePos.x(), namePos.y(), 0);
667 std::string value = getParameter(s.poiTextParam, "");
668 if (value != "") {
670 glRotated(-s.angle, 0, 0, 1);
671 glTranslated(0, 0.7 * s.poiText.scaledSize(s.scale) * (double)lines.size(), 0);
672 glRotated(s.angle, 0, 0, 1);
673 // FONS_ALIGN_LEFT = 1
674 // FONS_ALIGN_CENTER = 2
675 // FONS_ALIGN_MIDDLE = 16
676 const int align = (lines.size() > 1 ? 1 : 2) | 16;
677 for (std::string& line : lines) {
678 GLHelper::drawTextSettings(s.poiText, line, Position(0, 0), s.scale, s.angle, GLO_MAX, align);
679 glRotated(-s.angle, 0, 0, 1);
680 glTranslated(0, -0.7 * s.poiText.scaledSize(s.scale), 0);
681 glRotated(s.angle, 0, 0, 1);
682 }
683 }
685 }
686 }
687 // draw geometry points
688 if (movingGeometryPoints) {
692 }
696 }
697 }
698 }
699}
700
701
702void
704 const double exaggeration, const bool movingGeometryPoints) const {
705 // check if we're calculating the contour or the moving geometry points
706 if (movingGeometryPoints) {
708 getShapeLayer(), exaggeration, nullptr);
710 getShapeLayer(), exaggeration, nullptr);
712 getShapeLayer(), exaggeration, nullptr);
714 getShapeLayer(), exaggeration, nullptr);
715 } else {
716 const auto parentEdgeBoundary = (getTagProperty()->getTag() == GNE_TAG_POILANE) ? getParentLanes().front()->getParentEdge() : nullptr;
717 if (getShapeImgFile().empty()) {
718 myAdditionalContour.calculateContourCircleShape(s, d, this, getPositionInView(), std::max(myWidth, myHeight) * 0.5, getShapeLayer(), exaggeration, parentEdgeBoundary);
719 } else {
720 myAdditionalContour.calculateContourRectangleShape(s, d, this, getPositionInView(), myHeight * 0.5, myWidth * 0.5, getShapeLayer(), 0, 0, getShapeNaviDegree(), exaggeration, parentEdgeBoundary);
721 }
722 }
723}
724
725
726void
727GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
728 switch (key) {
729 case SUMO_ATTR_ID: {
730 // update microsimID
731 setAdditionalID(value);
732 // set named ID
733 myID = value;
734 break;
735 }
736 case SUMO_ATTR_COLOR:
737 setShapeColor(parse<RGBColor>(value));
738 break;
739 case SUMO_ATTR_LANE:
741 break;
742 case SUMO_ATTR_POSITION: {
744 myPosOverLane = parse<double>(value);
745 } else {
746 myPosOverView = parse<Position>(value);
747 }
748 break;
749 }
751 myPosLat = parse<double>(value);
752 break;
753 case SUMO_ATTR_LON: {
754 // parse geo attributes
755 Position pos(parse<double>(value), getAttributeDouble(SUMO_ATTR_LAT));
756 // transform to cartesian
758 // update view position
759 myPosOverView = pos;
760 break;
761 }
762 case SUMO_ATTR_LAT: {
763 // parse geo attributes
764 Position pos(getAttributeDouble(SUMO_ATTR_LON), parse<double>(value));
765 // transform to cartesian
767 // update view position
768 myPosOverView = pos;
769 break;
770 }
771 case SUMO_ATTR_TYPE:
772 setShapeType(value);
773 break;
774 case SUMO_ATTR_ICON:
776 break;
777 case SUMO_ATTR_LAYER:
778 if (value.empty()) {
780 } else {
781 setShapeLayer(parse<double>(value));
782 }
783 break;
785 // first remove object from grid due img file affect to boundary
786 if (getID().size() > 0) {
788 }
789 setShapeImgFile(value);
790 // all textures must be refresh
792 // add object into grid again
793 if (getID().size() > 0) {
795 }
796 break;
797 case SUMO_ATTR_WIDTH:
798 // set new width
799 myWidth = parse<double>(value);
800 break;
801 case SUMO_ATTR_HEIGHT:
802 // set new height
803 myHeight = parse<double>(value);
804 break;
805 case SUMO_ATTR_ANGLE:
806 setShapeNaviDegree(parse<double>(value));
807 break;
808 case SUMO_ATTR_NAME:
809 myAdditionalName = value;
810 break;
813 break;
814 default:
815 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
817 } else {
819 }
820 break;
821 }
822 // update boundary (except for template)
823 if (getID().size() > 0) {
825 }
826}
827
828/****************************************************************************/
@ 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_MAX
empty max
@ GLO_FRONTELEMENT
front element (used in netedit)
#define TL(string)
Definition MsgHandler.h:304
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: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 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
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1440
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1450
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their correspond attribute are valids
Definition GNEPOI.cpp:533
Position getPositionInView() const override
Returns position of shape in view.
Definition GNEPOI.cpp:248
const std::string getID() const
get ID (all Attribute Carriers have one)
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:349
void drawPOI(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool movingGeometryPoints) const
draw POI
Definition GNEPOI.cpp:615
void calculatePOIContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool movingGeometryPoints) const
calculate contour
Definition GNEPOI.cpp:703
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNEPOI.cpp:260
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEPOI.cpp:487
Parameterised * getParameters() override
get parameters associated with this POI
Definition GNEPOI.cpp:113
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:317
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:211
std::string getAttribute(SumoXMLAttr key) const override
method for getting the Attribute of an XML key
Definition GNEPOI.cpp:395
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNEPOI.cpp:254
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition GNEPOI.cpp:295
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:199
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
Definition GNEPOI.cpp:497
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:96
GNEMoveElementLaneSingle * myMoveElementLaneSingle
move element over single lane
Definition GNEPOI.h:262
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition GNEPOI.cpp:582
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:103
double myWidth
width
Definition GNEPOI.h:250
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEPOI.cpp:444
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition GNEPOI.cpp:125
POIIcon myPOIIcon
POI icon.
Definition GNEPOI.h:259
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNEPOI.cpp:150
void updateGeometry() override
update pre-computed geometry information
Definition GNEPOI.cpp:221
bool checkDrawMoveContour() const override
check if draw move contour (red)
Definition GNEPOI.cpp:301
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEPOI.cpp:289
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:187
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:503
GNEPOI(SumoXMLTag tag, GNENet *net)
Constructor.
Definition GNEPOI.cpp:41
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition GNEPOI.cpp:327
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition GNEPOI.cpp:131
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.
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.
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:125
static const std::vector< SumoXMLTag > POIs
POIs namespace.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
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.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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:194
static const RGBColor RED
named colors
Definition RGBColor.h:188
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)
A 2D- or 3D-Shape.
Definition Shape.h:38
static const double DEFAULT_LAYER_POI
Definition Shape.h:45
void setShapeLayer(const double layer)
Sets a new layer.
Definition Shape.cpp:157
void writeShapeAttributes(OutputDevice &device, const RGBColor &defaultColor, const double defaultLayer) const
write shape attributes in a xml file
Definition Shape.cpp:74
static const double DEFAULT_IMG_WIDTH
Definition Shape.h:48
static const std::string DEFAULT_IMG_FILE
Definition Shape.h:47
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition Shape.cpp:103
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.cpp:139
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition Shape.cpp:163
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition Shape.cpp:169
static const double DEFAULT_IMG_HEIGHT
Definition Shape.h:49
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition Shape.cpp:145
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.cpp:115
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition Shape.cpp:127
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.cpp:109
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition Shape.cpp:121
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
bool showShapes() const
check if shapes has to be drawn
bool showShapes() const
check if shapes has to be drawn
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