Eclipse SUMO - Simulation of Urban MObility
GNEPOI.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 <string>
24 #include <utils/gui/div/GLHelper.h>
27 #include <netedit/GNENet.h>
28 #include <netedit/GNEUndoList.h>
29 #include <netedit/GNEViewNet.h>
33 
34 #include "GNEPOI.h"
35 
36 
37 // ===========================================================================
38 // method definitions
39 // ===========================================================================
40 
41 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
42  const Position& pos, bool geo, double layer, double angle, const std::string& imgFile,
43  bool relativePath, double width, double height, bool movementBlocked) :
44  PointOfInterest(id, type, color, pos, geo, "", 0, 0, layer, angle, imgFile, relativePath, width, height),
45  GNEShape(id, net, GLO_POI, SUMO_TAG_POI, movementBlocked,
46 {}, {}, {}, {}, {}, {}, {}, {}) {
47  // update centering boundary without updating grid
48  updateCenteringBoundary(false);
49  // set GEO Position
50  myGEOPosition = pos;
51  GeoConvHelper::getFinal().cartesian2geo(myGEOPosition);
52 }
53 
54 
55 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
56  double layer, double angle, const std::string& imgFile, bool relativePath, GNELane* lane, double posOverLane, double posLat,
57  double width, double height, bool movementBlocked) :
58  PointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, posLat, layer, angle, imgFile, relativePath, width, height),
59  GNEShape(id, net, GLO_POI, SUMO_TAG_POILANE, movementBlocked,
60 {}, {}, {lane}, {}, {}, {}, {}, {}) {
61  // update centering boundary without updating grid
62  updateCenteringBoundary(false);
63 }
64 
65 
67 
68 
70 GNEPOI::getMoveOperation(const double /* shapeOffset */) {
71  // return move operation for a position
72  return new GNEMoveOperation(this, *this);
73 }
74 
75 
76 void
77 GNEPOI::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
78  // nothing to remove
79 }
80 
81 
82 std::string
84  int counter = (int)myNet->getAttributeCarriers()->getShapes().at(SUMO_TAG_POI).size();
85  while (myNet->retrieveShape(SUMO_TAG_POI, getID() + toString(childTag) + toString(counter), false) != nullptr) {
86  counter++;
87  }
88  return (getID() + toString(childTag) + toString(counter));
89 }
90 
91 
92 void
93 GNEPOI::setParameter(const std::string& key, const std::string& value) {
94  Parameterised::setParameter(key, value);
95 }
96 
97 
98 void
100  if (getParentLanes().size() > 0) {
101  // obtain fixed position over lane
102  double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShape().length() ? getParentLanes().at(0)->getLaneShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
103  // write POILane using POI::writeXML
104  writeXML(device, false, 0, getParentLanes().at(0)->getID(), fixedPositionOverLane, myPosLat);
105  } else {
106  writeXML(device, myGeo);
107  }
108 }
109 
110 
111 void
113  if (getParentLanes().size() > 0) {
114  // obtain fixed position over lane
115  double fixedPositionOverLane = myPosOverLane > getParentLanes().at(0)->getLaneShapeLength() ? getParentLanes().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
116  // set new position regarding to lane
117  set(getParentLanes().at(0)->getLaneShape().positionAtOffset(fixedPositionOverLane * getParentLanes().at(0)->getLengthGeometryFactor(), -myPosLat));
118  }
119 }
120 
121 
122 void
123 GNEPOI::updateCenteringBoundary(const bool updateGrid) {
124  // Remove object from net
125  if (updateGrid) {
127  }
128  // reset boundary
129  myBoundary.reset();
130  // add position (this POI)
131  myBoundary.add(*this);
132  // grow boundary
133  myBoundary.grow(10 + std::max(getWidth(), getHeight()));
134  // add object into net
135  if (updateGrid) {
136  myNet->addGLObjectIntoGrid(this);
137  }
138 }
139 
140 
141 GUIGlID
143  return GUIGlObject::getGlID();
144 }
145 
146 
147 std::string
149  if (getParentLanes().size() > 0) {
150  return getParentLanes().front()->getID();
151  } else {
152  return myNet->getMicrosimID();
153  }
154 }
155 
156 
159  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
160  buildPopupHeader(ret, app);
163  // build selection and show parameters menu
166  if (getParentLanes().size() > 0) {
167  // build shape header
169  // add option for convert to GNEPOI
171  return ret;
172  } else {
173  // build shape header
175  // add option for convert to GNEPOI
177  }
178  return ret;
179 }
180 
181 
184  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
185  // add items
186  ret->mkItem("type", false, getShapeType());
187  ret->mkItem("layer", false, getShapeLayer());
188  ret->closeBuilding(this);
189  return ret;
190 }
191 
192 
193 void
195  // first check if POI can be drawn
197  // check if boundary has to be drawn
198  if (s.drawBoundaries) {
200  }
201  // check if POI can be drawn
202  if (GUIPointOfInterest::checkDraw(s, this)) {
203  // obtain POIExaggeration
204  const double POIExaggeration = s.poiSize.getExaggeration(s, this);
205  // push name (needed for getGUIGlObjectsUnderCursor(...)
206  glPushName(getGlID());
207  // draw inner polygon
208  if (myNet->getViewNet()->getFrontAttributeCarrier() == this) {
210  } else {
212  }
213  // draw an orange square mode if there is an image(see #4036)
214  if (!getShapeImgFile().empty() && myNet->getViewNet()->getTestingMode().isTestingEnabled()) {
215  // Add a draw matrix for drawing logo
216  glPushMatrix();
217  glTranslated(x(), y(), getType() + 0.01);
219  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
220  glPopMatrix();
221  }
222  // check if dotted contour has to be drawn
224  if (getShapeImgFile().empty()) {
226  } else {
228  }
229  }
230  // pop name
231  glPopName();
232  }
233  }
234 }
235 
236 
237 std::string
239  switch (key) {
240  case SUMO_ATTR_ID:
241  return myID;
242  case SUMO_ATTR_COLOR:
243  return toString(getShapeColor());
244  case SUMO_ATTR_LANE:
245  return myLane;
246  case SUMO_ATTR_POSITION:
247  if (getParentLanes().size() > 0) {
248  return toString(myPosOverLane);
249  } else {
250  return toString(*this);
251  }
253  return toString(myPosLat);
256  case SUMO_ATTR_GEO:
257  return toString(myGeo);
258  case SUMO_ATTR_TYPE:
259  return getShapeType();
260  case SUMO_ATTR_LAYER:
262  return "default";
263  } else {
264  return toString(getShapeLayer());
265  }
266  case SUMO_ATTR_IMGFILE:
267  return getShapeImgFile();
269  return toString(getShapeRelativePath());
270  case SUMO_ATTR_WIDTH:
271  return toString(getWidth());
272  case SUMO_ATTR_HEIGHT:
273  return toString(getHeight());
274  case SUMO_ATTR_ANGLE:
275  return toString(getShapeNaviDegree());
277  return toString(myBlockMovement);
278  case GNE_ATTR_SELECTED:
280  case GNE_ATTR_PARAMETERS:
281  return getParametersStr();
282  default:
283  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
284  }
285 }
286 
287 
288 void
289 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
290  if (value == getAttribute(key)) {
291  return; //avoid needless changes, later logic relies on the fact that attributes have changed
292  }
293  switch (key) {
294  case SUMO_ATTR_ID:
295  case SUMO_ATTR_COLOR:
296  case SUMO_ATTR_LANE:
297  case SUMO_ATTR_POSITION:
300  case SUMO_ATTR_GEO:
301  case SUMO_ATTR_TYPE:
302  case SUMO_ATTR_LAYER:
303  case SUMO_ATTR_IMGFILE:
305  case SUMO_ATTR_WIDTH:
306  case SUMO_ATTR_HEIGHT:
307  case SUMO_ATTR_ANGLE:
309  case GNE_ATTR_SELECTED:
310  case GNE_ATTR_PARAMETERS:
311  undoList->p_add(new GNEChange_Attribute(this, key, value));
312  break;
313  default:
314  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
315  }
316 }
317 
318 
319 bool
320 GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
321  switch (key) {
322  case SUMO_ATTR_ID:
323  return SUMOXMLDefinitions::isValidTypeID(value) &&
324  (myNet->retrieveShape(SUMO_TAG_POI, value, false) == nullptr);
325  case SUMO_ATTR_COLOR:
326  return canParse<RGBColor>(value);
327  case SUMO_ATTR_LANE:
328  return (myNet->retrieveLane(value, false) != nullptr);
329  case SUMO_ATTR_POSITION:
330  if (getParentLanes().size() > 0) {
331  return canParse<double>(value);
332  } else {
333  return canParse<Position>(value);
334  }
336  return canParse<double>(value);
337  case SUMO_ATTR_GEOPOSITION: {
338  return canParse<Position>(value);
339  }
340  case SUMO_ATTR_GEO:
341  return canParse<bool>(value);
342  case SUMO_ATTR_TYPE:
343  return true;
344  case SUMO_ATTR_LAYER:
345  if (value == "default") {
346  return true;
347  } else {
348  return canParse<double>(value);
349  }
350  case SUMO_ATTR_IMGFILE:
351  if (value == "") {
352  return true;
353  } else {
354  // check that image can be loaded
355  return GUITexturesHelper::getTextureID(value) != -1;
356  }
358  return canParse<bool>(value);
359  case SUMO_ATTR_WIDTH:
360  return canParse<double>(value) && (parse<double>(value) > 0);
361  case SUMO_ATTR_HEIGHT:
362  return canParse<double>(value) && (parse<double>(value) > 0);
363  case SUMO_ATTR_ANGLE:
364  return canParse<double>(value);
366  return canParse<bool>(value);
367  case GNE_ATTR_SELECTED:
368  return canParse<bool>(value);
369  case GNE_ATTR_PARAMETERS:
370  return Parameterised::areParametersValid(value);
371  default:
372  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
373  }
374 }
375 
376 
377 bool
379  // check if we're in supermode Network
381  return true;
382  } else {
383  return false;
384  }
385 }
386 
387 
388 const std::map<std::string, std::string>&
390  return getParametersMap();
391 }
392 
393 // ===========================================================================
394 // private
395 // ===========================================================================
396 
397 void
398 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
399  switch (key) {
400  case SUMO_ATTR_ID: {
401  // note: getAttributeCarriers().updateID doesn't change Microsim ID in GNEShapes
402  myNet->getAttributeCarriers()->updateID(this, value);
403  // set named ID
404  myID = value;
405  break;
406  }
407  case SUMO_ATTR_COLOR:
408  setShapeColor(parse<RGBColor>(value));
409  break;
410  case SUMO_ATTR_LANE:
411  myLane = value;
413  break;
414  case SUMO_ATTR_POSITION: {
415  if (getParentLanes().size() > 0) {
416  if (canParse<double>(value)) {
417  myPosOverLane = parse<double>(value);
418  }
419  } else {
420  // set position
421  set(parse<Position>(value));
422  // set GEO Position
423  myGEOPosition.setx(this->x());
424  myGEOPosition.sety(this->y());
425  myGEOPosition.setz(this->z());
427  }
428  // update centering boundary
430  break;
431  }
433  myPosLat = parse<double>(value);
434  // update centering boundary
436  break;
437  case SUMO_ATTR_GEOPOSITION: {
438  // set new position
439  myGEOPosition = parse<Position>(value);
440  // set cartesian Position
443  // update centering boundary
445  break;
446  }
447  case SUMO_ATTR_GEO:
448  myGeo = parse<bool>(value);
449  break;
450  case SUMO_ATTR_TYPE:
451  setShapeType(value);
452  break;
453  case SUMO_ATTR_LAYER:
454  if (value == "default") {
456  } else {
457  setShapeLayer(parse<double>(value));
458  }
459  break;
460  case SUMO_ATTR_IMGFILE:
461  // first remove object from grid due img file affect to boundary
463  setShapeImgFile(value);
464  // all textures must be refresh
466  // add object into grid again
467  myNet->addGLObjectIntoGrid(this);
468  break;
470  setShapeRelativePath(parse<bool>(value));
471  break;
472  case SUMO_ATTR_WIDTH:
473  // set new width
474  setWidth(parse<double>(value));
475  // update centering boundary
477  break;
478  case SUMO_ATTR_HEIGHT:
479  // set new height
480  setHeight(parse<double>(value));
481  // update centering boundary
483  break;
484  case SUMO_ATTR_ANGLE:
485  setShapeNaviDegree(parse<double>(value));
486  break;
488  myBlockMovement = parse<bool>(value);
489  break;
490  case GNE_ATTR_SELECTED:
491  if (parse<bool>(value)) {
493  } else {
495  }
496  break;
497  case GNE_ATTR_PARAMETERS:
498  setParametersStr(value);
499  break;
500  default:
501  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
502  }
503 }
504 
505 
506 void
508  // set geometry
509  set(moveResult.shapeToUpdate.front());
510 }
511 
512 
513 void
514 GNEPOI::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
515  undoList->p_begin("position of " + getTagStr());
516  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(moveResult.shapeToUpdate.front())));
517  undoList->p_end();
518 }
519 
520 /****************************************************************************/
@ MID_GNE_POI_TRANSFORM
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:1039
unsigned int GUIGlID
Definition: GUIGlObject.h:40
@ GLO_DOTTEDCONTOUR_FRONT
dotted contour front element (used in NETEDIT)
@ GLO_POI
a poi
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_LANE
@ SUMO_ATTR_GEOPOSITION
@ GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_POSITION_LAT
@ SUMO_ATTR_GEO
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_ANGLE
@ SUMO_ATTR_HEIGHT
@ SUMO_ATTR_TYPE
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ SUMO_ATTR_IMGFILE
@ SUMO_ATTR_WIDTH
@ SUMO_ATTR_POSITION
@ SUMO_ATTR_RELATIVEPATH
int gPrecisionGeo
Definition: StdDefs.cpp:26
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
void reset()
Resets the boundary.
Definition: Boundary.cpp:65
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:647
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:446
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:135
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
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:45
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
const std::map< SumoXMLTag, std::map< std::string, GNEShape * > > & getShapes() const
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1411
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1423
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1337
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
GNEShape * retrieveShape(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named shape.
Definition: GNENet.cpp:2944
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEPOI.cpp:389
GNEPOI(GNENet *net, const std::string &id, const std::string &type, const RGBColor &color, const Position &pos, bool geo, double layer, double angle, const std::string &imgFile, bool relativePath, double width, double height, bool movementBlocked)
Constructor.
Definition: GNEPOI.cpp:41
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPOI.cpp:158
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:142
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPOI.cpp:514
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:66
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPOI.cpp:148
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPOI.cpp:378
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPOI.cpp:507
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:183
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition: GNEPOI.cpp:123
void writeShape(OutputDevice &device)
writte shape element into a xml file
Definition: GNEPOI.cpp:99
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEPOI.cpp:83
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNEPOI.cpp:77
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPOI.cpp:194
const std::string & getID() const
needed to avoid diamond problem between PointOfInterest and GNEShape
Definition: GNEShape.cpp:53
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspond attribute are valids
Definition: GNEPOI.cpp:320
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNEPOI.cpp:70
void updateGeometry()
update pre-computed geometry information
Definition: GNEPOI.cpp:112
std::string getAttribute(SumoXMLAttr key) const
method for getting the Attribute of an XML key
Definition: GNEPOI.cpp:238
Position myGEOPosition
Position of POI in GEO coordinates (Only used by POIs that aren't placed over lanes)
Definition: GNEPOI.h:188
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Definition: GNEPOI.cpp:93
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNEPOI.cpp:289
Boundary myBoundary
object boundary
Definition: GNEShape.h:204
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:207
void replaceShapeParentLanes(const std::string &value)
replace shape parent lanes
Definition: GNEShape.cpp:142
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:491
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:467
const GNEViewNetHelper::TestingMode & getTestingMode() const
get testing mode
Definition: GNEViewNet.cpp:473
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:368
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:485
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
The popup menu of a globject.
virtual 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 buildShapePopupOptions(GUIMainWindow &app, GUIGLObjectPopupMenu *ret, const std::string &type)
build basic shape popup options. Used to unify pop-ups menu in netedit and SUMO-GUI
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.
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
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
static void drawInnerPOI(const GUIVisualizationSettings &s, const PointOfInterest *POI, const GUIGlObject *o, const bool disableSelectionColor, const double layer)
draw inner POI (before pushName() )
static bool checkDraw(const GUIVisualizationSettings &s, const GUIGlObject *o)
check if POI can be drawn
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 drawBoundaries
enable or disable draw boundaries
GUIVisualizationSizeSettings poiSize
bool drawDottedContour() const
check if dotted contour can be drawn
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
std::string myID
The name of the object.
Definition: Named.h:124
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
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"
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
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".
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point-of-interest.
void writeXML(OutputDevice &out, const bool geo=false, const double zOffset=0., const std::string laneID="", const double pos=0., const double posLat=0.)
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
void setHeight(double height)
set the image height of the POI
double myPosLat
latereal 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.
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
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.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
Position()
default constructor
Definition: Position.h:39
void setx(double x)
set position x
Definition: Position.h:69
void set(double x, double y)
set positions x and y
Definition: Position.h:84
double x() const
Returns the x-position.
Definition: Position.h:54
void setz(double z)
set position z
Definition: Position.h:79
double z() const
Returns the z-position.
Definition: Position.h:64
void sety(double y)
set position y
Definition: Position.h:74
double y() const
Returns the y-position.
Definition: Position.h:59
static const RGBColor ORANGE
Definition: RGBColor.h:186
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:80
static const double DEFAULT_LAYER_POI
Definition: Shape.h:43
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:101
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:141
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:108
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:120
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:162
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:148
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:155
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:127
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:87
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:94
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:73
static void drawDottedContourCircle(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double radius, const double exaggeration)
draw dotted contour for the given Position and radius (used by Juctions and POIs)
static void drawDottedSquaredShape(const DottedContourType type, const GUIVisualizationSettings &s, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double exaggeration)
draw dotted squared contour (used by additionals and demand elements)
bool showShapes() const
check if shapes has to be drawn
bool showShapes() const
check if shapes has to be drawn
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
bool isTestingEnabled() const
check if testing mode is enabled
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values