Eclipse SUMO - Simulation of Urban MObility
GNEPOI.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 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  // set GEO Position
50  myGEOPosition = pos;
52 }
53 
54 
55 GNEPOI::GNEPOI(GNENet* net, const std::string& id, const std::string& type, const RGBColor& color,
56  double layer, double angle, const std::string& imgFile, bool relativePath, GNELane* lane, double posOverLane, double posLat,
57  double width, double height, bool movementBlocked) :
58  GUIPointOfInterest(id, type, color, Position(), false, lane->getID(), posOverLane, posLat, layer, angle, imgFile, relativePath, width, height),
59  GNEShape(net, SUMO_TAG_POILANE, movementBlocked, {}, {lane}, {}, {}, {}, {}, {}, {}, {}, {}) {
60 }
61 
62 
64 
65 
66 std::string
68  int counter = myNet->getPOIs().size();
69  while (myNet->retrievePOI(getID() + toString(childTag) + toString(counter), false) != nullptr) {
70  counter++;
71  }
72  return (getID() + toString(childTag) + toString(counter));
73 }
74 
75 
76 void
78 }
79 
80 
81 void
83 }
84 
85 
86 void
88  if (getLaneParents().size() > 0) {
89  // obtain fixed position over lane
90  double fixedPositionOverLane = myPosOverLane > getLaneParents().at(0)->getGeometry().shape.length() ? getLaneParents().at(0)->getGeometry().shape.length() : myPosOverLane < 0 ? 0 : myPosOverLane;
91  // write POILane using POI::writeXML
92  writeXML(device, false, 0, getLaneParents().at(0)->getID(), fixedPositionOverLane, myPosLat);
93  } else {
94  writeXML(device, myGeo);
95  }
96 }
97 
98 
99 void
100 GNEPOI::moveGeometry(const Position& oldPos, const Position& offset) {
101  if (!myBlockMovement) {
102  // Calculate new position using old position
103  Position newPosition = oldPos;
104  newPosition.add(offset);
105  // filtern position using snap to active grid
106  newPosition = myNet->getViewNet()->snapToActiveGrid(newPosition);
107  // set position depending of POI Type
108  if (getLaneParents().size() > 0) {
109  myPosOverLane = getLaneParents().at(0)->getGeometry().shape.nearest_offset_to_point2D(newPosition, false);
110  } else {
111  set(newPosition);
112  }
113  // Update geometry
114  updateGeometry();
115  }
116 }
117 
118 
119 void
121  if (!myBlockMovement) {
122  // restore original Position before moving (to avoid problems in GL Tree)
123  Position myNewPosition(*this);
124  set(oldPos);
125  // commit new position allowing undo/redo
126  if (getLaneParents().size() > 0) {
127  // restore old position before commit new position
128  double originalPosOverLane = getLaneParents().at(0)->getGeometry().shape.nearest_offset_to_point2D(oldPos, false);
129  undoList->p_begin("position of " + getTagStr());
130  undoList->p_add(new GNEChange_Attribute(this, myNet, SUMO_ATTR_POSITION, toString(myPosOverLane), true, toString(originalPosOverLane)));
131  undoList->p_end();
132  } else {
133  undoList->p_begin("position of " + getTagStr());
134  undoList->p_add(new GNEChange_Attribute(this, myNet, SUMO_ATTR_POSITION, toString(myNewPosition), true, toString(oldPos)));
135  undoList->p_end();
136  }
137  }
138 }
139 
140 
141 void
143  if (getLaneParents().size() > 0) {
144  // obtain fixed position over lane
145  double fixedPositionOverLane = myPosOverLane > getLaneParents().at(0)->getLaneShapeLength() ? getLaneParents().at(0)->getLaneShapeLength() : myPosOverLane < 0 ? 0 : myPosOverLane;
146  // set new position regarding to lane
147  set(getLaneParents().at(0)->getGeometry().shape.positionAtOffset(fixedPositionOverLane * getLaneParents().at(0)->getLengthGeometryFactor(), -myPosLat));
148  }
149 }
150 
151 
152 Position
154  return Position(x(), y());
155 }
156 
157 
158 Boundary
160  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
163  } else {
165  }
166 }
167 
168 
169 GUIGlID
172 }
173 
174 
175 std::string
177  return myNet->getMicrosimID();
178 }
179 
180 
183  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
184  buildPopupHeader(ret, app);
187  // build selection and show parameters menu
190  if (getLaneParents().size() > 0) {
191  // build shape header
193  // add option for convert to GNEPOI
194  new FXMenuCommand(ret, ("Release from " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
195  return ret;
196  } else {
197  // build shape header
199  // add option for convert to GNEPOI
200  new FXMenuCommand(ret, ("Attach to nearest " + toString(SUMO_TAG_LANE)).c_str(), GUIIconSubSys::getIcon(ICON_LANE), &parent, MID_GNE_POI_TRANSFORM);
201  }
202  return ret;
203 }
204 
205 
208  return GUIPointOfInterest::getParameterWindow(app, parent);
209 }
210 
211 
212 void
214  // first check if POI can be drawn
216  // check if boundary has to be drawn
217  if (s.drawBoundaries) {
219  }
220  // first clear vertices
221  myPOIVertices.clear();
222  // check if POI can be drawn
223  if (checkDraw(s)) {
224  // push name (needed for getGUIGlObjectsUnderCursor(...)
225  glPushName(getGlID());
226  // draw inner polygon
228  // draw an orange square mode if there is an image(see #4036)
229  if (!getShapeImgFile().empty() && OptionsCont::getOptions().getBool("gui-testing")) {
230  // Add a draw matrix for drawing logo
231  glPushMatrix();
232  glTranslated(x(), y(), getType() + 0.01);
234  GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
235  glPopMatrix();
236  }
237  // check if dotted contour has to be drawn
238  if (myNet->getViewNet()->getDottedAC() == this) {
240  const double exaggeration = s.poiSize.getExaggeration(s, this);
241  GLHelper::drawShapeDottedContourRectangle(s, getType(), *this, 2 * myHalfImgWidth * exaggeration, 2 * myHalfImgHeight * exaggeration);
242  } else if (myPOIVertices.size() > 0) {
243  glPushMatrix();
244  glTranslated(x(), y(), getType() + 0.01);
246  glPopMatrix();
247  }
248  }
249  // pop name
250  glPopName();
251  }
252  }
253 }
254 
255 
256 std::string
258  switch (key) {
259  case SUMO_ATTR_ID:
260  return myID;
261  case SUMO_ATTR_COLOR:
262  return toString(getShapeColor());
263  case SUMO_ATTR_LANE:
264  return myLane;
265  case SUMO_ATTR_POSITION:
266  if (getLaneParents().size() > 0) {
267  return toString(myPosOverLane);
268  } else {
269  return toString(*this);
270  }
272  return toString(myPosLat);
275  case SUMO_ATTR_GEO:
276  return toString(myGeo);
277  case SUMO_ATTR_TYPE:
278  return getShapeType();
279  case SUMO_ATTR_LAYER:
281  return "default";
282  } else {
283  return toString(getShapeLayer());
284  }
285  case SUMO_ATTR_IMGFILE:
286  return getShapeImgFile();
288  return toString(getShapeRelativePath());
289  case SUMO_ATTR_WIDTH:
290  return toString(getWidth());
291  case SUMO_ATTR_HEIGHT:
292  return toString(getHeight());
293  case SUMO_ATTR_ANGLE:
294  return toString(getShapeNaviDegree());
296  return toString(myBlockMovement);
297  case GNE_ATTR_SELECTED:
299  case GNE_ATTR_GENERIC:
300  return getGenericParametersStr();
301  default:
302  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
303  }
304 }
305 
306 
307 void
308 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
309  if (value == getAttribute(key)) {
310  return; //avoid needless changes, later logic relies on the fact that attributes have changed
311  }
312  switch (key) {
313  case SUMO_ATTR_ID:
314  case SUMO_ATTR_COLOR:
315  case SUMO_ATTR_LANE:
316  case SUMO_ATTR_POSITION:
319  case SUMO_ATTR_GEO:
320  case SUMO_ATTR_TYPE:
321  case SUMO_ATTR_LAYER:
322  case SUMO_ATTR_IMGFILE:
324  case SUMO_ATTR_WIDTH:
325  case SUMO_ATTR_HEIGHT:
326  case SUMO_ATTR_ANGLE:
328  case GNE_ATTR_SELECTED:
329  case GNE_ATTR_GENERIC:
330  undoList->p_add(new GNEChange_Attribute(this, myNet, key, value));
331  break;
332  default:
333  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
334  }
335 }
336 
337 
338 bool
339 GNEPOI::isValid(SumoXMLAttr key, const std::string& value) {
340  switch (key) {
341  case SUMO_ATTR_ID:
342  return SUMOXMLDefinitions::isValidNetID(value) && (myNet->retrievePOI(value, false) == nullptr);
343  case SUMO_ATTR_COLOR:
344  return canParse<RGBColor>(value);
345  case SUMO_ATTR_LANE:
346  return (myNet->retrieveLane(value, false) != nullptr);
347  case SUMO_ATTR_POSITION:
348  if (getLaneParents().size() > 0) {
349  return canParse<double>(value);
350  } else {
351  return canParse<Position>(value);
352  }
354  return canParse<double>(value);
355  case SUMO_ATTR_GEOPOSITION: {
356  return canParse<Position>(value);
357  }
358  case SUMO_ATTR_GEO:
359  return canParse<bool>(value);
360  case SUMO_ATTR_TYPE:
361  return true;
362  case SUMO_ATTR_LAYER:
363  if (value == "default") {
364  return true;
365  } else {
366  return canParse<double>(value);
367  }
368  case SUMO_ATTR_IMGFILE:
369  if (value == "") {
370  return true;
371  } else {
372  // check that image can be loaded
373  return GUITexturesHelper::getTextureID(value) != -1;
374  }
376  return canParse<bool>(value);
377  case SUMO_ATTR_WIDTH:
378  return canParse<double>(value) && (parse<double>(value) > 0);
379  case SUMO_ATTR_HEIGHT:
380  return canParse<double>(value) && (parse<double>(value) > 0);
381  case SUMO_ATTR_ANGLE:
382  return canParse<double>(value);
384  return canParse<bool>(value);
385  case GNE_ATTR_SELECTED:
386  return canParse<bool>(value);
387  case GNE_ATTR_GENERIC:
388  return isGenericParametersValid(value);
389  default:
390  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
391  }
392 }
393 
394 
395 std::string
397  std::string result;
398  // Generate an string using the following structure: "key1=value1|key2=value2|...
399  for (auto i : getParametersMap()) {
400  result += i.first + "=" + i.second + "|";
401  }
402  // remove the last "|"
403  if (!result.empty()) {
404  result.pop_back();
405  }
406  return result;
407 }
408 
409 
410 std::vector<std::pair<std::string, std::string> >
412  std::vector<std::pair<std::string, std::string> > result;
413  // iterate over parameters map and fill result
414  for (auto i : getParametersMap()) {
415  result.push_back(std::make_pair(i.first, i.second));
416  }
417  return result;
418 }
419 
420 
421 void
422 GNEPOI::setGenericParametersStr(const std::string& value) {
423  // clear parameters
424  clearParameter();
425  // separate value in a vector of string using | as separator
426  std::vector<std::string> parsedValues;
427  StringTokenizer stValues(value, "|", true);
428  while (stValues.hasNext()) {
429  parsedValues.push_back(stValues.next());
430  }
431  // check that parsed values (A=B)can be parsed in generic parameters
432  for (auto i : parsedValues) {
433  std::vector<std::string> parsedParameters;
434  StringTokenizer stParam(i, "=", true);
435  while (stParam.hasNext()) {
436  parsedParameters.push_back(stParam.next());
437  }
438  // Check that parsed parameters are exactly two and contains valid chracters
439  if (parsedParameters.size() == 2 && SUMOXMLDefinitions::isValidGenericParameterKey(parsedParameters.front()) && SUMOXMLDefinitions::isValidGenericParameterValue(parsedParameters.back())) {
440  setParameter(parsedParameters.front(), parsedParameters.back());
441  }
442  }
443 }
444 
445 // ===========================================================================
446 // private
447 // ===========================================================================
448 
449 void
450 GNEPOI::setAttribute(SumoXMLAttr key, const std::string& value) {
451  switch (key) {
452  case SUMO_ATTR_ID: {
453  std::string oldID = myID;
454  myID = value;
455  myNet->changeShapeID(this, oldID);
456  setMicrosimID(value);
457  break;
458  }
459  case SUMO_ATTR_COLOR:
460  setShapeColor(parse<RGBColor>(value));
461  break;
462  case SUMO_ATTR_LANE:
463  myLane = value;
464  changeLaneParents(this, value);
465  break;
466  case SUMO_ATTR_POSITION: {
467  if (getLaneParents().size() > 0) {
468  myPosOverLane = parse<double>(value);
469  } else {
470  // first remove object from grid due position is used for boundary
472  // set position
473  set(parse<Position>(value));
474  // set GEO Position
475  myGEOPosition = *this;
477  // add object into grid again
478  myNet->addGLObjectIntoGrid(this);
479  }
480  break;
481  }
483  myPosLat = parse<double>(value);
484  break;
485  case SUMO_ATTR_GEOPOSITION: {
486  // first remove object from grid due position is used for boundary
488  // set new position
489  myGEOPosition = parse<Position>(value);
490  // set cartesian Position
491  set(myGEOPosition);
493  // add object into grid again
494  myNet->addGLObjectIntoGrid(this);
495  break;
496  }
497  case SUMO_ATTR_GEO:
498  myGeo = parse<bool>(value);
499  break;
500  case SUMO_ATTR_TYPE:
501  setShapeType(value);
502  break;
503  case SUMO_ATTR_LAYER:
504  if (value == "default") {
506  } else {
507  setShapeLayer(parse<double>(value));
508  }
509  break;
510  case SUMO_ATTR_IMGFILE:
511  // first remove object from grid due img file affect to boundary
513  setShapeImgFile(value);
514  // all textures must be refresh
516  // add object into grid again
517  myNet->addGLObjectIntoGrid(this);
518  break;
520  setShapeRelativePath(parse<bool>(value));
521  break;
522  case SUMO_ATTR_WIDTH:
523  if (getLaneParents().size() > 0) {
524  // set new width
525  setWidth(parse<double>(value));
526  } else {
527  // first remove object from grid due position is used for boundary
529  // set new width
530  setWidth(parse<double>(value));
531  // add object into grid again
532  myNet->addGLObjectIntoGrid(this);
533  }
534  break;
535  case SUMO_ATTR_HEIGHT:
536  if (getLaneParents().size() > 0) {
537  // set new height
538  setHeight(parse<double>(value));
539  } else {
540  // first remove object from grid due position is used for boundary
542  // set new height
543  setHeight(parse<double>(value));
544  // add object into grid again
545  myNet->addGLObjectIntoGrid(this);
546  }
547  break;
548  case SUMO_ATTR_ANGLE:
549  setShapeNaviDegree(parse<double>(value));
550  break;
552  myBlockMovement = parse<bool>(value);
553  break;
554  case GNE_ATTR_SELECTED:
555  if (parse<bool>(value)) {
557  } else {
559  }
560  break;
561  case GNE_ATTR_GENERIC:
563  break;
564  default:
565  throw InvalidArgument(getTagStr() + " attribute '" + toString(key) + "' not allowed");
566  }
567 }
568 
569 
570 const GUIGlObject*
572  return this;
573 }
574 
575 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
void startGeometryMoving()
Definition: GNEPOI.cpp:77
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEPOI.cpp:153
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()
returns the next substring when it exists. Otherwise the behaviour is undefined
void moveGeometry(const Position &oldPos, const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPOI.cpp:100
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:165
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPOI.cpp:213
int size() const
Returns the number of stored items within the container.
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GNEPOI.cpp:170
static const double DEFAULT_LAYER_POI
Definition: Shape.h:46
A layer number.
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNEShape.h:208
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
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEPOI.cpp:67
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEShape.cpp:139
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:308
double y() const
Returns the y-position.
Definition: Position.h:62
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:1066
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:196
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPOI.cpp:182
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:63
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:78
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
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.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
bool hasNext()
returns the information whether further substrings exist
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEShape.cpp:145
Transform POI to POILane, and viceversa.
Definition: GUIAppEnum.h:891
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:205
generic attribute
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEShape.cpp:109
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:158
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:812
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:396
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:120
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:48
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their correspond attribute are valids
Definition: GNEPOI.cpp:339
bool myBlockMovement
flag to block movement
Definition: GNEShape.h:211
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:1279
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:159
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
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
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPOI.cpp:176
static void drawShapeDottedContourAroundClosedShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape)
draw a dotted contour around the given closed shape with certain width
Definition: GLHelper.cpp:496
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
const GUIGlObject * getGUIGlObject() const
get GUIGlObject associated to this GNEShape
Definition: GNEPOI.cpp:571
void changeShapeID(GNEShape *s, const std::string &OldID)
change Shape ID
Definition: GNENet.cpp:2572
bool showShapes() const
check if shapes has to be hide
double getShapeLayer() const
Returns the layer of the Shape.
Definition: Shape.h:90
double getWidth() const
Returns the image width of the POI.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element
static void drawShapeDottedContourRectangle(const GUIVisualizationSettings &s, const int type, const Position &center, const double width, const double height, const double rotation=0, const double offsetX=0, const double offsetY=0)
draw a dotted contour around the given Position with certain width and height
Definition: GLHelper.cpp:555
unsigned int GUIGlID
Definition: GUIGlObject.h:43
void drawInnerPOI(const GUIVisualizationSettings &s, bool forceSelectionColor) const
draw inner POI (before pushName() )
GUIVisualizationSizeSettings poiSize
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
std::string myID
The name of the object.
Definition: Named.h:134
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEPOI.cpp:422
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:331
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
void updateGeometry()
update pre-computed geometry information
Definition: GNEPOI.cpp:142
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:417
void setWidth(double width)
set the image width of the POI
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:939
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:257
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEShape.cpp:124
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:87
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEPOI.cpp:411
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. ...
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GNEPOI.cpp:207
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:136
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)
Position()
default constructor
Definition: Position.h:42
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1273
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1179
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
bool drawBoundaries
enable or disable draw boundaries
void setShapeLayer(const double layer)
Sets a new layer.
Definition: Shape.h:144
void endGeometryMoving()
begin movement (used when user click over edge to start a movement, to avoid problems with problems w...
Definition: GNEPOI.cpp:82
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:2067
void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
Definition: Shape.h:151
void clearParameter()
Clears the parameter map.
const POIs & getPOIs() const
Returns all pois.