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-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A class for visualizing and editing POIS in netedit (adapted from
19// GUIPointOfInterest and NLHandler)
20/****************************************************************************/
21#include <config.h>
22
23#include <string>
24#include <netedit/GNENet.h>
25#include <netedit/GNEUndoList.h>
26#include <netedit/GNEViewNet.h>
39
40#include "GNEPOI.h"
42
43
44// ===========================================================================
45// method definitions
46// ===========================================================================
47
49 PointOfInterest("", "", RGBColor::BLACK, Position(0, 0), false, "", 0, false, 0, SUMOXMLDefinitions::POIIcons.getString(POIIcon::NONE), 0, 0, "", false, 0, 0, "", Parameterised::Map()),
50 GNEAdditional("", net, GLO_POI, tag, GUIIconSubSys::getIcon(GUIIcon::POI), "", {}, {}, {}, {}, {}, {}) {
51 // reset default values
52 resetDefaultValues();
53}
54
55
56GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, const double xLon,
57 const double yLat, const bool geo, const std::string& icon, const double layer, const double angle,
58 const std::string& imgFile, const bool relativePath, const double width, const double height,
59 const std::string& name, const Parameterised::Map& parameters) :
60 PointOfInterest(id, type, color, Position(xLon, yLat), geo, "", 0, false, 0, icon, layer, angle, imgFile, relativePath, width, height, name, parameters),
62 "", {}, {}, {}, {}, {}, {}) {
63 // update position depending of GEO
64 if (geo) {
65 Position cartesian(x(), y());
67 set(cartesian.x(), cartesian.y());
68 }
69 // update geometry (needed for adjust myShapeWidth and myShapeHeight)
70 updateGeometry();
71 // update centering boundary without updating grid
72 updateCenteringBoundary(false);
73}
74
75
76GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color, GNELane* lane, const double posOverLane,
77 const bool friendlyPos, const double posLat, const std::string& icon, const double layer, const double angle,
78 const std::string& imgFile, const bool relativePath, const double width, const double height,
79 const std::string& name, const Parameterised::Map& parameters) :
80 PointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, friendlyPos, posLat, icon, layer, angle, imgFile, relativePath, width, height, name, parameters),
81 GNEAdditional(id, net, GLO_POI, GNE_TAG_POILANE, GUIIconSubSys::getIcon(GUIIcon::POILANE), "", {}, {}, {lane}, {}, {}, {}) {
82 // update geometry (needed for adjust myShapeWidth and myShapeHeight)
83 updateGeometry();
84 // update centering boundary without updating grid
85 updateCenteringBoundary(false);
86}
87
88
90
91
97 // get snap radius
99 const double snapRadiusSquared = snapRadius * snapRadius;
100 // get mouse position
101 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
102 // check if we're editing width or height
103 if ((myShapeWidth.size() == 0) || (myShapeHeight.size() == 0)) {
104 return nullptr;
105 } else if (myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
106 // edit height
108 } else if (myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
109 // edit height
111 } else if (myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
112 // edit width
114 } else if (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) {
115 // edit width
117 } else {
118 return nullptr;
119 }
120 } else if (getTagProperty().getTag() == GNE_TAG_POILANE) {
121 // return move operation for POI placed over lane
122 return new GNEMoveOperation(this, getParentLanes().front(), myPosOverLane,
124 } else {
125 // return move operation for a position in view
126 return new GNEMoveOperation(this, *this);
127 }
128}
129
130
131void
132GNEPOI::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
133 // nothing to remove
134}
135
136
137std::string
139 return "";
140}
141
142
146 POIBaseObject->setTag(SUMO_TAG_POI);
147 // fill attributes
148 POIBaseObject->addStringAttribute(SUMO_ATTR_ID, myID);
159 return POIBaseObject;
160}
161
162
163void
165 if (getParentLanes().size() > 0) {
166 // obtain fixed position over lane
167 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShape().length() ? getParentLanes().at(0)->getLaneShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
168 // write POILane using POI::writeXML
169 writeXML(device, false, 0, getParentLanes().at(0)->getID(), fixedPositionOverLane, myFriendlyPos, myPosLat);
170 } else {
171 writeXML(device, myGeo);
172 }
173}
174
175
176bool
178 // only for POIS over lanes
179 if (getParentLanes().size() == 0) {
180 return true;
181 } else if (getFriendlyPos()) {
182 // with friendly position enabled position is "always fixed"
183 return true;
184 } else {
185 return fabs(myPosOverLane) <= getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
186 }
187}
188
189
190std::string
192 // only for POIS over lanes
193 if (getParentLanes().size() > 0) {
194 // obtain final length
195 const double len = getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
196 // check if detector has a problem
198 return "";
199 } else {
200 // declare variable for error position
201 std::string errorPosition;
202 // check positions over lane
203 if (myPosOverLane < 0) {
204 errorPosition = (toString(SUMO_ATTR_POSITION) + " < 0");
205 }
206 if (myPosOverLane > len) {
207 errorPosition = (toString(SUMO_ATTR_POSITION) + TL(" > lanes's length"));
208 }
209 return errorPosition;
210 }
211 } else {
212 return "";
213 }
214}
215
216
217void
219 // only for POIS over lanes
220 if (getParentLanes().size() > 0) {
221 // declare new position
222 double newPositionOverLane = myPosOverLane;
223 // declare new length (but unsed in this context)
224 double length = 0;
225 // fix pos and length with fixLanePosition
226 GNEAdditionalHandler::fixLanePosition(newPositionOverLane, length, getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
227 // set new position
229 }
230}
231
232
233void
235 // set position
236 if (getParentLanes().size() > 0) {
237 // obtain fixed position over lane
238 double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShapeLength() ? getParentLanes().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
239 // set new position regarding to lane
240 set(getParentLanes().at(0)->getLaneShape().positionAtOffset(fixedPositionOverLane * getParentLanes().at(0)->getLengthGeometryFactor(), -myPosLat));
241 }
242 // check if update width and height shapes
243 if ((getWidth() > 0) && (getHeight() > 0)) {
244 // calculate shape length
245 myShapeHeight.clear();
246 myShapeHeight.push_back(Position(0, getHeight() * -0.5));
247 myShapeHeight.push_back(Position(0, getHeight() * 0.5));
248 // move
249 myShapeHeight.add(*this);
250 // calculate shape width
251 PositionVector leftShape = myShapeHeight;
252 leftShape.move2side(getWidth() * -0.5);
253 PositionVector rightShape = myShapeHeight;
254 rightShape.move2side(getWidth() * 0.5);
255 myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
256 }
257}
258
259
262 return *this;
263}
264
265
266double
268 return s.poiSize.getExaggeration(s, this);
269}
270
271
272void
273GNEPOI::updateCenteringBoundary(const bool updateGrid) {
274 // Remove object from net
275 if (updateGrid) {
277 }
278 // reset boundary
280 // add position (this POI)
282 // grow boundary
283 myAdditionalBoundary.grow(5 + std::max(getWidth() * 0.5, getHeight() * 0.5));
284 // add object into net
285 if (updateGrid) {
287 }
288}
289
290
291void
292GNEPOI::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
293 // nothing to split
294}
295
296
299 return GUIGlObject::getGlID();
300}
301
302
303bool
305 // get edit modes
306 const auto& editModes = myNet->getViewNet()->getEditModes();
307 // check if we're in move mode
308 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
310 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
311 // only move the first element
313 } else {
314 return false;
315 }
316}
317
318
319std::string
321 if (getParentLanes().size() > 0) {
322 return getParentLanes().front()->getID();
323 } else {
324 return myNet->getMicrosimID();
325 }
326}
327
328
331 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
332 buildPopupHeader(ret, app);
335 // build selection and show parameters menu
338 buildPositionCopyEntry(ret, app);
339 new FXMenuSeparator(ret);
340 // specific of non juPedSim polygons
342 // continue depending of lane number
343 if (getParentLanes().size() > 0) {
344 // add option for convert to GNEPOI
346 return ret;
347 } else {
348 // add option for convert to GNEPOI
350 }
351 }
352 return ret;
353}
354
355
356void
358 // first check if POI can be drawn
361 // draw boundaries
363 // obtain POIExaggeration
364 const double POIExaggeration = getExaggeration(s);
365 // get detail level
366 const auto d = s.getDetailLevel(POIExaggeration);
367 // check if draw moving geometry points (only if we have a defined image
368 const bool movingGeometryPoints = getShapeImgFile().empty() ? false : drawMovingGeometryPoints(false);
369 // draw geometry only if we'rent in drawForObjectUnderCursor mode
371 // draw POI
372 drawPOI(s, d, movingGeometryPoints);
373 // draw lock icon
375 // draw dotted contours
376 if (movingGeometryPoints) {
377 // get snap radius
379 const double snapRadiusSquared = snapRadius * snapRadius;
380 // get mouse position
381 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
382 // check if we're editing width or height
383 if ((myShapeHeight.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
384 (myShapeHeight.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
387 } else if ((myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared) ||
388 (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= snapRadiusSquared)) {
391 }
392 } else {
394 }
395 }
396 // calculate contour
397 calculatePOIContour(s, d, POIExaggeration, movingGeometryPoints);
398 }
399}
400
401
402std::string
404 switch (key) {
405 case SUMO_ATTR_ID:
406 return myID;
407 case SUMO_ATTR_COLOR:
408 return toString(getShapeColor());
409 case SUMO_ATTR_LANE:
410 return myLane;
412 if (getParentLanes().size() > 0) {
413 return toString(myPosOverLane);
414 } else {
415 return toString(*this);
416 }
418 return toString(getFriendlyPos());
420 return toString(myPosLat);
421 case SUMO_ATTR_LON:
422 if (GeoConvHelper::getFinal().getProjString() != "!") {
423 // calculate geo position
424 Position GEOPosition(x(), y());
426 // return lon
427 return toString(GEOPosition.x(), 8);
428 } else {
429 return TL("No geo-conversion defined");
430 }
431 case SUMO_ATTR_LAT:
432 if (GeoConvHelper::getFinal().getProjString() != "!") {
433 // calculate geo position
434 Position GEOPosition(x(), y());
436 // return lat
437 return toString(GEOPosition.y(), 8);
438 } else {
439 return TL("No geo-conversion defined");
440 }
441 case SUMO_ATTR_TYPE:
442 return getShapeType();
443 case SUMO_ATTR_ICON:
444 return getIconStr();
445 case SUMO_ATTR_LAYER:
447 return "default";
448 } else {
449 return toString(getShapeLayer());
450 }
452 return getShapeImgFile();
455 case SUMO_ATTR_WIDTH:
456 return toString(getWidth());
457 case SUMO_ATTR_HEIGHT:
458 return toString(getHeight());
459 case SUMO_ATTR_ANGLE:
461 case SUMO_ATTR_NAME:
462 return getShapeName();
466 return "";
467 default:
468 return getCommonAttribute(key);
469 }
470}
471
472
473double
475 throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
476}
477
478
483
484
485void
486GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
487 switch (key) {
488 case SUMO_ATTR_ID:
489 case SUMO_ATTR_COLOR:
490 case SUMO_ATTR_LANE:
494 case SUMO_ATTR_LON:
495 case SUMO_ATTR_LAT:
496 case SUMO_ATTR_TYPE:
497 case SUMO_ATTR_ICON:
498 case SUMO_ATTR_LAYER:
501 case SUMO_ATTR_WIDTH:
502 case SUMO_ATTR_HEIGHT:
503 case SUMO_ATTR_ANGLE:
504 case SUMO_ATTR_NAME:
507 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
508 break;
509 default:
510 setCommonAttribute(key, value, undoList);
511 break;
512 }
513}
514
515
516bool
517GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
518 switch (key) {
519 case SUMO_ATTR_ID:
521 case SUMO_ATTR_COLOR:
522 return canParse<RGBColor>(value);
523 case SUMO_ATTR_LANE:
524 return (myNet->getAttributeCarriers()->retrieveLane(value, false) != nullptr);
526 if (getParentLanes().size() > 0) {
527 return canParse<double>(value);
528 } else {
529 return canParse<Position>(value);
530 }
532 return canParse<bool>(value);
534 return canParse<double>(value);
535 case SUMO_ATTR_LON:
536 return canParse<double>(value);
537 case SUMO_ATTR_LAT:
538 return canParse<double>(value);
539 case SUMO_ATTR_TYPE:
540 return true;
541 case SUMO_ATTR_ICON:
543 case SUMO_ATTR_LAYER:
544 if (value == "default") {
545 return true;
546 } else {
547 return canParse<double>(value);
548 }
550 if (value == "") {
551 return true;
552 } else {
553 // check that image can be loaded
554 return GUITexturesHelper::getTextureID(value) != -1;
555 }
557 return canParse<bool>(value);
558 case SUMO_ATTR_WIDTH:
559 return canParse<double>(value) && (parse<double>(value) > 0);
560 case SUMO_ATTR_HEIGHT:
561 return canParse<double>(value) && (parse<double>(value) > 0);
562 case SUMO_ATTR_ANGLE:
563 return canParse<double>(value);
564 case SUMO_ATTR_NAME:
567 return areParametersValid(value);
568 default:
569 return isCommonValid(key, value);
570 }
571}
572
573
574bool
576 switch (key) {
579 return (GeoConvHelper::getFinal().getProjString() != "!");
580 } else {
581 return true;
582 }
583 case SUMO_ATTR_LON:
584 case SUMO_ATTR_LAT:
585 return (GeoConvHelper::getFinal().getProjString() != "!");
586 default:
587 return true;
588 }
589}
590
591
592std::string
594 return getTagStr() + ": " + getID();
595}
596
597
598std::string
600 return getTagStr();
601}
602
603// ===========================================================================
604// private
605// ===========================================================================
606
607void
609 const bool movingGeometryPoints) const {
610 if (GUIPointOfInterest::checkDraw(s, this)) {
611 // draw inner polygon
612 if (myDrawInFront) {
615 } else {
618 }
619 // draw geometry points
620 if (movingGeometryPoints) {
621 if (myShapeHeight.size() > 0) {
624 }
625 if (myShapeWidth.size() > 0) {
628 }
629 }
630 }
631}
632
633
634void
636 const double exaggeration, const bool movingGeometryPoints) const {
637 // check if we're calculating the contour or the moving geometry points
638 if (movingGeometryPoints) {
640 getShapeLayer(), exaggeration, nullptr);
642 getShapeLayer(), exaggeration, nullptr);
644 getShapeLayer(), exaggeration, nullptr);
646 getShapeLayer(), exaggeration, nullptr);
647 } else {
648 const auto parentEdgeBoundary = (getParentLanes().size() > 0) ? getParentLanes().front()->getParentEdge() : nullptr;
649 if (getShapeImgFile().empty()) {
650 const double radius = getWidth() > getHeight() ? getWidth() : getHeight();
651 myAdditionalContour.calculateContourCircleShape(s, d, this, *this, radius * 0.5, getShapeLayer(), exaggeration, parentEdgeBoundary);
652 } else {
653 myAdditionalContour.calculateContourRectangleShape(s, d, this, *this, getHeight() * 0.5, getWidth() * 0.5, getShapeLayer(), 0, 0, getShapeNaviDegree(), exaggeration, parentEdgeBoundary);
654 }
655 }
656}
657
658
659void
660GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
661 switch (key) {
662 case SUMO_ATTR_ID: {
663 // update microsimID
664 setAdditionalID(value);
665 // set named ID
666 myID = value;
667 break;
668 }
669 case SUMO_ATTR_COLOR:
670 setShapeColor(parse<RGBColor>(value));
671 break;
672 case SUMO_ATTR_LANE:
673 myLane = value;
675 break;
676 case SUMO_ATTR_POSITION: {
677 if (getParentLanes().size() > 0) {
678 if (canParse<double>(value)) {
679 myPosOverLane = parse<double>(value);
680 }
681 } else {
682 // set position
683 set(parse<Position>(value));
684 }
685 // update centering boundary
687 // update geometry
689 break;
690 }
692 setFriendlyPos(parse<bool>(value));
693 break;
695 myPosLat = parse<double>(value);
696 // update centering boundary
698 // update geometry
700 break;
701 case SUMO_ATTR_LON: {
702 // calculate cartesian
703 Position cartesian(parse<double>(value), parse<double>(getAttribute(SUMO_ATTR_LAT)));
705 // set cartesian
706 set(cartesian);
707 // update centering boundary
709 // update geometry
711 break;
712 }
713 case SUMO_ATTR_LAT: {
714 // calculate cartesian
715 Position cartesian(parse<double>(getAttribute(SUMO_ATTR_LON)), parse<double>(value));
717 // set cartesian
718 set(cartesian);
719 // update centering boundary
721 // update geometry
723 break;
724 }
725 case SUMO_ATTR_TYPE:
726 setShapeType(value);
727 break;
728 case SUMO_ATTR_ICON:
729 setIcon(value);
730 break;
731 case SUMO_ATTR_LAYER:
732 if (value == "default") {
734 } else {
735 setShapeLayer(parse<double>(value));
736 }
737 break;
739 // first remove object from grid due img file affect to boundary
740 if (getID().size() > 0) {
742 }
743 setShapeImgFile(value);
744 // all textures must be refresh
746 // add object into grid again
747 if (getID().size() > 0) {
749 }
750 break;
752 setShapeRelativePath(parse<bool>(value));
753 break;
754 case SUMO_ATTR_WIDTH:
755 // set new width
756 setWidth(parse<double>(value));
757 // update centering boundary and geometry (except for templates)
758 if (getID().size() > 0) {
761 }
762 break;
763 case SUMO_ATTR_HEIGHT:
764 // set new height
765 setHeight(parse<double>(value));
766 // update centering boundary and geometry (except for templates)
767 if (getID().size() > 0) {
770 }
771 break;
772 case SUMO_ATTR_ANGLE:
773 setShapeNaviDegree(parse<double>(value));
774 break;
775 case SUMO_ATTR_NAME:
776 setShapeName(value);
777 break;
780 break;
783 break;
784 default:
785 return setCommonAttribute(key, value);
786 break;
787 }
788}
789
790
791void
793 // check what are being updated
795 myShapeHeight = moveResult.shapeToUpdate;
796 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
797 myShapeWidth = moveResult.shapeToUpdate;
798 } else {
799 if (getTagProperty().getTag() == GNE_TAG_POILANE) {
800 myPosOverLane = moveResult.newFirstPos;
801 } else {
802 set(moveResult.shapeToUpdate.front());
803 }
804 // update geometry
806 }
807}
808
809
810void
811GNEPOI::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
812 // check what are being updated
814 undoList->begin(this, "height of " + getTagStr());
816 undoList->end();
817 } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
818 undoList->begin(this, "width of " + getTagStr());
820 undoList->end();
821 } else {
822 undoList->begin(this, "position of " + getTagStr());
823 if (getTagProperty().getTag() == GNE_TAG_POILANE) {
825 } else {
827 }
828 undoList->end();
829 }
830}
831
832/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
unsigned int GUIGlID
Definition GUIGlObject.h:43
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_POI
poi (over view, geo and lane)
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
#define TL(string)
Definition MsgHandler.h:315
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
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_NAME
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_FRIENDLY_POS
@ SUMO_ATTR_LAT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_POSITION
@ GNE_ATTR_SHIFTLANEINDEX
shift lane index (only used by elements over lanes)
@ SUMO_ATTR_RELATIVEPATH
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:78
void reset()
Resets the boundary.
Definition Boundary.cpp:66
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:343
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging)
Definition GLHelper.cpp:961
static bool checkLanePosition(double pos, const double length, const double laneLength, const bool friendlyPos)
check if the given position over a lane is valid
static void fixLanePosition(double &pos, double &length, const double laneLength)
fix given position over lane
An Element which don't belong to GNENet but has influence in the simulation.
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void drawRightGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw right geometry point
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
void drawUpGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw up geometry point
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
bool drawMovingGeometryPoints(const bool ignoreShift) const
check if draw additional extrem geometry points
void drawDownGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw down geometry point
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid)
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool myDrawInFront
boolean to check if drawn this AC over other elements
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
bool isCommonValid(SumoXMLAttr key, const std::string &value)
GNENet * myNet
pointer to net
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double layer, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (circle elements)
bool drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double layer, const double offsetX, const double offsetY, const double rot, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (for rectangled elements)
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
bool getAllowChangeLane() const
allow change lane
CommonModeOptions * getCommonModeOptions() const
get common mode options
move operation
move result
double newFirstPos
new first position
const GNEMoveOperation::OperationType operationType
move operation
PositionVector shapeToUpdate
shape to update (edited in moveElement)
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1390
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1400
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:127
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2163
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their correspond attribute are valids
Definition GNEPOI.cpp:517
Position getPositionInView() const override
Returns position of shape in view.
Definition GNEPOI.cpp:261
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEPOI.cpp:593
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNEPOI.cpp:357
const Parameterised::Map & getACParametersMap() const override
get parameters map
Definition GNEPOI.cpp:480
GNEContour myMovingContourRight
variable used for moving contour right
Definition GNEPOI.h:247
PositionVector myShapeWidth
shape width of POI
Definition GNEPOI.h:232
void drawPOI(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const bool movingGeometryPoints) const
draw POI
Definition GNEPOI.cpp:608
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList) override
commit move shape
Definition GNEPOI.cpp:811
void calculatePOIContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool movingGeometryPoints) const
calculate contour
Definition GNEPOI.cpp:635
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNEPOI.cpp:273
GNEContour myMovingContourLeft
variable used for moving contour left
Definition GNEPOI.h:244
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEPOI.cpp:599
std::string getParentName() const override
Returns the name of the parent object.
Definition GNEPOI.cpp:320
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:403
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNEPOI.cpp:267
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition GNEPOI.cpp:298
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNEPOI.cpp:191
~GNEPOI()
Destructor.
Definition GNEPOI.cpp:89
GNEMoveOperation * getMoveOperation() override
get move operation
Definition GNEPOI.cpp:93
bool isAttributeEnabled(SumoXMLAttr key) const override
Definition GNEPOI.cpp:575
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList) override
remove geometry point in the clicked position
Definition GNEPOI.cpp:132
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEPOI.cpp:474
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition GNEPOI.cpp:138
GNEContour myMovingContourDown
variable used for moving contour down
Definition GNEPOI.h:241
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNEPOI.cpp:164
void updateGeometry() override
update pre-computed geometry information
Definition GNEPOI.cpp:234
bool checkDrawMoveContour() const override
check if draw move contour (red)
Definition GNEPOI.cpp:304
PositionVector myShapeHeight
shape height of POI
Definition GNEPOI.h:235
void setMoveShape(const GNEMoveResult &moveResult) override
set move shape
Definition GNEPOI.cpp:792
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNEPOI.cpp:292
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:177
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:486
GNEPOI(SumoXMLTag tag, GNENet *net)
Constructor.
Definition GNEPOI.cpp:48
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition GNEPOI.cpp:330
GNEContour myMovingContourUp
variable used for moving contour up
Definition GNEPOI.h:238
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all POIattributes
Definition GNEPOI.cpp:144
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isJuPedSimElement() const
return true if tag correspond to a JuPedSim element
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
GNEViewParent * getViewParent() const
get the net object
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
GNEMoveFrame * getMoveFrame() const
get frame for move elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
The popup menu of a globject.
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
GUIGlID getGlID() const
Returns the numerical id of the object.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static bool checkDraw(const GUIVisualizationSettings &s, const GUIGlObject *o)
check if POI can be drawn
static void drawInnerPOI(const GUIVisualizationSettings &s, const PointOfInterest *POI, const GUIGlObject *o, const bool disableSelectionColor, const double layer, const double width, const double height)
draw inner POI (before pushName() )
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
static void clearTextures()
clears loaded textures
Stores the information about how to visualize structures.
bool poiUseCustomLayer
whether the rendering layer of POIs should be overriden
GUIVisualizationSizeSettings poiSize
bool checkDrawPOI(const double w, const double h, const Detail d, const bool selected) const
check if draw POI
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double poiCustomLayer
the custom layer for POIs
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
std::string myID
The name of the object.
Definition Named.h:125
static const std::vector< SumoXMLTag > POIs
POIs namespace.
Static storage of an output device and its base (abstract) implementation.
C++ TraCI client API implementation.
An upper class for objects with additional parameters.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point-of-interest.
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
bool getFriendlyPos() const
returns friendly position
void setHeight(double height)
set the image height of the POI
void setFriendlyPos(const bool friendlyPos)
set friendly position
double myPosLat
lateral position over lane in which this POI is placed (main used by netedit)
void setWidth(double width)
set the image width of the POI
double getHeight() const
Returns the image height of the POI.
bool myFriendlyPos
friendlyPos enable or disable friendly position for position over lane
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
void setIcon(const std::string &icon)
set icon
double myPosOverLane
position over lane in which this POI is placed (main used by netedit)
double getWidth() const
Returns the image width of the POI.
const std::string & getIconStr() const
get icon(in string format)
void writeXML(OutputDevice &out, const bool geo=false, const double zOffset=0., const std::string laneID="", const double pos=0., const bool friendlyPos=false, const double posLat=0.) const
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
double length() const
Computes the length of the given vector.
Definition Position.h:172
Position()
default constructor
Definition Position.h:40
void set(double x, double y)
set positions x and y
Definition Position.h:85
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
A list of positions.
double length2D() const
Returns the length.
void add(double xoff, double yoff, double zoff)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
static const RGBColor ORANGE
Definition RGBColor.h:191
class for maintaining associations between enums and xml-strings
static StringBijection< POIIcon > POIIcons
POI icon values.
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
const std::string getShapeName() const
Returns the name of the Shape.
Definition Shape.h:110
static const double DEFAULT_LAYER_POI
Definition Shape.h:45
void setShapeName(const std::string &name)
Sets a new shape name.
Definition Shape.h:169
void setShapeLayer(const double layer)
Sets a new layer.
Definition Shape.h:150
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition Shape.h:117
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition Shape.h:77
void setShapeType(const std::string &type)
Sets a new type.
Definition Shape.h:129
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition Shape.h:176
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition Shape.h:157
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition Shape.h:164
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition Shape.h:136
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.h:91
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition Shape.h:105
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.h:84
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition Shape.h:98
bool hasString(const std::string &str) const
bool showShapes() const
check if shapes has to be drawn
bool showShapes() const
check if shapes has to be drawn
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double additionalGeometryPointRadius
moving additional geometry point radius
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values