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
24#include <netedit/GNENet.h>
34
35#include "GNEPOI.h"
36
37// ===========================================================================
38// method definitions
39// ===========================================================================
40
41#ifdef _MSC_VER
42#pragma warning(push)
43#pragma warning(disable: 4355) // mask warning about "this" in initializers
44#endif
46 Shape(""),
47 GNEAdditional(net, tag),
48 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
49 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, (tag == GNE_TAG_POIGEO) ? GNEMoveElementView::AttributesFormat::GEO : GNEMoveElementView::AttributesFormat::CARTESIAN,
50 GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT, SUMO_ATTR_POSITION, myPosOverView)) {
51}
52
53
54GNEPOI::GNEPOI(const std::string& id, GNENet* net, FileBucket* fileBucket, const std::string& type, const RGBColor& color, const Position& pos,
55 const bool geo, POIIcon icon, const double layer, const double angle, const std::string& imgFile, const double width,
56 const double height, const std::string& name, const Parameterised::Map& parameters) :
57 Shape(id, type, color, layer, angle, imgFile, ""),
58 GNEAdditional(id, net, geo ? GNE_TAG_POIGEO : SUMO_TAG_POI, fileBucket, name),
59 Parameterised(parameters),
60 myPosOverView(pos),
61 myWidth(width),
62 myHeight(height),
63 myPOIIcon(icon),
64 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
65 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, geo ? GNEMoveElementView::AttributesFormat::GEO : GNEMoveElementView::AttributesFormat::CARTESIAN,
66 GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT, SUMO_ATTR_POSITION, myPosOverView)) {
67 // update position depending of GEO
68 if (geo) {
69 Position cartesian = myPosOverView;
71 myPosOverView = cartesian;
72 }
73 // update centering boundary without updating grid
75}
76
77
78GNEPOI::GNEPOI(const std::string& id, GNENet* net, FileBucket* fileBucket, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
79 const bool friendlyPos, const double posLat, POIIcon icon, const double layer, const double angle, const std::string& imgFile, const double width,
80 const double height, const std::string& name, const Parameterised::Map& parameters) :
81 Shape(id, type, color, layer, angle, imgFile, ""),
82 GNEAdditional(id, net, GNE_TAG_POILANE, fileBucket, name),
83 Parameterised(parameters),
84 myPosOverLane(posOverLane),
85 myFriendlyPos(friendlyPos),
86 myWidth(width),
87 myHeight(height),
88 myPosLat(posLat),
89 myPOIIcon(icon),
90 myMoveElementLaneSingle(new GNEMoveElementLaneSingle(this, SUMO_ATTR_POSITION, myPosOverLane, myFriendlyPos, GNEMoveElementLaneSingle::PositionType::SINGLE)),
91 myMoveElementViewResizable(new GNEMoveElementViewResizable(this, GNEMoveElementView::AttributesFormat::POSITION, GNEMoveElementViewResizable::ResizingFormat::WIDTH_HEIGHT,
92 SUMO_ATTR_POSITION, myPosOverView)) {
93 // set parents
94 setParent<GNELane*>(lane);
95 // update centering boundary without updating grid
97}
98#ifdef _MSC_VER
99#pragma warning(pop)
100#endif
101
102
107
108
111 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
113 } else {
115 }
116}
117
118
121 return this;
122}
123
124
125const Parameterised*
127 return this;
128}
129
130
131std::string
133 return "";
134}
135
136
140 POIBaseObject->setTag(SUMO_TAG_POI);
141 // fill attributes
142 POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
152 return POIBaseObject;
153}
154
155
156void
158 device.openTag(SUMO_TAG_POI);
159 // write common additional attributes
161 // specific of poi lanes
162 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
163 // write move attributes
165 // write specific attributes
166 if (myPosLat != 0) {
168 }
169 } else {
170 // write move attributes
172 }
173 // write shape attributes
175 // width
178 }
179 // height
182 }
183 // Icon
184 if (myPOIIcon != POIIcon::NONE) {
186 }
187 // params
188 writeParams(device);
189 device.closeTag();
190}
191
192
193bool
195 // only for POIS over lanes
196 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
197 // only movement problems
199 } else {
200 return true;
201 }
202}
203
204
205std::string
207 // only for POIS over lanes
208 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
209 // only movement problems
211 } else {
212 return "";
213 }
214}
215
216
217void
219 // only for POIS over lanes
220 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
221 // only movement problems
223 }
224}
225
226
227void
229 // check if update width and height shapes
230 if ((myWidth > 0) && (myHeight > 0)) {
231 // calculate shape length
235 // move
237 // calculate shape width
239 leftShape.move2side(myWidth * -0.5);
241 rightShape.move2side(myWidth * 0.5);
242 myMoveElementViewResizable->myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
243 }
244 // set additional geometry
245 if (getParentLanes().size() > 0) {
246 myAdditionalGeometry.updateGeometry(getParentLanes().front()->getLaneShape(),
248 } else {
250 }
251}
252
253
258
259
260double
262 return s.poiSize.getExaggeration(s, this);
263}
264
265
266void
267GNEPOI::updateCenteringBoundary(const bool updateGrid) {
268 // Remove object from net
269 if (updateGrid) {
271 }
272 // update geometry
274 // reset boundary
276 // add center
278 // add width
279 for (const auto& pos : myMoveElementViewResizable->myShapeWidth) {
281 }
282 // add height
283 for (const auto& pos : myMoveElementViewResizable->myShapeHeight) {
285 }
286 // grow boundary
288 // add object into net
289 if (updateGrid) {
291 }
292}
293
294
295void
296GNEPOI::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
297 // nothing to split
298}
299
300
303 return GUIGlObject::getGlID();
304}
305
306
307bool
309 // get edit modes
310 const auto& editModes = myNet->getViewNet()->getEditModes();
311 // check if we're in move mode
312 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
314 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
315 // only move the first element
317 } else {
318 return false;
319 }
320}
321
322
323std::string
325 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
326 return getParentLanes().front()->getID();
327 } else {
328 return myNet->getMicrosimID();
329 }
330}
331
332
335 // create popup
336 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
337 // build common options
339 // specific of non juPedSim polygons
341 // continue depending of lane number
342 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
343 // add option for convert to GNEPOI
345 } else {
346 // add option for convert to GNEPOI
348 // check if transform
349 if (GeoConvHelper::getFinal().getProjString() != "!") {
350 if (getTagProperty()->getTag() == GNE_TAG_POIGEO) {
352 } else {
354 }
355 }
356 }
357 }
358 return ret;
359}
360
361
362void
364 // first check if POI can be drawn
367 // draw boundaries
369 // obtain POIExaggeration
370 const double POIExaggeration = getExaggeration(s);
371 // get detail level
372 const auto d = s.getDetailLevel(POIExaggeration);
373 // check if draw moving geometry points (only if we have a defined image
374 const bool movingGeometryPoints = getShapeImgFile().empty() ? false : drawMovingGeometryPoints();
375 // draw geometry only if we'rent in drawForObjectUnderCursor mode
377 // draw POI
378 drawPOI(s, d, movingGeometryPoints);
379 // draw lock icon
381 // draw dotted contours
382 if (movingGeometryPoints) {
383 // get snap radius
385 const double snapRadiusSquared = snapRadius * snapRadius;
386 // get mouse position
387 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
388 // check if we're editing width or height
389 if ((myMoveElementViewResizable->myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
390 (myMoveElementViewResizable->myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
393 } else if ((myMoveElementViewResizable->myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
394 (myMoveElementViewResizable->myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
397 }
398 } else {
400 }
401 }
402 // calculate contour
403 calculatePOIContour(s, d, POIExaggeration, movingGeometryPoints);
404 }
405}
406
407
408std::string
410 switch (key) {
411 case SUMO_ATTR_ID:
412 return myID;
413 case SUMO_ATTR_COLOR:
414 return toString(getShapeColor());
416 return toString(myPosLat);
417 case SUMO_ATTR_LON:
418 if (GeoConvHelper::getFinal().getProjString() != "!") {
419 return toString(getAttributeDouble(key), 8);
420 } else {
421 return TL("No geo-conversion defined");
422 }
423 case SUMO_ATTR_LAT:
424 if (GeoConvHelper::getFinal().getProjString() != "!") {
425 return toString(getAttributeDouble(key), 8);
426 } else {
427 return TL("No geo-conversion defined");
428 }
429 case SUMO_ATTR_TYPE:
430 return getShapeType();
431 case SUMO_ATTR_ICON:
433 case SUMO_ATTR_LAYER:
434 return toString(getShapeLayer());
436 return getShapeImgFile();
437 case SUMO_ATTR_WIDTH:
438 return toString(myWidth);
439 case SUMO_ATTR_HEIGHT:
440 return toString(myHeight);
441 case SUMO_ATTR_ANGLE:
443 case SUMO_ATTR_NAME:
444 return myAdditionalName;
446 return "";
447 default:
448 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
450 } else {
452 }
453 }
454}
455
456
457double
459 switch (key) {
461 return myPosLat;
462 case SUMO_ATTR_LON:
463 if (GeoConvHelper::getFinal().getProjString() != "!") {
464 // calculate geo position
465 Position GEOPosition = myPosOverView;
467 // return lon
468 return GEOPosition.x();
469 } else {
470 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
471 }
472 case SUMO_ATTR_LAT:
473 if (GeoConvHelper::getFinal().getProjString() != "!") {
474 // calculate geo position
475 Position GEOPosition = myPosOverView;
477 // return lat
478 return GEOPosition.y();
479 } else {
480 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
481 }
482 case SUMO_ATTR_LAYER:
483 return getShapeLayer();
484 case SUMO_ATTR_WIDTH:
485 return myWidth;
486 case SUMO_ATTR_HEIGHT:
487 return myHeight;
488 case SUMO_ATTR_ANGLE:
489 return getShapeNaviDegree();
490 default:
491 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
493 } else {
495 }
496 }
497}
498
499
508
509
514
515
516void
517GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
518 switch (key) {
519 case SUMO_ATTR_ID:
520 case SUMO_ATTR_COLOR:
522 case SUMO_ATTR_LON:
523 case SUMO_ATTR_LAT:
524 case SUMO_ATTR_TYPE:
525 case SUMO_ATTR_ICON:
526 case SUMO_ATTR_LAYER:
528 case SUMO_ATTR_WIDTH:
529 case SUMO_ATTR_HEIGHT:
530 case SUMO_ATTR_ANGLE:
531 case SUMO_ATTR_NAME:
533 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
534 break;
535 default:
536 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
537 return myMoveElementLaneSingle->setMovingAttribute(key, value, undoList);
538 } else {
539 return myMoveElementViewResizable->setMovingAttribute(key, value, undoList);
540 }
541 }
542}
543
544
545bool
546GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
547 switch (key) {
548 case SUMO_ATTR_ID:
550 case SUMO_ATTR_COLOR:
551 return canParse<RGBColor>(value);
553 return canParse<double>(value);
554 case SUMO_ATTR_LON:
555 return canParse<double>(value);
556 case SUMO_ATTR_LAT:
557 return canParse<double>(value);
558 case SUMO_ATTR_TYPE:
559 return true;
560 case SUMO_ATTR_ICON:
562 case SUMO_ATTR_LAYER:
563 if (value.empty()) {
564 return true;
565 } else {
566 return canParse<double>(value);
567 }
569 if (value == "") {
570 return true;
571 } else {
572 // check that image can be loaded
573 return GUITexturesHelper::getTextureID(value) != -1;
574 }
575 case SUMO_ATTR_WIDTH:
576 return canParse<double>(value) && (parse<double>(value) > 0);
577 case SUMO_ATTR_HEIGHT:
578 return canParse<double>(value) && (parse<double>(value) > 0);
579 case SUMO_ATTR_ANGLE:
580 return canParse<double>(value);
581 case SUMO_ATTR_NAME:
583 default:
584 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
586 } else {
588 }
589 }
590}
591
592
593bool
595 switch (key) {
598 return (GeoConvHelper::getFinal().getProjString() != "!");
599 } else {
600 return true;
601 }
602 case SUMO_ATTR_LON:
603 case SUMO_ATTR_LAT:
604 return (GeoConvHelper::getFinal().getProjString() != "!");
605 default:
606 return true;
607 }
608}
609
610
611std::string
613 return getTagStr() + ": " + getID();
614}
615
616
617std::string
619 return getTagStr();
620}
621
622// ===========================================================================
623// private
624// ===========================================================================
625
626void
628 const bool movingGeometryPoints) const {
629 if (GUIPointOfInterest::checkDraw(s, this)) {
630 const double exaggeration = getExaggeration(s);
631 const auto position = getPositionInView();
632 // push matrix
634 // set POI color
636 // add extra offset z provided by icon to avoid overlapping
637 if (myDrawInFront) {
638 glTranslated(position.x(), position.y(), GLO_FRONTELEMENT + (double)myPOIIcon);
639 } else {
640 glTranslated(position.x(), position.y(), s.poiUseCustomLayer ? s.poiCustomLayer : getShapeLayer() + (double)myPOIIcon);
641 }
642 glRotated(-getShapeNaviDegree(), 0, 0, 1);
643 // check if has to be drawn as a circle or with an image
646 if (textureID > 0) {
648 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration,
649 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration);
650 } else {
651 // draw box
652 GLHelper::drawRectangle(Position(0, 0), myWidth * exaggeration, myHeight * exaggeration);
653 }
654 } else {
655 // fallback if no image is defined
656 GLHelper::drawFilledCircle(std::max(myWidth, myHeight) * 0.5 * exaggeration, s.poiDetail);
657 // check if draw polygon
658 if (myPOIIcon != POIIcon::NONE) {
659 // translate
660 glTranslated(0, 0, 0.1);
661 // rotate
662 glRotated(180, 0, 0, 1);
663 // draw texture
665 }
666 }
667 // pop matrix
670 const Position namePos = position;
671 drawName(namePos, s.scale, s.poiName, s.angle);
672 if (s.poiType.show(this)) {
673 const Position p = namePos + Position(0, -0.6 * s.poiType.size / s.scale);
675 }
676 if (s.poiText.show(this)) {
678 glTranslated(namePos.x(), namePos.y(), 0);
679 std::string value = getParameter(s.poiTextParam, "");
680 if (value != "") {
682 glRotated(-s.angle, 0, 0, 1);
683 glTranslated(0, 0.7 * s.poiText.scaledSize(s.scale) * (double)lines.size(), 0);
684 glRotated(s.angle, 0, 0, 1);
685 // FONS_ALIGN_LEFT = 1
686 // FONS_ALIGN_CENTER = 2
687 // FONS_ALIGN_MIDDLE = 16
688 const int align = (lines.size() > 1 ? 1 : 2) | 16;
689 for (std::string& line : lines) {
690 GLHelper::drawTextSettings(s.poiText, line, Position(0, 0), s.scale, s.angle, GLO_MAX, align);
691 glRotated(-s.angle, 0, 0, 1);
692 glTranslated(0, -0.7 * s.poiText.scaledSize(s.scale), 0);
693 glRotated(s.angle, 0, 0, 1);
694 }
695 }
697 }
698 }
699 // draw geometry points
700 if (movingGeometryPoints) {
704 }
708 }
709 }
710 }
711}
712
713
714void
716 const double exaggeration, const bool movingGeometryPoints) const {
717 // check if we're calculating the contour or the moving geometry points
718 if (movingGeometryPoints) {
720 getShapeLayer(), exaggeration, nullptr);
722 getShapeLayer(), exaggeration, nullptr);
724 getShapeLayer(), exaggeration, nullptr);
726 getShapeLayer(), exaggeration, nullptr);
727 } else {
728 const auto parentEdgeBoundary = (getTagProperty()->getTag() == GNE_TAG_POILANE) ? getParentLanes().front()->getParentEdge() : nullptr;
729 if (getShapeImgFile().empty()) {
730 myAdditionalContour.calculateContourCircleShape(s, d, this, getPositionInView(), std::max(myWidth, myHeight) * 0.5, getShapeLayer(), exaggeration, parentEdgeBoundary);
731 } else {
732 myAdditionalContour.calculateContourRectangleShape(s, d, this, getPositionInView(), myHeight * 0.5, myWidth * 0.5, getShapeLayer(), 0, 0, getShapeNaviDegree(), exaggeration, parentEdgeBoundary);
733 }
734 }
735}
736
737
738void
739GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
740 switch (key) {
741 case SUMO_ATTR_ID: {
742 // update microsimID
743 setAdditionalID(value);
744 // set named ID
745 myID = value;
746 break;
747 }
748 case SUMO_ATTR_COLOR:
749 setShapeColor(parse<RGBColor>(value));
750 break;
751 case SUMO_ATTR_LANE:
753 break;
754 case SUMO_ATTR_POSITION: {
756 myPosOverLane = parse<double>(value);
757 } else {
758 myPosOverView = parse<Position>(value);
759 }
760 break;
761 }
763 myPosLat = parse<double>(value);
764 break;
765 case SUMO_ATTR_LON: {
766 // parse geo attributes
767 Position pos(parse<double>(value), getAttributeDouble(SUMO_ATTR_LAT));
768 // transform to cartesian
770 // update view position
771 myPosOverView = pos;
772 break;
773 }
774 case SUMO_ATTR_LAT: {
775 // parse geo attributes
776 Position pos(getAttributeDouble(SUMO_ATTR_LON), parse<double>(value));
777 // transform to cartesian
779 // update view position
780 myPosOverView = pos;
781 break;
782 }
783 case SUMO_ATTR_TYPE:
784 setShapeType(value);
785 break;
786 case SUMO_ATTR_ICON:
788 break;
789 case SUMO_ATTR_LAYER:
790 if (value.empty()) {
792 } else {
793 setShapeLayer(parse<double>(value));
794 }
795 break;
797 // first remove object from grid due img file affect to boundary
798 if (getID().size() > 0) {
800 }
801 setShapeImgFile(value);
802 // all textures must be refresh
804 // add object into grid again
805 if (getID().size() > 0) {
807 }
808 break;
809 case SUMO_ATTR_WIDTH:
810 // set new width
811 myWidth = parse<double>(value);
812 break;
813 case SUMO_ATTR_HEIGHT:
814 // set new height
815 myHeight = parse<double>(value);
816 break;
817 case SUMO_ATTR_ANGLE:
818 setShapeNaviDegree(parse<double>(value));
819 break;
820 case SUMO_ATTR_NAME:
821 myAdditionalName = value;
822 break;
825 break;
826 default:
827 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
829 } else {
831 }
832 }
833 // update boundary (except for template)
834 if (getID().size() > 0) {
836 }
837}
838
839/****************************************************************************/
@ 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: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:49
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:1449
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1459
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:546
Position getPositionInView() const override
Returns position of shape in view.
Definition GNEPOI.cpp:255
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEPOI.cpp:612
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEPOI.cpp:363
void drawPOI(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool movingGeometryPoints) const
draw POI
Definition GNEPOI.cpp:627
void calculatePOIContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool movingGeometryPoints) const
calculate contour
Definition GNEPOI.cpp:715
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNEPOI.cpp:267
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEPOI.cpp:501
Parameterised * getParameters() override
get parameters associated with this POI
Definition GNEPOI.cpp:120
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEPOI.cpp:618
std::string getParentName() const override
Returns the name of the parent object.
Definition GNEPOI.cpp:324
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:218
std::string getAttribute(SumoXMLAttr key) const override
method for getting the Attribute of an XML key
Definition GNEPOI.cpp:409
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNEPOI.cpp:261
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition GNEPOI.cpp:302
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:206
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
Definition GNEPOI.cpp:511
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:103
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:594
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:110
double myWidth
width
Definition GNEPOI.h:250
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEPOI.cpp:458
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition GNEPOI.cpp:132
POIIcon myPOIIcon
POI icon.
Definition GNEPOI.h:259
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNEPOI.cpp:157
void updateGeometry() override
update pre-computed geometry information
Definition GNEPOI.cpp:228
bool checkDrawMoveContour() const override
check if draw move contour (red)
Definition GNEPOI.cpp:308
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEPOI.cpp:296
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:194
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:517
GNEPOI(SumoXMLTag tag, GNENet *net)
Constructor.
Definition GNEPOI.cpp:45
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition GNEPOI.cpp:334
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition GNEPOI.cpp:138
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: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.
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:204
static const RGBColor RED
named colors
Definition RGBColor.h:198
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