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)) {
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)) {
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)) {
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 } else {
339 // add option for convert to GNEPOI
341 // check if transform
342 if (GeoConvHelper::getFinal().getProjString() != "!") {
343 if (getTagProperty()->getTag() == GNE_TAG_POIGEO) {
345 } else {
347 }
348 }
349 }
350 }
351 return ret;
352}
353
354
355void
357 // first check if POI can be drawn
360 // draw boundaries
362 // obtain POIExaggeration
363 const double POIExaggeration = getExaggeration(s);
364 // get detail level
365 const auto d = s.getDetailLevel(POIExaggeration);
366 // check if draw moving geometry points (only if we have a defined image
367 const bool movingGeometryPoints = getShapeImgFile().empty() ? false : drawMovingGeometryPoints();
368 // draw geometry only if we'rent in drawForObjectUnderCursor mode
370 // draw POI
371 drawPOI(s, d, movingGeometryPoints);
372 // draw lock icon
374 // draw dotted contours
375 if (movingGeometryPoints) {
376 // get snap radius
378 const double snapRadiusSquared = snapRadius * snapRadius;
379 // get mouse position
380 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
381 // check if we're editing width or height
382 if ((myMoveElementViewResizable->myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
383 (myMoveElementViewResizable->myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
386 } else if ((myMoveElementViewResizable->myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
387 (myMoveElementViewResizable->myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
390 }
391 } else {
393 }
394 }
395 // calculate contour
396 calculatePOIContour(s, d, POIExaggeration, movingGeometryPoints);
397 }
398}
399
400
401std::string
403 switch (key) {
404 case SUMO_ATTR_ID:
405 return myID;
406 case SUMO_ATTR_COLOR:
407 return toString(getShapeColor());
409 return toString(myPosLat);
410 case SUMO_ATTR_LON:
411 if (GeoConvHelper::getFinal().getProjString() != "!") {
412 return toString(getAttributeDouble(key), 8);
413 } else {
414 return TL("No geo-conversion defined");
415 }
416 case SUMO_ATTR_LAT:
417 if (GeoConvHelper::getFinal().getProjString() != "!") {
418 return toString(getAttributeDouble(key), 8);
419 } else {
420 return TL("No geo-conversion defined");
421 }
422 case SUMO_ATTR_TYPE:
423 return getShapeType();
424 case SUMO_ATTR_ICON:
426 case SUMO_ATTR_LAYER:
427 return toString(getShapeLayer());
429 return getShapeImgFile();
430 case SUMO_ATTR_WIDTH:
431 return toString(myWidth);
432 case SUMO_ATTR_HEIGHT:
433 return toString(myHeight);
434 case SUMO_ATTR_ANGLE:
436 case SUMO_ATTR_NAME:
437 return myAdditionalName;
439 return "";
440 default:
441 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
443 } else {
445 }
446 }
447}
448
449
450double
452 switch (key) {
454 return myPosLat;
455 case SUMO_ATTR_LON:
456 if (GeoConvHelper::getFinal().getProjString() != "!") {
457 // calculate geo position
458 Position GEOPosition = myPosOverView;
460 // return lon
461 return GEOPosition.x();
462 } else {
463 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
464 }
465 case SUMO_ATTR_LAT:
466 if (GeoConvHelper::getFinal().getProjString() != "!") {
467 // calculate geo position
468 Position GEOPosition = myPosOverView;
470 // return lat
471 return GEOPosition.y();
472 } else {
473 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
474 }
475 case SUMO_ATTR_LAYER:
476 return getShapeLayer();
477 case SUMO_ATTR_WIDTH:
478 return myWidth;
479 case SUMO_ATTR_HEIGHT:
480 return myHeight;
481 case SUMO_ATTR_ANGLE:
482 return getShapeNaviDegree();
483 default:
484 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
486 } else {
488 }
489 }
490}
491
492
501
502
507
508
509void
510GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
511 switch (key) {
512 case SUMO_ATTR_ID:
513 case SUMO_ATTR_COLOR:
515 case SUMO_ATTR_LON:
516 case SUMO_ATTR_LAT:
517 case SUMO_ATTR_TYPE:
518 case SUMO_ATTR_ICON:
519 case SUMO_ATTR_LAYER:
521 case SUMO_ATTR_WIDTH:
522 case SUMO_ATTR_HEIGHT:
523 case SUMO_ATTR_ANGLE:
524 case SUMO_ATTR_NAME:
526 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
527 break;
528 default:
529 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
530 return myMoveElementLaneSingle->setMovingAttribute(key, value, undoList);
531 } else {
532 return myMoveElementViewResizable->setMovingAttribute(key, value, undoList);
533 }
534 }
535}
536
537
538bool
539GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
540 switch (key) {
541 case SUMO_ATTR_ID:
543 case SUMO_ATTR_COLOR:
544 return canParse<RGBColor>(value);
546 return canParse<double>(value);
547 case SUMO_ATTR_LON:
548 return canParse<double>(value);
549 case SUMO_ATTR_LAT:
550 return canParse<double>(value);
551 case SUMO_ATTR_TYPE:
552 return true;
553 case SUMO_ATTR_ICON:
555 case SUMO_ATTR_LAYER:
556 if (value.empty()) {
557 return true;
558 } else {
559 return canParse<double>(value);
560 }
562 if (value == "") {
563 return true;
564 } else {
565 // check that image can be loaded
566 return GUITexturesHelper::getTextureID(value) != -1;
567 }
568 case SUMO_ATTR_WIDTH:
569 return canParse<double>(value) && (parse<double>(value) > 0);
570 case SUMO_ATTR_HEIGHT:
571 return canParse<double>(value) && (parse<double>(value) > 0);
572 case SUMO_ATTR_ANGLE:
573 return canParse<double>(value);
574 case SUMO_ATTR_NAME:
576 default:
577 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
579 } else {
581 }
582 }
583}
584
585
586bool
588 switch (key) {
591 return (GeoConvHelper::getFinal().getProjString() != "!");
592 } else {
593 return true;
594 }
595 case SUMO_ATTR_LON:
596 case SUMO_ATTR_LAT:
597 return (GeoConvHelper::getFinal().getProjString() != "!");
598 default:
599 return true;
600 }
601}
602
603
604std::string
606 return getTagStr() + ": " + getID();
607}
608
609
610std::string
612 return getTagStr();
613}
614
615// ===========================================================================
616// private
617// ===========================================================================
618
619void
621 const bool movingGeometryPoints) const {
622 if (GUIPointOfInterest::checkDraw(s, this)) {
623 const double exaggeration = getExaggeration(s);
624 const auto position = getPositionInView();
625 // push matrix
627 // set POI color
629 // add extra offset z provided by icon to avoid overlapping
630 if (myDrawInFront) {
631 glTranslated(position.x(), position.y(), GLO_FRONTELEMENT + (double)myPOIIcon);
632 } else {
633 glTranslated(position.x(), position.y(), s.poiUseCustomLayer ? s.poiCustomLayer : getShapeLayer() + (double)myPOIIcon);
634 }
635 glRotated(-getShapeNaviDegree(), 0, 0, 1);
636 // check if has to be drawn as a circle or with an image
639 if (textureID > 0) {
641 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration,
642 myWidth * 0.5 * exaggeration, myHeight * 0.5 * exaggeration);
643 } else {
644 // draw box
645 GLHelper::drawRectangle(Position(0, 0), myWidth * exaggeration, myHeight * exaggeration);
646 }
647 } else {
648 // fallback if no image is defined
649 GLHelper::drawFilledCircle(std::max(myWidth, myHeight) * 0.5 * exaggeration, s.poiDetail);
650 // check if draw polygon
651 if (myPOIIcon != POIIcon::NONE) {
652 // translate
653 glTranslated(0, 0, 0.1);
654 // rotate
655 glRotated(180, 0, 0, 1);
656 // draw texture
658 }
659 }
660 // pop matrix
663 const Position namePos = position;
664 drawName(namePos, s.scale, s.poiName, s.angle);
665 if (s.poiType.show(this)) {
666 const Position p = namePos + Position(0, -0.6 * s.poiType.size / s.scale);
668 }
669 if (s.poiText.show(this)) {
671 glTranslated(namePos.x(), namePos.y(), 0);
672 std::string value = getParameter(s.poiTextParam, "");
673 if (value != "") {
675 glRotated(-s.angle, 0, 0, 1);
676 glTranslated(0, 0.7 * s.poiText.scaledSize(s.scale) * (double)lines.size(), 0);
677 glRotated(s.angle, 0, 0, 1);
678 // FONS_ALIGN_LEFT = 1
679 // FONS_ALIGN_CENTER = 2
680 // FONS_ALIGN_MIDDLE = 16
681 const int align = (lines.size() > 1 ? 1 : 2) | 16;
682 for (std::string& line : lines) {
683 GLHelper::drawTextSettings(s.poiText, line, Position(0, 0), s.scale, s.angle, GLO_MAX, align);
684 glRotated(-s.angle, 0, 0, 1);
685 glTranslated(0, -0.7 * s.poiText.scaledSize(s.scale), 0);
686 glRotated(s.angle, 0, 0, 1);
687 }
688 }
690 }
691 }
692 // draw geometry points
693 if (movingGeometryPoints) {
697 }
701 }
702 }
703 }
704}
705
706
707void
709 const double exaggeration, const bool movingGeometryPoints) const {
710 // check if we're calculating the contour or the moving geometry points
711 if (movingGeometryPoints) {
713 getShapeLayer(), exaggeration, nullptr);
715 getShapeLayer(), exaggeration, nullptr);
717 getShapeLayer(), exaggeration, nullptr);
719 getShapeLayer(), exaggeration, nullptr);
720 } else {
721 const auto parentEdgeBoundary = (getTagProperty()->getTag() == GNE_TAG_POILANE) ? getParentLanes().front()->getParentEdge() : nullptr;
722 if (getShapeImgFile().empty()) {
723 myAdditionalContour.calculateContourCircleShape(s, d, this, getPositionInView(), std::max(myWidth, myHeight) * 0.5, getShapeLayer(), exaggeration, parentEdgeBoundary);
724 } else {
725 myAdditionalContour.calculateContourRectangleShape(s, d, this, getPositionInView(), myHeight * 0.5, myWidth * 0.5, getShapeLayer(), 0, 0, getShapeNaviDegree(), exaggeration, parentEdgeBoundary);
726 }
727 }
728}
729
730
731void
732GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
733 switch (key) {
734 case SUMO_ATTR_ID: {
735 // update microsimID
736 setAdditionalID(value);
737 // set named ID
738 myID = value;
739 break;
740 }
741 case SUMO_ATTR_COLOR:
742 setShapeColor(parse<RGBColor>(value));
743 break;
744 case SUMO_ATTR_LANE:
746 break;
747 case SUMO_ATTR_POSITION: {
749 myPosOverLane = parse<double>(value);
750 } else {
751 myPosOverView = parse<Position>(value);
752 }
753 break;
754 }
756 myPosLat = parse<double>(value);
757 break;
758 case SUMO_ATTR_LON: {
759 // parse geo attributes
760 Position pos(parse<double>(value), getAttributeDouble(SUMO_ATTR_LAT));
761 // transform to cartesian
763 // update view position
764 myPosOverView = pos;
765 break;
766 }
767 case SUMO_ATTR_LAT: {
768 // parse geo attributes
769 Position pos(getAttributeDouble(SUMO_ATTR_LON), parse<double>(value));
770 // transform to cartesian
772 // update view position
773 myPosOverView = pos;
774 break;
775 }
776 case SUMO_ATTR_TYPE:
777 setShapeType(value);
778 break;
779 case SUMO_ATTR_ICON:
781 break;
782 case SUMO_ATTR_LAYER:
783 if (value.empty()) {
785 } else {
786 setShapeLayer(parse<double>(value));
787 }
788 break;
790 // first remove object from grid due img file affect to boundary
791 if (getID().size() > 0) {
793 }
794 setShapeImgFile(value);
795 // all textures must be refresh
797 // add object into grid again
798 if (getID().size() > 0) {
800 }
801 break;
802 case SUMO_ATTR_WIDTH:
803 // set new width
804 myWidth = parse<double>(value);
805 break;
806 case SUMO_ATTR_HEIGHT:
807 // set new height
808 myHeight = parse<double>(value);
809 break;
810 case SUMO_ATTR_ANGLE:
811 setShapeNaviDegree(parse<double>(value));
812 break;
813 case SUMO_ATTR_NAME:
814 myAdditionalName = value;
815 break;
818 break;
819 default:
820 if (getTagProperty()->getTag() == GNE_TAG_POILANE) {
822 } else {
824 }
825 }
826 // update boundary (except for template)
827 if (getID().size() > 0) {
829 }
830}
831
832/****************************************************************************/
@ 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: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:539
Position getPositionInView() const override
Returns position of shape in view.
Definition GNEPOI.cpp:248
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEPOI.cpp:605
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEPOI.cpp:356
void drawPOI(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool movingGeometryPoints) const
draw POI
Definition GNEPOI.cpp:620
void calculatePOIContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool movingGeometryPoints) const
calculate contour
Definition GNEPOI.cpp:708
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:494
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:611
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:402
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:504
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:96
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:587
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:451
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:510
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