Eclipse SUMO - Simulation of Urban MObility
GNEParkingSpace.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 lane area vehicles can halt at (GNE version)
19 /****************************************************************************/
20 #include <netedit/GNENet.h>
21 #include <netedit/GNEUndoList.h>
22 #include <netedit/GNEViewNet.h>
24 #include <utils/gui/div/GLHelper.h>
27 
28 #include "GNEParkingSpace.h"
29 
30 
31 // ===========================================================================
32 // method definitions
33 // ===========================================================================
34 
37 {}, {}, {}, {}, {}, {}),
38 mySlope(0) {
39  // reset default values
41 }
42 
43 
44 GNEParkingSpace::GNEParkingSpace(GNENet* net, GNEAdditional* parkingAreaParent, const Position& pos,
45  const std::string& width, const std::string& length, const std::string& angle, double slope,
46  const std::string& name, const Parameterised::Map& parameters) :
48 {}, {}, {}, {parkingAreaParent}, {}, {}),
49 Parameterised(parameters),
50 myPosition(pos),
51 myWidth(width),
52 myLength(length),
53 myAngle(angle),
54 mySlope(slope) {
55  // update centering boundary without updating grid
56  updateCenteringBoundary(false);
57 }
58 
59 
61 
62 
68  // get snap radius
70  // get mouse position
71  const Position mousePosition = myNet->getViewNet()->getPositionInformation();
72  // check if we're editing width or height
73  if (myShapeLength.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
74  // edit length
76  } else if (myShapeWidth.front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
77  // edit width
79  } else if (myShapeWidth.back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
80  // edit width
82  } else {
83  return nullptr;
84  }
85  } else {
86  // move entire space
87  return new GNEMoveOperation(this, myPosition);
88  }
89 }
90 
91 
92 void
94  device.openTag(getTagProperty().getTag());
95  if (!myAdditionalName.empty()) {
97  }
98  device.writeAttr(SUMO_ATTR_X, myPosition.x());
99  device.writeAttr(SUMO_ATTR_Y, myPosition.y());
100  if (myPosition.z() != 0) {
101  device.writeAttr(SUMO_ATTR_Z, myPosition.z());
102  }
103  if (myWidth.size() > 0) {
105  }
106  if (myLength.size() > 0) {
108  }
109  if (myAngle.size() > 0) {
111  }
114  }
115  // write parameters (Always after children to avoid problems with additionals.xsd)
116  writeParams(device);
117  device.closeTag();
118 }
119 
120 
122  return true;
123 }
124 
125 
127  return "";
128 }
129 
130 
132  // nothing to fix
133 }
134 
135 
136 bool
138  // get edit modes
139  const auto& editModes = myNet->getViewNet()->getEditModes();
140  // check if we're in move mode
141  if (!myNet->getViewNet()->isMovingElement() && editModes.isCurrentSupermodeNetwork() &&
142  (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
143  // only move the first element
145  } else {
146  return false;
147  }
148 }
149 
150 
151 void
153  // get width an length
154  const double width = getAttributeDouble(SUMO_ATTR_WIDTH) <= 0 ? POSITION_EPS : getAttributeDouble(SUMO_ATTR_WIDTH);
155  const double length = getAttributeDouble(SUMO_ATTR_LENGTH) <= 0 ? POSITION_EPS : getAttributeDouble(SUMO_ATTR_LENGTH);
156  // calculate shape length
157  myShapeLength.clear();
158  myShapeLength.push_back(Position(0, 0));
159  myShapeLength.push_back(Position(0, length));
160  // rotate
162  // move
164  // calculate shape width
165  PositionVector leftShape = myShapeLength;
166  leftShape.move2side(width * -0.5);
167  PositionVector rightShape = myShapeLength;
168  rightShape.move2side(width * 0.5);
169  myShapeWidth = {leftShape.getCentroid(), rightShape.getCentroid()};
170  // update centering boundary
172 }
173 
174 
175 Position
177  return myPosition;
178 }
179 
180 
181 void
183  // remove additional from grid
184  if (updateGrid) {
186  }
187  // first reset boundary
189  // add position
191  // grow width and length
194  // grow
196  // add additional into RTREE again
197  if (updateGrid) {
198  myNet->addGLObjectIntoGrid(this);
199  }
200 }
201 
202 
203 void
204 GNEParkingSpace::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
205  // geometry of this element cannot be splitted
206 }
207 
208 
209 std::string
211  return getParentAdditionals().at(0)->getID();
212 }
213 
214 
215 void
217  // draw boundaries
219  // first check if additional has to be drawn
221  // get exaggeration
222  const double spaceExaggeration = getExaggeration(s);
223  // get witdh
224  const double parkingSpaceWidth = myShapeWidth.length2D() * 0.5 + (spaceExaggeration * 0.1);
225  // get detail level
226  const auto d = s.getDetailLevel(spaceExaggeration);
227  // draw geometry only if we'rent in drawForObjectUnderCursor mode
228  if (!s.drawForViewObjectsHandler) {
229  // draw space
230  drawSpace(s, d, parkingSpaceWidth);
231  // draw parent and child lines
233  // draw lock icon
235  // Draw additional ID
236  drawAdditionalID(s);
237  // draw additional name
239  // draw dotted contour
241  }
242  // calculate contour
243  calculateSpaceContour(s, d, parkingSpaceWidth, spaceExaggeration);
244  }
245 }
246 
247 
248 std::string
250  switch (key) {
251  case SUMO_ATTR_ID:
252  return getMicrosimID();
253  case SUMO_ATTR_POSITION:
254  return toString(myPosition);
255  case SUMO_ATTR_NAME:
256  return myAdditionalName;
257  case SUMO_ATTR_WIDTH:
258  return myWidth;
259  case SUMO_ATTR_LENGTH:
260  return myLength;
261  case SUMO_ATTR_ANGLE:
262  return myAngle;
263  case SUMO_ATTR_SLOPE:
264  return toString(mySlope);
265  case GNE_ATTR_PARENT:
266  return getParentAdditionals().at(0)->getID();
267  case GNE_ATTR_SELECTED:
269  case GNE_ATTR_PARAMETERS:
270  return getParametersStr();
271  default:
272  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
273  }
274 }
275 
276 
277 double
279  switch (key) {
280  case SUMO_ATTR_WIDTH:
281  return myWidth.empty() ? getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_WIDTH) : parse<double>(myWidth);
282  case SUMO_ATTR_LENGTH:
283  return myLength.empty() ? getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_LENGTH) : parse<double>(myLength);
284  case SUMO_ATTR_ANGLE:
285  return myAngle.empty() ? getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ANGLE) : parse<double>(myAngle);
286  default:
287  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
288  }
289 }
290 
291 
292 const Parameterised::Map&
294  return getParametersMap();
295 }
296 
297 
298 void
299 GNEParkingSpace::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
300  if (value == getAttribute(key)) {
301  return; //avoid needless changes, later logic relies on the fact that attributes have changed
302  }
303  switch (key) {
304  case SUMO_ATTR_POSITION:
305  case SUMO_ATTR_NAME:
306  case SUMO_ATTR_WIDTH:
307  case SUMO_ATTR_LENGTH:
308  case SUMO_ATTR_ANGLE:
309  case SUMO_ATTR_SLOPE:
310  case GNE_ATTR_PARENT:
311  case GNE_ATTR_SELECTED:
312  case GNE_ATTR_PARAMETERS:
313  GNEChange_Attribute::changeAttribute(this, key, value, undoList);
314  break;
315  default:
316  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
317  }
318 }
319 
320 
321 bool
322 GNEParkingSpace::isValid(SumoXMLAttr key, const std::string& value) {
323  switch (key) {
324  case SUMO_ATTR_POSITION:
325  return canParse<Position>(value);
326  case SUMO_ATTR_NAME:
328  case SUMO_ATTR_WIDTH:
329  return value.empty() || (canParse<double>(value) && (parse<double>(value) > 0));
330  case SUMO_ATTR_LENGTH:
331  return value.empty() || (canParse<double>(value) && (parse<double>(value) > 0));
332  case SUMO_ATTR_ANGLE:
333  return value.empty() || canParse<double>(value);
334  case SUMO_ATTR_SLOPE:
335  return canParse<double>(value);
336  case GNE_ATTR_PARENT:
337  return (myNet->getAttributeCarriers()->retrieveAdditional(SUMO_TAG_PARKING_AREA, value, false) != nullptr);
338  case GNE_ATTR_SELECTED:
339  return canParse<bool>(value);
340  case GNE_ATTR_PARAMETERS:
341  return areParametersValid(value);
342  default:
343  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
344  }
345 }
346 
347 
348 std::string
350  return getTagStr();
351 }
352 
353 
354 std::string
356  return getTagStr() + ": " + getAttribute(SUMO_ATTR_POSITION);
357 }
358 
359 // ===========================================================================
360 // private
361 // ===========================================================================
362 
363 void
365  const double width) const {
366  // get angle
367  const double angle = getAttributeDouble(SUMO_ATTR_ANGLE);
368  // get contour color
370  if (drawUsingSelectColor()) {
371  contourColor = s.colorSettings.selectedAdditionalColor;
373  contourColor = s.colorSettings.parkingSpaceColorContour;
374  }
375  // push later matrix
377  // translate to front
379  // set contour color
380  GLHelper::setColor(contourColor);
381  // draw extern
383  // make a copy of myShapeLength and scale
384  PositionVector shapeLengthInner = myShapeLength;
385  shapeLengthInner.scaleAbsolute(-0.1);
386  // draw intern
388  // Traslate to front
389  glTranslated(0, 0, 0.1);
390  // set base color
392  //draw intern
393  GLHelper::drawBoxLines(shapeLengthInner, width - 0.1);
394  }
395  // draw geometry points
396  drawUpGeometryPoint(s, d, myShapeLength.back(), angle, contourColor);
397  drawLeftGeometryPoint(s, d, myShapeWidth.back(), angle - 90, contourColor);
398  drawRightGeometryPoint(s, d, myShapeWidth.front(), angle - 90, contourColor);
399  // pop layer matrix
401 }
402 
403 
404 void
406  const double width, const double exaggeration) const {
407  // calculate contour and draw dotted geometry
408  myAdditionalContour.calculateContourExtrudedShape(s, d, this, myShapeLength, width, exaggeration, true, true, 0);
409 }
410 
411 
412 void
413 GNEParkingSpace::setAttribute(SumoXMLAttr key, const std::string& value) {
414  switch (key) {
415  case SUMO_ATTR_POSITION:
416  myPosition = parse<Position>(value);
417  // update geometry
418  updateGeometry();
419  break;
420  case SUMO_ATTR_NAME:
421  myAdditionalName = value;
422  break;
423  case SUMO_ATTR_WIDTH:
424  myWidth = value;
425  // update geometry (except for template)
426  if (getParentAdditionals().size() > 0) {
427  updateGeometry();
428  }
429  break;
430  case SUMO_ATTR_LENGTH:
431  myLength = value;
432  // update geometry (except for template)
433  if (getParentAdditionals().size() > 0) {
434  updateGeometry();
435  }
436  break;
437  case SUMO_ATTR_ANGLE:
438  myAngle = value;
439  // update geometry (except for template)
440  if (getParentAdditionals().size() > 0) {
441  updateGeometry();
442  }
443  break;
444  case SUMO_ATTR_SLOPE:
445  mySlope = parse<double>(value);
446  break;
447  case GNE_ATTR_PARENT:
449  break;
450  case GNE_ATTR_SELECTED:
451  if (parse<bool>(value)) {
453  } else {
455  }
456  break;
457  case GNE_ATTR_PARAMETERS:
458  setParametersStr(value);
459  break;
460  default:
461  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
462  }
463 }
464 
465 
466 void
468  // check what are being updated
470  myShapeLength[1] = moveResult.shapeToUpdate[1];
471  } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
472  myShapeWidth = moveResult.shapeToUpdate;
473  } else {
474  myPosition = moveResult.shapeToUpdate.front();
475  // update geometry
476  updateGeometry();
477  }
478 }
479 
480 
481 void
483  // check what are being updated
485  undoList->begin(this, "length of " + getTagStr());
486  setAttribute(SUMO_ATTR_LENGTH, toString(myShapeLength[0].distanceTo2D(moveResult.shapeToUpdate[1])), undoList);
487  undoList->end();
488  } else if (moveResult.operationType == GNEMoveOperation::OperationType::WIDTH) {
489  undoList->begin(this, "width of " + getTagStr());
490  setAttribute(SUMO_ATTR_WIDTH, toString(moveResult.shapeToUpdate.length2D()), undoList);
491  undoList->end();
492  } else {
493  undoList->begin(this, "position of " + getTagStr());
494  setAttribute(SUMO_ATTR_POSITION, toString(moveResult.shapeToUpdate.front()), undoList);
495  undoList->end();
496  }
497 }
498 
499 /****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ GLO_PARKING_SPACE
a ParkingSpace
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ PARKINGSPACE
#define DEG2RAD(x)
Definition: GeomHelper.h:35
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_Y
@ SUMO_ATTR_Z
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_X
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_NAME
@ SUMO_ATTR_SLOPE
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_LENGTH
@ SUMO_ATTR_ID
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_POSITION
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:319
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:347
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:967
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
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
GNEContour myAdditionalContour
variable used for draw additional contours
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
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
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
std::string myAdditionalName
name of additional
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
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
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
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
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void resetDefaultValues()
reset attribute carrier to their default values
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
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 calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
Definition: GNEContour.cpp:88
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
move operation
move result
const GNEMoveOperation::OperationType operationType
move operation
PositionVector shapeToUpdate
shape to update (edited in moveElement)
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1282
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1291
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:122
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2055
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
double getAttributeDouble(SumoXMLAttr key) const
PositionVector myShapeWidth
shape width of Parking Space
std::string getAttribute(SumoXMLAttr key) const
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Position myPosition
position of Parking Space in view
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspondent attribute are valids
void calculateSpaceContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width, const double exaggeration) const
calculate space contour
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
double mySlope
Slope of Parking Space.
~GNEParkingSpace()
Destructor.
std::string getParentName() const
Returns the name of the parent object.
std::string myAngle
Angle of Parking Space.
Position getPositionInView() const
Returns position of additional in view.
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
GNEParkingSpace(GNENet *net)
Constructor.
std::string myLength
Length of Parking Space.
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GNEMoveOperation * getMoveOperation()
get move operation
void drawSpace(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width) const
draw space
bool checkDrawMoveContour() const
check if draw move contour (red)
const Parameterised::Map & getACParametersMap() const
get parameters map
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string myWidth
width of Parking Space
PositionVector myShapeLength
shape length of Parking Space
void updateGeometry()
update pre-computed geometry information
const std::string & getDefaultValue(SumoXMLAttr attr) const
return the default value of the attribute of an 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 attribute carrier or a pointer to nullptr
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:727
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:703
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:733
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
bool isMovingElement() const
check if an element is being moved
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
Definition: GNEViewNet.cpp:468
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:156
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:143
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:254
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.
Definition: Parameterised.h:41
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
Definition: Parameterised.h:45
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.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
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 in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double x() const
Returns the x-position.
Definition: Position.h:55
double z() const
Returns the z-position.
Definition: Position.h:65
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
void scaleAbsolute(double offset)
enlarges/shrinks the polygon by an absolute offset based at the centroid
double length2D() const
Returns the length.
void rotate2D(double angle)
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 bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
bool showAdditionals() const
check if additionals has to be drawn
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
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 RGBColor connectionColor
connection color
RGBColor parkingSpaceColorContour
color for parkingSpace contour
RGBColor parkingSpaceColor
color for parkingSpace innen
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const double segmentWidth
width of dotted contour segments
static const double additionalGeometryPointRadius
moving additional geometry point radius