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  buildPopupHeader(ret, app);
209  // build selection and show parameters menu
212  if (myGNELane) {
213  // build shape header
215  // add option for convert to GNEPOI
216  new FXMenuCommand(ret, ("Release from " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
217  return ret;
218  } else {
219  // build shape header
221  // add option for convert to GNEPOI
222  new FXMenuCommand(ret, ("Attach to nearest " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
223  }
224  return ret;
225 }
226 
227 
230  return GUIPointOfInterest::getParameterWindow(app, parent);
231 }
232 
233 
234 Boundary
236  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
239  } else {
241  }
242 }
243 
244 
245 void
248  // draw lock icon if isn't in selecting mode
249  if (!s.drawForSelecting) {
250  drawLockIcon(*this, getType() + 0.1, 0.2);
251  }
252  // push matrix
253  glPushName(getGlID());
254  // draw an orange square mode if there is an image(see #4036)
255  if (!getShapeImgFile().empty() && OptionsCont::getOptions().getBool("gui-testing")) {
256  // Add a draw matrix for drawing logo
257  glPushMatrix();
258  glTranslated(x(), y(), getType() + 0.01);
260  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
261  glPopMatrix();
262 
263  }
264  // check if dotted contour has to be drawn
265  if (myNet->getViewNet()->getACUnderCursor() == this) {
268  } else if (myPOIVertices.size() > 0) {
269  glPushMatrix();
270  glTranslated(x(), y(), getType() + 0.01);
272  glPopMatrix();
273  }
274  }
275  // Pop name
276  glPopName();
277 }
278 
279 
280 std::string
282  switch (key) {
283  case SUMO_ATTR_ID:
284  return myID;
285  case SUMO_ATTR_COLOR:
286  return toString(getShapeColor());
287  case SUMO_ATTR_LANE:
288  return myLane;
289  case SUMO_ATTR_POSITION:
290  if (myGNELane) {
291  return toString(myPosOverLane);
292  } else {
293  return toString(*this);
294  }
296  return toString(myPosLat);
299  case SUMO_ATTR_GEO:
300  return toString(myGeo);
301  case SUMO_ATTR_TYPE:
302  return getShapeType();
303  case SUMO_ATTR_LAYER:
305  return "default";
306  } else {
307  return toString(getShapeLayer());
308  }
309  case SUMO_ATTR_IMGFILE:
310  return getShapeImgFile();
312  return toString(getShapeRelativePath());
313  case SUMO_ATTR_WIDTH:
314  return toString(getWidth());
315  case SUMO_ATTR_HEIGHT:
316  return toString(getHeight());
317  case SUMO_ATTR_ANGLE:
318  return toString(getShapeNaviDegree());
320  return toString(myBlockMovement);
321  case GNE_ATTR_SELECTED:
323  case GNE_ATTR_GENERIC:
324  return getGenericParametersStr();
325  default:
326  throw InvalidArgument(toString(getTag()) + " attribute '" + toString(key) + "' not allowed");
327  }
328 }
329 
330 
331 void
332 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
333  if (value == getAttribute(key)) {
334  return; //avoid needless changes, later logic relies on the fact that attributes have changed
335  }
336  switch (key) {
337  case SUMO_ATTR_ID:
338  case SUMO_ATTR_COLOR:
339  case SUMO_ATTR_LANE:
340  case SUMO_ATTR_POSITION:
343  case SUMO_ATTR_GEO:
344  case SUMO_ATTR_TYPE:
345  case SUMO_ATTR_LAYER:
346  case SUMO_ATTR_IMGFILE:
348  case SUMO_ATTR_WIDTH:
349  case SUMO_ATTR_HEIGHT:
350  case SUMO_ATTR_ANGLE:
352  case GNE_ATTR_SELECTED:
353  case GNE_ATTR_GENERIC:
354  undoList->p_add(new GNEChange_Attribute(this, key, value));
355  break;
356  default:
357  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
358  }
359 }
360 
361 
362 bool
363 GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
364  switch (key) {
365  case SUMO_ATTR_ID:
366  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrievePOI(value, false) == 0);
367  case SUMO_ATTR_COLOR:
368  return canParse<RGBColor>(value);
369  case SUMO_ATTR_LANE:
370  return (myNet->retrieveLane(value, false) != nullptr);
371  case SUMO_ATTR_POSITION:
372  if (myGNELane) {
373  return canParse<double>(value);
374  } else {
375  bool ok;
376  return GeomConvHelper::parseShapeReporting(value, "user-supplied position", 0, ok, false).size() == 1;
377  }
379  return canParse<double>(value);
380  case SUMO_ATTR_GEOPOSITION: {
381  bool ok;
382  return GeomConvHelper::parseShapeReporting(value, "user-supplied GEO position", 0, ok, false).size() == 1;
383  }
384  case SUMO_ATTR_GEO:
385  return canParse<bool>(value);
386  case SUMO_ATTR_TYPE:
387  return true;
388  case SUMO_ATTR_LAYER:
389  if (value == "default") {
390  return true;
391  } else {
392  return canParse<double>(value);
393  }
394  case SUMO_ATTR_IMGFILE:
395  if (value == "") {
396  return true;
397  } else {
398  // check that image can be loaded
399  return GUITexturesHelper::getTextureID(value) != -1;
400  }
402  return canParse<bool>(value);
403  case SUMO_ATTR_WIDTH:
404  return canParse<double>(value) && (parse<double>(value) >= 0);
405  case SUMO_ATTR_HEIGHT:
406  return canParse<double>(value) && (parse<double>(value) >= 0);
407  case SUMO_ATTR_ANGLE:
408  return canParse<double>(value);
410  return canParse<bool>(value);
411  case GNE_ATTR_SELECTED:
412  return canParse<bool>(value);
413  case GNE_ATTR_GENERIC:
414  return isGenericParametersValid(value);
415  default:
416  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
417  }
418 }
419 
420 
421 bool
422 GNEPOI::addGenericParameter(const std::string& key, const std::string& value) {
423  if (!knowsParameter(key)) {
424  setParameter(key, value);
425  return true;
426  } else {
427  return false;
428  }
429 }
430 
431 
432 bool
433 GNEPOI::removeGenericParameter(const std::string& key) {
434  if (knowsParameter(key)) {
435  unsetParameter(key);
436  return true;
437  } else {
438  return false;
439  }
440 }
441 
442 
443 bool
444 GNEPOI::updateGenericParameter(const std::string& oldKey, const std::string& newKey) {
445  if (knowsParameter(oldKey) && !knowsParameter(newKey)) {
446  std::string value = getParameter(oldKey);
447  unsetParameter(oldKey);
448  setParameter(newKey, value);
449  return true;
450  } else {
451  return false;
452  }
453 }
454 
455 
456 bool
457 GNEPOI::updateGenericParameterValue(const std::string& key, const std::string& newValue) {
458  if (knowsParameter(key)) {
459  setParameter(key, newValue);
460  return true;
461  } else {
462  return false;
463  }
464 }
465 
466 
467 std::string
469  std::string result;
470  // Generate an string using the following structure: "key1=value1|key2=value2|...
471  for (auto i : getParametersMap()) {
472  result += i.first + "=" + i.second + "|";
473  }
474  // remove the last "|"
475  if (!result.empty()) {
476  result.pop_back();
477  }
478  return result;
479 }
480 
481 
482 std::vector<std::pair<std::string, std::string> >
484  std::vector<std::pair<std::string, std::string> > result;
485  // iterate over parameters map and fill result
486  for (auto i : getParametersMap()) {
487  result.push_back(std::make_pair(i.first, i.second));
488  }
489  return result;
490 }
491 
492 
493 void
494 GNEPOI::setGenericParametersStr(const std::string& value) {
495  // clear parameters
496  clearParameter();
497  // separate value in a vector of string using | as separator
498  std::vector<std::string> parsedValues;
499  StringTokenizer stValues(value, "|", true);
500  while (stValues.hasNext()) {
501  parsedValues.push_back(stValues.next());
502  }
503  // check that parsed values (A=B)can be parsed in generic parameters
504  for (auto i : parsedValues) {
505  std::vector<std::string> parsedParameters;
506  StringTokenizer stParam(i, "=", true);
507  while (stParam.hasNext()) {
508  parsedParameters.push_back(stParam.next());
509  }
510  // Check that parsed parameters are exactly two and contains valid chracters
511  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
512  setParameter(parsedParameters.front(), parsedParameters.back());
513  }
514  }
515 }
516 
517 // ===========================================================================
518 // private
519 // ===========================================================================
520 
521 void
522 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
523  switch (key) {
524  case SUMO_ATTR_ID: {
525  std::string oldID = myID;
526  myID = value;
527  myNet->changeShapeID(this, oldID);
528  setMicrosimID(value);
529  break;
530  }
531  case SUMO_ATTR_COLOR:
532  setShapeColor(parse<RGBColor>(value));
533  break;
534  case SUMO_ATTR_LANE:
535  myLane = value;
537  myGNELane = myNet->retrieveLane(value);
538  myGNELane->addShapeChild(this);
539  updateGeometry(true);
540  break;
541  case SUMO_ATTR_POSITION: {
542  // first remove object from grid due position is used for boundary
544  if (myGNELane) {
545  myPosOverLane = parse<double>(value);
546  } else {
547  bool ok = true;
548  set(GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0]);
549  // set GEO Position
550  myGEOPosition = *this;
552  }
553  // add object into grid again
554  myNet->addGLObjectIntoGrid(this);
555  break;
556  }
558  // first remove object from grid due position is used for boundary
560  myPosLat = parse<double>(value);
561  // add object into grid again
562  myNet->addGLObjectIntoGrid(this);
563  break;
564  case SUMO_ATTR_GEOPOSITION: {
565  // first remove object from grid due position is used for boundary
567  bool ok = true;
568  myGEOPosition = GeomConvHelper::parseShapeReporting(value, "netedit-given", 0, ok, false)[0];
569  // set cartesian Position
570  set(myGEOPosition);
572  // add object into grid again
573  myNet->addGLObjectIntoGrid(this);
574  break;
575  }
576  case SUMO_ATTR_GEO:
577  myGeo = parse<bool>(value);
578  break;
579  case SUMO_ATTR_TYPE:
580  setShapeType(value);
581  break;
582  case SUMO_ATTR_LAYER:
583  if (value == "default") {
585  } else {
586  setShapeLayer(parse<double>(value));
587  }
588  break;
589  case SUMO_ATTR_IMGFILE:
590  // first remove object from grid due img file affect to boundary
592  setShapeImgFile(value);
593  // all textures must be refresh
595  // add object into grid again
596  myNet->addGLObjectIntoGrid(this);
597  break;
599  setShapeRelativePath(parse<bool>(value));
600  break;
601  case SUMO_ATTR_WIDTH:
602  // first remove object from grid due position is used for boundary
604  setWidth(parse<double>(value));
605  // add object into grid again
606  myNet->addGLObjectIntoGrid(this);
607  break;
608  case SUMO_ATTR_HEIGHT:
609  // first remove object from grid due position is used for boundary
611  setHeight(parse<double>(value));
612  // add object into grid again
613  myNet->addGLObjectIntoGrid(this);
614  break;
615  case SUMO_ATTR_ANGLE:
616  setShapeNaviDegree(parse<double>(value));
617  break;
619  myBlockMovement = parse<bool>(value);
620  break;
621  case GNE_ATTR_SELECTED:
622  if (parse<bool>(value)) {
624  } else {
626  }
627  break;
628  case GNE_ATTR_GENERIC:
630  break;
631  default:
632  throw InvalidArgument(toString(getTag()) + " attribute '" + toString(key) + "' not allowed");
633  }
634  // After setting attribute always update Geometry
635  updateGeometry(true);
636 }
637 
638 
639 void
641 }
642 
643 
644 /****************************************************************************/
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
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
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:246
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:332
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:961
double x() const
Returns the x-position.
Definition: Position.h:56
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
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
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:766
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:640
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:422
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:468
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:363
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:1175
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:235
void addShapeChild(GNEShape *shape)
add shape child to this lane
Definition: GNELane.cpp:802
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:1355
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:2047
double getLaneShapeLength() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:796
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:457
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:679
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPOI.cpp:494
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:263
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:444
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:281
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:483
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:815
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:229
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:1168
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:1074
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:433
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:96
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1745
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