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 <string>
27 #include <utils/gui/div/GLHelper.h>
30 #include <netedit/GNENet.h>
31 #include <netedit/GNEUndoList.h>
32 #include <netedit/GNEViewNet.h>
36 
37 #include "GNEPOI.h"
38 
39 
40 // ===========================================================================
41 // method definitions
42 // ===========================================================================
43 
44 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
45  const Position& pos, bool geo, double layer, double angle, const std::string& imgFile,
46  bool relativePath, double width, double height, bool movementBlocked) :
47  GUIPointOfInterest(id, type, color, pos, geo, "", 0, 0, layer, angle, imgFile, relativePath, width, height),
48  GNEShape(net, SUMO_TAG_POI, movementBlocked),
49  myGNELane(nullptr) {
50  // set GEO Position
51  myGEOPosition = pos;
53 }
54 
55 
56 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
57  double layer, double angle, const std::string& imgFile, bool relativePath, GNELane* lane, double posOverLane, double posLat,
58  double width, double height, bool movementBlocked) :
59  GUIPointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, posLat, layer, angle, imgFile, relativePath, width, height),
60  GNEShape(net, SUMO_TAG_POILANE, movementBlocked),
61  myGNELane(lane) {
62 }
63 
64 
66 
67 
68 void
70  // always save original position over view
72  // save current centering boundary
74 }
75 
76 
77 void
79  // check that endGeometryMoving was called only once
81  // Remove object from net
83  // reset myMovingGeometryBoundary
85  // update geometry without updating grid
86  updateGeometry(false);
87  // add object into grid again (using the new centering boundary)
89  }
90 }
91 
92 
93 void
95  if (myGNELane) {
96  // obtain fixed position over lane
97  double fixedPositionOverLane = myPosOverLane > myGNELane->getShape().length() ? myGNELane->getShape().length() : myPosOverLane < 0 ? 0 : myPosOverLane;
98  // write POILane using POI::writeXML
99  writeXML(device, false, 0, myGNELane->getID(), fixedPositionOverLane, myPosLat);
100  } else {
101  writeXML(device, myGeo);
102  }
103 }
104 
105 
106 void
107 GNEPOI::moveGeometry(const Position& oldPos, const Position& offset) {
108  if (!myBlockMovement) {
109  // Calculate new position using old position
110  Position newPosition = oldPos;
111  newPosition.add(offset);
112  // filtern position using snap to active grid
113  newPosition = myNet->getViewNet()->snapToActiveGrid(newPosition);
114  // set position depending of POI Type
115  if (myGNELane) {
117  } else {
118  set(newPosition);
119  }
120  // Update geometry
121  updateGeometry(false);
122  }
123 }
124 
125 
126 void
128  if (!myBlockMovement) {
129  // restore original Position before moving (to avoid problems in GL Tree)
130  Position myNewPosition(*this);
131  set(oldPos);
132  // commit new position allowing undo/redo
133  if (myGNELane) {
134  // restore old position before commit new position
135  double originalPosOverLane = myGNELane->getShape().nearest_offset_to_point2D(oldPos, false);
136  undoList->p_begin("position of " + getTagStr());
137  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myPosOverLane), true, toString(originalPosOverLane)));
138  undoList->p_end();
139  } else {
140  undoList->p_begin("position of " + getTagStr());
141  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_POSITION, toString(myNewPosition), true, toString(oldPos)));
142  undoList->p_end();
143  }
144  }
145 }
146 
147 
148 GNELane*
150  return myGNELane;
151 }
152 
153 
154 void
155 GNEPOI::updateGeometry(bool updateGrid) {
156  // first check if object has to be removed from grid (SUMOTree)
157  if (updateGrid) {
159  }
160  if (myGNELane) {
161  // obtain fixed position over lane
162  double fixedPositionOverLane = myPosOverLane > myGNELane->getLaneShapeLength() ? myGNELane->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
163  // set new position regarding to lane
164  set(myGNELane->getShape().positionAtOffset(fixedPositionOverLane * myGNELane->getLengthGeometryFactor(), -myPosLat));
165  }
166  // last step is to check if object has to be added into grid (SUMOTree) again
167  if (updateGrid) {
168  myNet->addGLObjectIntoGrid(this);
169  }
170 }
171 
172 
173 Position
175  return Position(x(), y());
176 }
177 
178 
179 GUIGlID
182 }
183 
184 
185 std::string
187  return myNet->getMicrosimID();
188 }
189 
190 
193  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
194  buildPopupHeader(ret, app);
197  // build selection and show parameters menu
200  if (myGNELane) {
201  // build shape header
203  // add option for convert to GNEPOI
204  new FXMenuCommand(ret, ("Release from " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
205  return ret;
206  } else {
207  // build shape header
209  // add option for convert to GNEPOI
210  new FXMenuCommand(ret, ("Attach to nearest " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
211  }
212  return ret;
213 }
214 
215 
218  return GUIPointOfInterest::getParameterWindow(app, parent);
219 }
220 
221 
222 Boundary
224  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
227  } else {
229  }
230 }
231 
232 
233 void
235  // first clear vertices
236  myPOIVertices.clear();
237  // check if POI can be drawn
238  if(checkDraw(s)) {
239  // push name (needed for getGUIGlObjectsUnderCursor(...)
240  glPushName(getGlID());
241  // draw inner polygon
242  drawInnerPOI(s);
243  // draw an orange square mode if there is an image(see #4036)
244  if (!getShapeImgFile().empty() && OptionsCont::getOptions().getBool("gui-testing")) {
245  // Add a draw matrix for drawing logo
246  glPushMatrix();
247  glTranslated(x(), y(), getType() + 0.01);
249  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
250  glPopMatrix();
251  }
252  // check if dotted contour has to be drawn
253  if (myNet->getViewNet()->getDottedAC() == this) {
255  const double exaggeration = s.poiSize.getExaggeration(s, this);
256  GLHelper::drawShapeDottedContour(getType(), *this, 2 * myHalfImgWidth * exaggeration, 2 * myHalfImgHeight * exaggeration);
257  } else if (myPOIVertices.size() > 0) {
258  glPushMatrix();
259  glTranslated(x(), y(), getType() + 0.01);
261  glPopMatrix();
262  }
263  }
264  // pop name
265  glPopName();
266  }
267 }
268 
269 
270 std::string
272  switch (key) {
273  case SUMO_ATTR_ID:
274  return myID;
275  case SUMO_ATTR_COLOR:
276  return toString(getShapeColor());
277  case SUMO_ATTR_LANE:
278  return myLane;
279  case SUMO_ATTR_POSITION:
280  if (myGNELane) {
281  return toString(myPosOverLane);
282  } else {
283  return toString(*this);
284  }
286  return toString(myPosLat);
289  case SUMO_ATTR_GEO:
290  return toString(myGeo);
291  case SUMO_ATTR_TYPE:
292  return getShapeType();
293  case SUMO_ATTR_LAYER:
295  return "default";
296  } else {
297  return toString(getShapeLayer());
298  }
299  case SUMO_ATTR_IMGFILE:
300  return getShapeImgFile();
302  return toString(getShapeRelativePath());
303  case SUMO_ATTR_WIDTH:
304  return toString(getWidth());
305  case SUMO_ATTR_HEIGHT:
306  return toString(getHeight());
307  case SUMO_ATTR_ANGLE:
308  return toString(getShapeNaviDegree());
310  return toString(myBlockMovement);
311  case GNE_ATTR_SELECTED:
313  case GNE_ATTR_GENERIC:
314  return getGenericParametersStr();
315  default:
316  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
317  }
318 }
319 
320 
321 void
322 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
323  if (value == getAttribute(key)) {
324  return; //avoid needless changes, later logic relies on the fact that attributes have changed
325  }
326  switch (key) {
327  case SUMO_ATTR_ID:
328  case SUMO_ATTR_COLOR:
329  case SUMO_ATTR_LANE:
330  case SUMO_ATTR_POSITION:
333  case SUMO_ATTR_GEO:
334  case SUMO_ATTR_TYPE:
335  case SUMO_ATTR_LAYER:
336  case SUMO_ATTR_IMGFILE:
338  case SUMO_ATTR_WIDTH:
339  case SUMO_ATTR_HEIGHT:
340  case SUMO_ATTR_ANGLE:
342  case GNE_ATTR_SELECTED:
343  case GNE_ATTR_GENERIC:
344  undoList->p_add(new GNEChange_Attribute(this, key, value));
345  break;
346  default:
347  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
348  }
349 }
350 
351 
352 bool
353 GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
354  switch (key) {
355  case SUMO_ATTR_ID:
356  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrievePOI(value, false) == nullptr);
357  case SUMO_ATTR_COLOR:
358  return canParse<RGBColor>(value);
359  case SUMO_ATTR_LANE:
360  return (myNet->retrieveLane(value, false) != nullptr);
361  case SUMO_ATTR_POSITION:
362  if (myGNELane) {
363  return canParse<double>(value);
364  } else {
365  return canParse<Position>(value);
366  }
368  return canParse<double>(value);
369  case SUMO_ATTR_GEOPOSITION: {
370  return canParse<Position>(value);
371  }
372  case SUMO_ATTR_GEO:
373  return canParse<bool>(value);
374  case SUMO_ATTR_TYPE:
375  return true;
376  case SUMO_ATTR_LAYER:
377  if (value == "default") {
378  return true;
379  } else {
380  return canParse<double>(value);
381  }
382  case SUMO_ATTR_IMGFILE:
383  if (value == "") {
384  return true;
385  } else {
386  // check that image can be loaded
387  return GUITexturesHelper::getTextureID(value) != -1;
388  }
390  return canParse<bool>(value);
391  case SUMO_ATTR_WIDTH:
392  return canParse<double>(value) && (parse<double>(value) >= 0);
393  case SUMO_ATTR_HEIGHT:
394  return canParse<double>(value) && (parse<double>(value) >= 0);
395  case SUMO_ATTR_ANGLE:
396  return canParse<double>(value);
398  return canParse<bool>(value);
399  case GNE_ATTR_SELECTED:
400  return canParse<bool>(value);
401  case GNE_ATTR_GENERIC:
402  return isGenericParametersValid(value);
403  default:
404  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
405  }
406 }
407 
408 
409 std::string
411  std::string result;
412  // Generate an string using the following structure: "key1=value1|key2=value2|...
413  for (auto i : getParametersMap()) {
414  result += i.first + "=" + i.second + "|";
415  }
416  // remove the last "|"
417  if (!result.empty()) {
418  result.pop_back();
419  }
420  return result;
421 }
422 
423 
424 std::vector<std::pair<std::string, std::string> >
426  std::vector<std::pair<std::string, std::string> > result;
427  // iterate over parameters map and fill result
428  for (auto i : getParametersMap()) {
429  result.push_back(std::make_pair(i.first, i.second));
430  }
431  return result;
432 }
433 
434 
435 void
436 GNEPOI::setGenericParametersStr(const std::string& value) {
437  // clear parameters
438  clearParameter();
439  // separate value in a vector of string using | as separator
440  std::vector<std::string> parsedValues;
441  StringTokenizer stValues(value, "|", true);
442  while (stValues.hasNext()) {
443  parsedValues.push_back(stValues.next());
444  }
445  // check that parsed values (A=B)can be parsed in generic parameters
446  for (auto i : parsedValues) {
447  std::vector<std::string> parsedParameters;
448  StringTokenizer stParam(i, "=", true);
449  while (stParam.hasNext()) {
450  parsedParameters.push_back(stParam.next());
451  }
452  // Check that parsed parameters are exactly two and contains valid chracters
453  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
454  setParameter(parsedParameters.front(), parsedParameters.back());
455  }
456  }
457 }
458 
459 // ===========================================================================
460 // private
461 // ===========================================================================
462 
463 void
464 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
465  switch (key) {
466  case SUMO_ATTR_ID: {
467  std::string oldID = myID;
468  myID = value;
469  myNet->changeShapeID(this, oldID);
470  setMicrosimID(value);
471  break;
472  }
473  case SUMO_ATTR_COLOR:
474  setShapeColor(parse<RGBColor>(value));
475  break;
476  case SUMO_ATTR_LANE:
477  myLane = value;
479  myGNELane = myNet->retrieveLane(value);
480  myGNELane->addShapeChild(this);
481  updateGeometry(true);
482  break;
483  case SUMO_ATTR_POSITION: {
484  // first remove object from grid due position is used for boundary
486  if (myGNELane) {
487  myPosOverLane = parse<double>(value);
488  } else {
489  set(parse<Position>(value));
490  // set GEO Position
491  myGEOPosition = *this;
493  }
494  // add object into grid again
495  myNet->addGLObjectIntoGrid(this);
496  break;
497  }
499  // first remove object from grid due position is used for boundary
501  myPosLat = parse<double>(value);
502  // add object into grid again
503  myNet->addGLObjectIntoGrid(this);
504  break;
505  case SUMO_ATTR_GEOPOSITION: {
506  // first remove object from grid due position is used for boundary
508  myGEOPosition = parse<Position>(value);
509  // set cartesian Position
510  set(myGEOPosition);
512  // add object into grid again
513  myNet->addGLObjectIntoGrid(this);
514  break;
515  }
516  case SUMO_ATTR_GEO:
517  myGeo = parse<bool>(value);
518  break;
519  case SUMO_ATTR_TYPE:
520  setShapeType(value);
521  break;
522  case SUMO_ATTR_LAYER:
523  if (value == "default") {
525  } else {
526  setShapeLayer(parse<double>(value));
527  }
528  break;
529  case SUMO_ATTR_IMGFILE:
530  // first remove object from grid due img file affect to boundary
532  setShapeImgFile(value);
533  // all textures must be refresh
535  // add object into grid again
536  myNet->addGLObjectIntoGrid(this);
537  break;
539  setShapeRelativePath(parse<bool>(value));
540  break;
541  case SUMO_ATTR_WIDTH:
542  // first remove object from grid due position is used for boundary
544  setWidth(parse<double>(value));
545  // add object into grid again
546  myNet->addGLObjectIntoGrid(this);
547  break;
548  case SUMO_ATTR_HEIGHT:
549  // first remove object from grid due position is used for boundary
551  setHeight(parse<double>(value));
552  // add object into grid again
553  myNet->addGLObjectIntoGrid(this);
554  break;
555  case SUMO_ATTR_ANGLE:
556  setShapeNaviDegree(parse<double>(value));
557  break;
559  myBlockMovement = parse<bool>(value);
560  break;
561  case GNE_ATTR_SELECTED:
562  if (parse<bool>(value)) {
564  } else {
566  }
567  break;
568  case GNE_ATTR_GENERIC:
570  break;
571  default:
572  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
573  }
574  // Update Geometry after setting a new attribute (but avoided for certain attributes)
575  if((key != SUMO_ATTR_ID) && (key != GNE_ATTR_GENERIC) && (key != GNE_ATTR_SELECTED)) {
576  updateGeometry(true);
577  }
578 }
579 
580 
581 void
583 }
584 
585 
586 /****************************************************************************/
void startGeometryMoving()
Definition: GNEPOI.cpp:69
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPOI.cpp:174
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:107
static const std::string DEFAULT_IMG_FILE
Definition: Shape.h:48
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
Definition: Shape.h:104
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:127
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:130
void setShapeRelativePath(bool relativePath)
Sets a new relativePath value.
Definition: Shape.h:158
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPOI.cpp:234
void drawInnerPOI(const GUIVisualizationSettings &s) const
draw inner POI (before pushName() )
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:180
static const double DEFAULT_LAYER_POI
Definition: Shape.h:46
A layer number.
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNEShape.h:168
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:123
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEShape.cpp:128
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:322
double y() const
Returns the y-position.
Definition: Position.h:62
Position snapToActiveGrid(const Position &pos) const
Returns a position that is mapped to the closest grid point if the grid is active.
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:946
double x() const
Returns the x-position.
Definition: Position.h:57
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
static const RGBColor ORANGE
Definition: RGBColor.h:190
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPOI.cpp:192
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:44
~GNEPOI()
Destructor.
Definition: GNEPOI.cpp:65
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:77
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:73
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:149
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:776
Position myOriginalViewPosition
position used for move POILanes
Definition: GNEPOI.h:214
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:165
generic attribute
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEShape.cpp:96
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
Definition: GNEPOI.cpp:582
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:76
double myPosLat
latereal position over lane in which this POI is placed (main used by netedit)
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:151
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:410
bool getShapeRelativePath() const
Returns the relativePath of the Shape.
Definition: Shape.h:111
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNEPOI.cpp:127
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.
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:353
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:171
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:80
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:1160
friend class GNEChange_Attribute
declare friend class
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:83
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPOI.cpp:223
void addShapeChild(GNEShape *shape)
add shape child to this lane
Definition: GNELane.cpp:792
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:1317
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPOI.cpp:186
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
bool checkDraw(const GUIVisualizationSettings &s) const
check if POI can be drawn
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
Definition: GNENet.cpp:2034
double getLaneShapeLength() const
returns the length of the lane&#39;s shape
Definition: GNELane.cpp:786
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:90
double getWidth() const
Returns the image width of the POI.
void updateGeometry(bool updateGrid)
update pre-computed geometry information
Definition: GNEPOI.cpp:155
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
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:130
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:669
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPOI.cpp:436
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:617
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:207
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
void setWidth(double width)
set the image width of the POI
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
const std::string & getTagStr() const
get tag assigned to this object in string format
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.
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:271
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEShape.cpp:112
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.
void writeShape(OutputDevice &device)
writte shape element into a xml file
Definition: GNEPOI.cpp:94
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEPOI.cpp:425
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:805
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:217
GNELane * myGNELane
GNElane in which this POILane is placed (Only used by POIs placed over lanes)
Definition: GNEPOI.h:210
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:132
begin/end of the description of a Point of interest over Lane (used by Netedit)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
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:1153
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:1059
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:137
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNEPOI.cpp:78
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
Definition: Shape.h:97
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1730
void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:144
void clearParameter()
Clears the parameter map.