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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing and editing POIS in netedit (adapted from
16 // GUIPointOfInterest and NLHandler)
17 /****************************************************************************/
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <string>
26 #include <utility>
29 #include <utils/geom/Position.h>
33 #include <utils/xml/XMLSubSys.h>
38 #include <utils/gui/div/GLHelper.h>
44 #include <netwrite/NWWriter_SUMO.h>
46 #include <netedit/GNENet.h>
48 #include <netedit/GNEUndoList.h>
49 #include <netedit/GNEViewNet.h>
51 #include <netedit/GNEViewParent.h>
52 
53 #include "GNEPOI.h"
54 
55 
56 // ===========================================================================
57 // method definitions
58 // ===========================================================================
59 
60 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
61  const Position& pos, bool geo, double layer, double angle, const std::string& imgFile,
62  bool relativePath, double width, double height, bool movementBlocked) :
63  GUIPointOfInterest(id, type, color, pos, geo, "", 0, 0, layer, angle, imgFile, relativePath, width, height),
64  GNEShape(net, SUMO_TAG_POI, movementBlocked, false),
65  myGNELane(nullptr) {
66  // set GEO Position
67  myGEOPosition = pos;
69 }
70 
71 
72 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
73  double layer, double angle, const std::string& imgFile, bool relativePath, GNELane* lane, double posOverLane, double posLat,
74  double width, double height, bool movementBlocked) :
75  GUIPointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, posLat, layer, angle, imgFile, relativePath, width, height),
76  GNEShape(net, SUMO_TAG_POILANE, movementBlocked, false),
77  myGNELane(lane) {
78 }
79 
80 
82 
83 
84 void
86  // save current centering boundary
88 }
89 
90 
91 void
93  // check that endGeometryMoving was called only once
95  // Remove object from net
97  // reset myMovingGeometryBoundary
99  // update geometry without updating grid
100  updateGeometry(false);
101  // add object into grid again (using the new centering boundary)
102  myNet->addGLObjectIntoGrid(this);
103  }
104 }
105 
106 void
108  if (myGNELane) {
109  // obtain fixed position over lane
110  double fixedPositionOverLane = myPosOverLane > myGNELane->getShape().length() ? myGNELane->getShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
111  // write POILane using POI::writeXML
112  writeXML(device, false, 0, myGNELane->getID(), fixedPositionOverLane, myPosLat);
113  } else {
114  writeXML(device, myGeo);
115  }
116 }
117 
118 
119 void
120 GNEPOI::moveGeometry(const Position& oldPos, const Position& offset) {
121  if (!myBlockMovement) {
122  if (myGNELane) {
123  // Calculate new position using old position
124  Position newPosition = oldPos;
125  newPosition.add(offset);
127  // Update geometry
128  updateGeometry(false);
129  } else {
130  // restore old position, apply offset and refresh element
131  set(oldPos);
132  add(offset);
133  }
134  }
135 }
136 
137 
138 void
140  if (!myBlockMovement) {
141  // restore original Position before moving (to avoid problems in GL Tree)
142  Position myNewPosition(*this);
143  set(oldPos);
144  // commit new position allowing undo/redo
145  if (myGNELane) {
146  // restore old position before commit new position
147  double originalPosOverLane = myGNELane->getShape().nearest_offset_to_point2D(oldPos, false);
148  undoList->p_begin("position of " + toString(getTag()));
149  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosOverLane), true, toString(originalPosOverLane)));
150  undoList->p_end();
151  } else {
152  undoList->p_begin("position of " + toString(getTag()));
153  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myNewPosition), true, toString(oldPos)));
154  undoList->p_end();
155  }
156  }
157 }
158 
159 
160 GNELane*
162  return myGNELane;
163 }
164 
165 
166 void
167 GNEPOI::updateGeometry(bool updateGrid) {
168  // first check if object has to be removed from grid (SUMOTree)
169  if (updateGrid) {
171  }
172  if (myGNELane) {
173  // obtain fixed position over lane
174  double fixedPositionOverLane = myPosOverLane > myGNELane->getLaneShapeLength() ? myGNELane->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
175  // set new position regarding to lane
176  set(myGNELane->getShape().positionAtOffset(fixedPositionOverLane * myGNELane->getLengthGeometryFactor(), -myPosLat));
177  }
178  // last step is to check if object has to be added into grid (SUMOTree) again
179  if (updateGrid) {
180  myNet->addGLObjectIntoGrid(this);
181  }
182 }
183 
184 
185 Position
187  return Position(x(), y());
188 }
189 
190 
191 GUIGlID
194 }
195 
196 
197 std::string
199  return myNet->getMicrosimID();
200 }
201 
202 
205  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
206  if (myGNELane) {
207  // build shape header
209  // add option for convert to GNEPOI
210  new FXMenuCommand(ret, ("Release from " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
211  return ret;
212  } else {
213  // build shape header
215  // add option for convert to GNEPOI
216  new FXMenuCommand(ret, ("Attach to nearest " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
217  }
218  return ret;
219 }
220 
221 
224  return GUIPointOfInterest::getParameterWindow(app, parent);
225 }
226 
227 
228 Boundary
230  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
233  } else {
235  }
236 }
237 
238 
239 void
242  // draw lock icon if isn't in selecting mode
243  if (!s.drawForSelecting) {
244  drawLockIcon(*this, getType() + 0.1, 0.2);
245  }
246  // push matrix
247  glPushName(getGlID());
248  // draw an orange square mode if there is an image(see #4036)
249  if (!getShapeImgFile().empty() && OptionsCont::getOptions().getBool("gui-testing")) {
250  // Add a draw matrix for drawing logo
251  glPushMatrix();
252  glTranslated(x(), y(), getType() + 0.01);
254  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
255  glPopMatrix();
256 
257  }
258  // check if dotted contour has to be drawn
259  if (myNet->getViewNet()->getACUnderCursor() == this) {
262  } else if (myPOIVertices.size() > 0) {
263  glPushMatrix();
264  glTranslated(x(), y(), getType() + 0.01);
266  glPopMatrix();
267  }
268  }
269  // Pop name
270  glPopName();
271 }
272 
273 
274 std::string
276  switch (key) {
277  case SUMO_ATTR_ID:
278  return myID;
279  case SUMO_ATTR_COLOR:
280  return toString(getShapeColor());
281  case SUMO_ATTR_LANE:
282  return myLane;
283  case SUMO_ATTR_POSITION:
284  if (myGNELane) {
285  return toString(myPosOverLane);
286  } else {
287  return toString(*this);
288  }
290  return toString(myPosLat);
293  case SUMO_ATTR_GEO:
294  return toString(myGeo);
295  case SUMO_ATTR_TYPE:
296  return getShapeType();
297  case SUMO_ATTR_LAYER:
299  return "default";
300  } else {
301  return toString(getShapeLayer());
302  }
303  case SUMO_ATTR_IMGFILE:
304  return getShapeImgFile();
306  return toString(getShapeRelativePath());
307  case SUMO_ATTR_WIDTH:
308  return toString(getWidth());
309  case SUMO_ATTR_HEIGHT:
310  return toString(getHeight());
311  case SUMO_ATTR_ANGLE:
312  return toString(getShapeNaviDegree());
314  return toString(myBlockMovement);
315  case GNE_ATTR_SELECTED:
317  case GNE_ATTR_GENERIC:
318  return getGenericParametersStr();
319  default:
320  throw InvalidArgument(toString(getTag()) + " attribute '" + toString(key) + "' not allowed");
321  }
322 }
323 
324 
325 void
326 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
327  if (value == getAttribute(key)) {
328  return; //avoid needless changes, later logic relies on the fact that attributes have changed
329  }
330  switch (key) {
331  case SUMO_ATTR_ID:
332  case SUMO_ATTR_COLOR:
333  case SUMO_ATTR_LANE:
334  case SUMO_ATTR_POSITION:
337  case SUMO_ATTR_GEO:
338  case SUMO_ATTR_TYPE:
339  case SUMO_ATTR_LAYER:
340  case SUMO_ATTR_IMGFILE:
342  case SUMO_ATTR_WIDTH:
343  case SUMO_ATTR_HEIGHT:
344  case SUMO_ATTR_ANGLE:
346  case GNE_ATTR_SELECTED:
347  case GNE_ATTR_GENERIC:
348  undoList->p_add(new GNEChange_Attribute(this, key, value));
349  break;
350  default:
351  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
352  }
353 }
354 
355 
356 bool
357 GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
358  switch (key) {
359  case SUMO_ATTR_ID:
360  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrievePOI(value, false) == 0);
361  case SUMO_ATTR_COLOR:
362  return canParse<RGBColor>(value);
363  case SUMO_ATTR_LANE:
364  return (myNet->retrieveLane(value, false) != nullptr);
365  case SUMO_ATTR_POSITION:
366  if (myGNELane) {
367  canParse<double>(value);
368  } else {
369  bool ok;
370  return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1;
371  }
373  return canParse<double>(value);
374  case SUMO_ATTR_GEOPOSITION: {
375  bool ok;
376  return GeomConvHelper::parseShapeReporting(value, "user-supplied GEO position", 0, ok, false).size() == 1;
377  }
378  case SUMO_ATTR_GEO:
379  return canParse<bool>(value);
380  case SUMO_ATTR_TYPE:
381  return true;
382  case SUMO_ATTR_LAYER:
383  if (value == "default") {
384  return true;
385  } else {
386  return canParse<double>(value);
387  }
388  case SUMO_ATTR_IMGFILE:
389  if (value == "") {
390  return true;
391  } else {
392  // check that image can be loaded
393  return GUITexturesHelper::getTextureID(value) != -1;
394  }
396  return canParse<bool>(value);
397  case SUMO_ATTR_WIDTH:
398  return canParse<double>(value) && (parse<double>(value) >= 0);
399  case SUMO_ATTR_HEIGHT:
400  return canParse<double>(value) && (parse<double>(value) >= 0);
401  case SUMO_ATTR_ANGLE:
402  return canParse<double>(value);
404  return canParse<bool>(value);
405  case GNE_ATTR_SELECTED:
406  return canParse<bool>(value);
407  case GNE_ATTR_GENERIC:
408  return isGenericParametersValid(value);
409  default:
410  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
411  }
412 }
413 
414 
415 bool
416 GNEPOI::addGenericParameter(const std::string& key, const std::string& value) {
417  if (!knowsParameter(key)) {
418  setParameter(key, value);
419  return true;
420  } else {
421  return false;
422  }
423 }
424 
425 
426 bool
427 GNEPOI::removeGenericParameter(const std::string& key) {
428  if (knowsParameter(key)) {
429  unsetParameter(key);
430  return true;
431  } else {
432  return false;
433  }
434 }
435 
436 
437 bool
438 GNEPOI::updateGenericParameter(const std::string& oldKey, const std::string& newKey) {
439  if (knowsParameter(oldKey) && !knowsParameter(newKey)) {
440  std::string value = getParameter(oldKey);
441  unsetParameter(oldKey);
442  setParameter(newKey, value);
443  return true;
444  } else {
445  return false;
446  }
447 }
448 
449 
450 bool
451 GNEPOI::updateGenericParameterValue(const std::string& key, const std::string& newValue) {
452  if (knowsParameter(key)) {
453  setParameter(key, newValue);
454  return true;
455  } else {
456  return false;
457  }
458 }
459 
460 
461 std::string
463  std::string result;
464  // Generate an string using the following structure: "key1=value1|key2=value2|...
465  for (auto i : getParametersMap()) {
466  result += i.first + "=" + i.second + "|";
467  }
468  // remove the last "|"
469  if (!result.empty()) {
470  result.pop_back();
471  }
472  return result;
473 }
474 
475 
476 std::vector<std::pair<std::string, std::string> >
478  std::vector<std::pair<std::string, std::string> > result;
479  // iterate over parameters map and fill result
480  for (auto i : getParametersMap()) {
481  result.push_back(std::make_pair(i.first, i.second));
482  }
483  return result;
484 }
485 
486 
487 void
488 GNEPOI::setGenericParametersStr(const std::string& value) {
489  // clear parameters
490  clearParameter();
491  // separate value in a vector of string using | as separator
492  std::vector<std::string> parsedValues;
493  StringTokenizer stValues(value, "|", true);
494  while (stValues.hasNext()) {
495  parsedValues.push_back(stValues.next());
496  }
497  // check that parsed values (A=B)can be parsed in generic parameters
498  for (auto i : parsedValues) {
499  std::vector<std::string> parsedParameters;
500  StringTokenizer stParam(i, "=", true);
501  while (stParam.hasNext()) {
502  parsedParameters.push_back(stParam.next());
503  }
504  // Check that parsed parameters are exactly two and contains valid chracters
505  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
506  setParameter(parsedParameters.front(), parsedParameters.back());
507  }
508  }
509 }
510 
511 // ===========================================================================
512 // private
513 // ===========================================================================
514 
515 void
516 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
517  switch (key) {
518  case SUMO_ATTR_ID: {
519  std::string oldID = myID;
520  myID = value;
521  myNet->changeShapeID(this, oldID);
522  setMicrosimID(value);
523  break;
524  }
525  case SUMO_ATTR_COLOR:
526  setShapeColor(parse<RGBColor>(value));
527  break;
528  case SUMO_ATTR_LANE:
529  myLane = value;
531  myGNELane = myNet->retrieveLane(value);
532  myGNELane->addShapeChild(this);
533  updateGeometry(true);
534  break;
535  case SUMO_ATTR_POSITION: {
536  // first remove object from grid due position is used for boundary
538  if (myGNELane) {
539  myPosOverLane = parse<double>(value);
540  } else {
541  bool ok = true;
542  set(GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]);
543  // set GEO Position
544  myGEOPosition = *this;
546  }
547  // add object into grid again
548  myNet->addGLObjectIntoGrid(this);
549  break;
550  }
552  // first remove object from grid due position is used for boundary
554  myPosLat = parse<double>(value);
555  // add object into grid again
556  myNet->addGLObjectIntoGrid(this);
557  break;
558  case SUMO_ATTR_GEOPOSITION: {
559  // first remove object from grid due position is used for boundary
561  bool ok = true;
562  myGEOPosition = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0];
563  // set cartesian Position
564  set(myGEOPosition);
566  // add object into grid again
567  myNet->addGLObjectIntoGrid(this);
568  break;
569  }
570  case SUMO_ATTR_GEO:
571  myGeo = parse<bool>(value);
572  break;
573  case SUMO_ATTR_TYPE:
574  setShapeType(value);
575  break;
576  case SUMO_ATTR_LAYER:
577  if (value == "default") {
579  } else {
580  setShapeLayer(parse<double>(value));
581  }
582  break;
583  case SUMO_ATTR_IMGFILE:
584  // first remove object from grid due img file affect to boundary
586  setShapeImgFile(value);
587  // all textures must be refresh
589  // add object into grid again
590  myNet->addGLObjectIntoGrid(this);
591  break;
593  setShapeRelativePath(parse<bool>(value));
594  break;
595  case SUMO_ATTR_WIDTH:
596  // first remove object from grid due position is used for boundary
598  setWidth(parse<double>(value));
599  // add object into grid again
600  myNet->addGLObjectIntoGrid(this);
601  break;
602  case SUMO_ATTR_HEIGHT:
603  // first remove object from grid due position is used for boundary
605  setHeight(parse<double>(value));
606  // add object into grid again
607  myNet->addGLObjectIntoGrid(this);
608  break;
609  case SUMO_ATTR_ANGLE:
610  setShapeNaviDegree(parse<double>(value));
611  break;
613  myBlockMovement = parse<bool>(value);
614  break;
615  case GNE_ATTR_SELECTED:
616  if (parse<bool>(value)) {
618  } else {
620  }
621  break;
622  case GNE_ATTR_GENERIC:
624  break;
625  default:
626  throw InvalidArgument(toString(getTag()) + " attribute '" + toString(key) + "' not allowed");
627  }
628  // After setting attribute always update Geometry
629  updateGeometry(true);
630 }
631 
632 
633 void
635 }
636 
637 
638 /****************************************************************************/
const GNEAttributeCarrier * getACUnderCursor() const
get AttributeCarrier under cursor
void startGeometryMoving()
Definition: GNEPOI.cpp:85
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPOI.cpp:186
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 ...
std::string next()
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPOI.cpp:120
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:47
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:103
begin/end of the description of a single lane
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:126
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:129
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:157
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPOI.cpp:240
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:192
static const double DEFAULT_LAYER_POI
Definition: Shape.h:45
A layer number.
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNEShape.h:199
double myPosOverLane
position over lane in which this POI is placed (main used by netedit)
Stores the information about how to visualize structures.
void setShapeType(const std::string &type)
Sets a new type.
Definition: Shape.h:122
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEShape.cpp:130
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:326
double y() const
Returns the y-position.
Definition: Position.h:61
void unsetParameter(const std::string &key)
Removes a parameter.
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:953
double x() const
Returns the x-position.
Definition: Position.h:56
static const RGBColor ORANGE
Definition: RGBColor.h:178
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPOI.cpp:204
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:60
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:81
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:80
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:47
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:78
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
begin/end of the description of a Point of interest
double getHeight() const
Returns the image height of the POI.
GNELane * getLane() const
get GNELane
Definition: GNEPOI.cpp:161
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:764
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
GNENet * myNet
the net to inform about updates
Definition: GNEShape.h:196
generic attribute
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEShape.cpp:104
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
Definition: GNEPOI.cpp:634
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition: Shape.h:75
void drawLockIcon(const Position &pos, double layer, double size=0.5) const
draw lock icon
Definition: GNEShape.cpp:69
double myPosLat
latereal position over lane in which this POI is placed (main used by netedit)
bool addGenericParameter(const std::string &key, const std::string &value)
add generic parameter
Definition: GNEPOI.cpp:416
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
Definition: Shape.h:150
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void writeXML(OutputDevice &out, const bool geo=false, const double zOffset=0., const std::string laneID="", const double pos=0., const double posLat=0.)
static void clearTextures()
clears loaded textures
double myHalfImgHeight
The half height of the image when rendering this POI.
std::string myLane
ID of lane in which this POI is placed (main used by netedit)
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEPOI.cpp:462
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:110
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNEPOI.cpp:139
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:49
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:573
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspond attribute are valids
Definition: GNEPOI.cpp:357
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:202
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:85
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
int gPrecisionGeo
Definition: StdDefs.cpp:28
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1167
friend class GNEChange_Attribute
declare friend class
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:82
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPOI.cpp:229
void addShapeChild(GNEShape *shape)
add shape child to this lane
Definition: GNELane.cpp:732
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
block movement of a graphic element
double getLengthGeometryFactor() const
get lenght geometry factor
Definition: GNELane.cpp:1287
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPOI.cpp:198
double myHalfImgWidth
The half width of the image when rendering this POI.
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
Definition: GNENet.cpp:2039
double getLaneShapeLength() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:726
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:89
double getWidth() const
Returns the image width of the POI.
void updateGeometry(bool updateGrid)
update pre-computed geometry information
Definition: GNEPOI.cpp:167
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
bool updateGenericParameterValue(const std::string &key, const std::string &newValue)
update value generic parameter
Definition: GNEPOI.cpp:451
unsigned int GUIGlID
Definition: GUIGlObject.h:43
GUIVisualizationSizeSettings poiSize
void reset()
Resets the boundary.
Definition: Boundary.cpp:67
std::string myID
The name of the object.
Definition: Named.h:121
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:613
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPOI.cpp:488
double length() const
Returns the length.
Position myGEOPosition
Position of POI in GEO coordinates (Only used by POIs that aren&#39;t placed over lanes) ...
Definition: GNEPOI.h:218
void setHeight(double height)
set the image height of the POI
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
static void drawShapeDottedContour(const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
Definition: GLHelper.cpp:471
bool updateGenericParameter(const std::string &oldKey, const std::string &newKey)
update generic parameter
Definition: GNEPOI.cpp:438
void setWidth(double width)
set the image width of the POI
static std::vector< Position > myPOIVertices
after every iteration of drawgl, position of vertices that make the circle are saved here...
element is selected
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
The popup menu of a globject.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
std::string getAttribute(SumoXMLAttr key) const
method for getting the Attribute of an XML key
Definition: GNEPOI.cpp:275
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEShape.cpp:117
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
GUIGlID getGlID() const
Returns the numerical id of the object.
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
void writeShape(OutputDevice &device)
writte shape element into a xml file
Definition: GNEPOI.cpp:107
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEPOI.cpp:477
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation. ...
void removeShapeChild(GNEShape *shape)
remove shape child of this lane
Definition: GNELane.cpp:745
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:223
GNELane * myGNELane
GNElane in which this POILane is placed (Only used by POIs placed over lanes)
Definition: GNEPOI.h:221
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:132
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
begin/end of the description of a Point of interest over Lane (used by Netedit)
bool myGeo
flag to check if POI was loaded as GEO Position (main used by netedit)
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Position()
default constructor
Definition: Position.h:42
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1160
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1066
A color information.
A window containing a gl-object&#39;s parameter.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:136
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occurred errors.
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNEPOI.cpp:92
bool removeGenericParameter(const std::string &key)
remove generic parameter
Definition: GNEPOI.cpp:427
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:96
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1737
void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:143
void clearParameter()
Clears the parameter map.
SumoXMLTag getTag() const
get XML Tag assigned to this object