Eclipse SUMO - Simulation of Urban MObility
GNETAZ.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 //
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
23 #include <utils/gui/div/GLHelper.h>
25 #include <netedit/GNEUndoList.h>
26 #include <netedit/GNEViewNet.h>
27 #include <netedit/GNENet.h>
29 #include <netedit/GNEViewParent.h>
31 #include "GNETAZ.h"
32 
33 
34 // ===========================================================================
35 // static members
36 // ===========================================================================
37 const double GNETAZ::myHintSize = 0.8;
38 const double GNETAZ::myHintSizeSquared = 0.64;
39 
40 
41 // ===========================================================================
42 // member method definitions
43 // ===========================================================================
44 GNETAZ::GNETAZ(const std::string& id, GNEViewNet* viewNet, PositionVector shape, RGBColor color, bool blockMovement) :
45  GNEAdditional(id, viewNet, GLO_TAZ, SUMO_TAG_TAZ, "", blockMovement, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}),
46  myColor(color),
47  myBlockShape(false),
48  myCurrentMovingVertexIndex(-1),
49  myMaxWeightSource(0),
50  myMinWeightSource(0),
51  myAverageWeightSource(0),
52  myMaxWeightSink(0),
53  myMinWeightSink(0),
54 myAverageWeightSink(0) {
55  // set TAZ shape
56  myGeometry.shape = shape;
57 }
58 
59 
61 
62 
63 void
65  // Nothing to do
66 }
67 
68 
71  return myGeometry.shape.getCentroid();
72 }
73 
74 
77  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
80  } else if (myGeometry.shape.size() > 0) {
82  b.grow(20);
83  return b;
84  } else {
85  return Boundary(-0.1, -0.1, 0.1, 0.1);
86  }
87 }
88 
89 
90 void
92  // restore old position, apply offset and update Geometry
94  myGeometry.shape[0].add(offset);
95  // filtern position using snap to active grid
98 }
99 
100 
101 void
103  // commit new position allowing undo/redo
104  undoList->p_begin("position of " + getTagStr());
106  undoList->p_end();
107 }
108 
109 
110 int
111 GNETAZ::moveVertexShape(const int index, const Position& oldPos, const Position& offset) {
112  // only move shape if block movement block shape are disabled
113  if (!myBlockMovement && !myBlockShape && (index != -1)) {
114  // check that index is correct before change position
115  if (index < (int)myGeometry.shape.size()) {
116  // save current moving Geometry Point
118  // if closed shape and cliked is first or last, move both giving more priority to first always
119  if ((index == 0 || index == (int)myGeometry.shape.size() - 1)) {
120  // Change position of first shape Geometry Point and filtern position using snap to active grid
121  myGeometry.shape.front() = oldPos;
122  myGeometry.shape.front().add(offset);
124  // Change position of last shape Geometry Point and filtern position using snap to active grid
125  myGeometry.shape.back() = oldPos;
126  myGeometry.shape.back().add(offset);
128  } else {
129  // change position of Geometry Point and filtern position using snap to active grid
130  myGeometry.shape[index] = oldPos;
131  myGeometry.shape[index].add(offset);
133  }
134  // return index of moved Geometry Point
135  return index;
136  } else {
137  throw InvalidArgument("Index greater than shape size");
138  }
139  } else {
140  return index;
141  }
142 }
143 
144 
145 void
146 GNETAZ::moveEntireShape(const PositionVector& oldShape, const Position& offset) {
147  // only move shape if block movement is disabled and block shape is enabled
148  if (!myBlockMovement && myBlockShape) {
149  // restore original shape
150  myGeometry.shape = oldShape;
151  // change all points of the shape shape using offset
152  for (auto& i : myGeometry.shape) {
153  i.add(offset);
154  }
155  // update Geometry after moving
156  updateGeometry();
157  }
158 }
159 
160 
161 void
163  if (!myBlockMovement) {
164  // disable current moving vertex
166  // restore original shape into shapeToCommit
167  PositionVector shapeToCommit = myGeometry.shape;
168  // restore old shape in polygon (to avoid problems with RTree)
169  myGeometry.shape = oldShape;
170  // first check if double points has to be removed
171  shapeToCommit.removeDoublePoints(myHintSize);
172  if (shapeToCommit.size() != myGeometry.shape.size()) {
173  WRITE_WARNING("Merged shape's point")
174  }
175  // check if polygon has to be closed
176  if (shapeToCommit.size() > 1 && shapeToCommit.front().distanceTo2D(shapeToCommit.back()) < (2 * myHintSize)) {
177  shapeToCommit.pop_back();
178  shapeToCommit.push_back(shapeToCommit.front());
179  }
180  // commit new shape
181  undoList->p_begin("moving " + toString(SUMO_ATTR_SHAPE) + " of " + getTagStr());
182  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), SUMO_ATTR_SHAPE, toString(shapeToCommit)));
183  undoList->p_end();
184  }
185 }
186 
187 
188 int
189 GNETAZ::getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid) {
190  // check if position has to be snapped to grid
191  if (snapToGrid) {
192  pos = myViewNet->snapToActiveGrid(pos);
193  }
194  // first check if vertex already exists
195  for (auto i : myGeometry.shape) {
196  if (i.distanceTo2D(pos) < myHintSize) {
197  return myGeometry.shape.indexOfClosest(i);
198  }
199  }
200  // if vertex doesn't exist, insert it
201  if (createIfNoExist) {
202  return myGeometry.shape.insertAtClosest(pos);
203  } else {
204  return -1;
205  }
206 }
207 
208 
209 void
210 GNETAZ::deleteGeometryPoint(const Position& pos, bool allowUndo) {
211  if (myGeometry.shape.size() > 2) {
212  // obtain index
213  PositionVector modifiedShape = myGeometry.shape;
214  int index = modifiedShape.indexOfClosest(pos);
215  // remove point dependending of
216  if ((index == 0 || index == (int)modifiedShape.size() - 1)) {
217  modifiedShape.erase(modifiedShape.begin());
218  modifiedShape.erase(modifiedShape.end() - 1);
219  modifiedShape.push_back(modifiedShape.front());
220  } else {
221  modifiedShape.erase(modifiedShape.begin() + index);
222  }
223  // set new shape depending of allowUndo
224  if (allowUndo) {
225  myViewNet->getUndoList()->p_begin("delete geometry point");
228  } else {
229  // first remove object from grid due shape is used for boundary
231  // set new shape
232  myGeometry.shape = modifiedShape;
233  // add object into grid again
235  }
236  } else {
237  WRITE_WARNING("Number of remaining points insufficient")
238  }
239 }
240 
241 
242 bool
244  return myBlockShape;
245 }
246 
247 
248 std::string
250  return myViewNet->getNet()->getMicrosimID();
251 }
252 
253 
254 void
256  // check if boundary has to be drawn
257  if (s.drawBoundaries) {
259  }
260  if (s.polySize.getExaggeration(s, this) == 0) {
261  return;
262  }
264  if (s.scale * MAX2(boundary.getWidth(), boundary.getHeight()) < s.polySize.minSize) {
265  return;
266  }
267  glPushName(getGlID());
268  if (myGeometry.shape.size() > 1) {
269  glPushMatrix();
270  glTranslated(0, 0, 128);
271  if (drawUsingSelectColor()) {
273  } else {
275  }
278  glPopMatrix();
279  const Position namePos = myGeometry.shape.getPolygonCenter();
280  drawName(namePos, s.scale, s.polyName, s.angle);
281  }
282  // draw geometry details hints if is not too small and isn't in selecting mode
283  if (s.scale * myHintSize > 1.) {
284  // set values relative to mouse position regarding to shape
285  bool mouseOverVertex = false;
287  Position mousePosition = myViewNet->getPositionInformation();
288  double distanceToShape = myGeometry.shape.distance2D(mousePosition);
289  // set colors
290  RGBColor invertedColor, darkerColor;
291  if (drawUsingSelectColor()) {
292  invertedColor = s.colorSettings.selectionColor.invertedColor();
293  darkerColor = s.colorSettings.selectionColor.changedBrightness(-32);
294  } else {
295  invertedColor = GLHelper::getColor().invertedColor();
296  darkerColor = GLHelper::getColor().changedBrightness(-32);
297  }
298  // Draw geometry hints if polygon's shape isn't blocked
299  if (myBlockShape == false) {
300  // draw a boundary for moving using darkerColor
301  glPushMatrix();
302  glTranslated(0, 0, GLO_POLYGON + 0.01);
303  GLHelper::setColor(darkerColor);
305  glPopMatrix();
306  // draw shape points only in Network supemode
308  for (auto i : myGeometry.shape) {
310  glPushMatrix();
311  glTranslated(i.x(), i.y(), GLO_POLYGON + 0.02);
312  // Change color of vertex and flag mouseOverVertex if mouse is over vertex
313  if (modeMove && (i.distanceTo(mousePosition) < myHintSize)) {
314  mouseOverVertex = true;
315  GLHelper::setColor(invertedColor);
316  } else {
317  GLHelper::setColor(darkerColor);
318  }
320  glPopMatrix();
321  }
322  }
323  // check if draw moving hint has to be drawed
324  if (modeMove && (mouseOverVertex == false) && (myBlockMovement == false) && (distanceToShape < myHintSize)) {
325  // push matrix
326  glPushMatrix();
328  glTranslated(hintPos.x(), hintPos.y(), GLO_POLYGON + 0.04);
329  GLHelper::setColor(invertedColor);
331  glPopMatrix();
332  }
333  }
334  }
335  }
336  // check if dotted contour has to be drawn
337  if ((myViewNet->getDottedAC() == this) || (myViewNet->getViewParent()->getTAZFrame()->getTAZCurrentModul()->getTAZ() == this)) {
339  }
340  // pop name
341  glPopName();
342 }
343 
344 
345 std::string
347  switch (key) {
348  case SUMO_ATTR_ID:
349  return getAdditionalID();
350  case SUMO_ATTR_SHAPE:
351  return toString(myGeometry.shape);
352  case SUMO_ATTR_COLOR:
353  return toString(myColor);
354  case SUMO_ATTR_EDGES: {
355  std::vector<std::string> edgeIDs;
356  for (auto i : getAdditionalChildren()) {
357  edgeIDs.push_back(i->getAttribute(SUMO_ATTR_EDGE));
358  }
359  return toString(edgeIDs);
360  }
362  return toString(myBlockMovement);
364  return toString(myBlockShape);
365  case GNE_ATTR_SELECTED:
367  case GNE_ATTR_GENERIC:
368  return getGenericParametersStr();
369  case GNE_ATTR_MIN_SOURCE:
370  return toString(myMinWeightSource);
371  case GNE_ATTR_MIN_SINK:
372  return toString(myMinWeightSink);
373  case GNE_ATTR_MAX_SOURCE:
374  return toString(myMaxWeightSource);
375  case GNE_ATTR_MAX_SINK:
376  return toString(myMaxWeightSink);
381  default:
382  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
383  }
384 }
385 
386 
387 void
388 GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
389  if (value == getAttribute(key)) {
390  return; //avoid needless changes, later logic relies on the fact that attributes have changed
391  }
392  switch (key) {
393  case SUMO_ATTR_ID:
394  case SUMO_ATTR_SHAPE:
395  case SUMO_ATTR_COLOR:
396  case SUMO_ATTR_EDGES:
399  case GNE_ATTR_SELECTED:
400  case GNE_ATTR_GENERIC:
401  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
402  break;
403  default:
404  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
405  }
406 }
407 
408 
409 bool
410 GNETAZ::isValid(SumoXMLAttr key, const std::string& value) {
411  switch (key) {
412  case SUMO_ATTR_ID:
413  return isValidAdditionalID(value);
414  case SUMO_ATTR_SHAPE:
415  return canParse<PositionVector>(value);
416  case SUMO_ATTR_COLOR:
417  return canParse<RGBColor>(value);
418  case SUMO_ATTR_EDGES:
419  if (value.empty()) {
420  return true;
421  } else {
423  }
425  return canParse<bool>(value);
427  return canParse<bool>(value);
428  case GNE_ATTR_SELECTED:
429  return canParse<bool>(value);
430  case GNE_ATTR_GENERIC:
431  return isGenericParametersValid(value);
432  default:
433  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
434  }
435 }
436 
437 
438 std::string
440  return getTagStr() + ":" + getID();
441 }
442 
443 
444 std::string
446  return getTagStr();
447 }
448 
449 
450 void
452  // reset all stadistic variables
453  myMaxWeightSource = 0;
454  myMinWeightSource = -1;
456  myMaxWeightSink = 0;
457  myMinWeightSink = -1;
459  // declare an extra variables for saving number of children
460  int numberOfSources = 0;
461  int numberOfSinks = 0;
462  // iterate over additional children
463  for (auto i : getAdditionalChildren()) {
464  if (i->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) {
465  double weight = parse<double>(i->getAttribute(SUMO_ATTR_WEIGHT));
466  // check max Weight
467  if (myMaxWeightSource < weight) {
468  myMaxWeightSource = weight;
469  }
470  // check min Weight
471  if ((myMinWeightSource == -1) || (weight < myMinWeightSource)) {
472  myMinWeightSource = weight;
473  }
474  // update Average
475  myAverageWeightSource += weight;
476  // update number of sources
477  numberOfSources++;
478  } else if (i->getTagProperty().getTag() == SUMO_TAG_TAZSINK) {
479  double weight = parse<double>(i->getAttribute(SUMO_ATTR_WEIGHT));
480  // check max Weight
481  if (myMaxWeightSink < weight) {
482  myMaxWeightSink = weight;
483  }
484  // check min Weight
485  if ((myMinWeightSink == -1) || (weight < myMinWeightSink)) {
486  myMinWeightSink = weight;
487  }
488  // update Average
489  myAverageWeightSink += weight;
490  // update number of sinks
491  numberOfSinks++;
492  }
493  }
494  // calculate average
495  myAverageWeightSource /= numberOfSources;
496  myAverageWeightSink /= numberOfSinks;
497 }
498 
499 // ===========================================================================
500 // private
501 // ===========================================================================
502 
503 void
504 GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value) {
505  switch (key) {
506  case SUMO_ATTR_ID:
507  changeAdditionalID(value);
508  break;
509  case SUMO_ATTR_SHAPE:
511  myGeometry.shape = parse<PositionVector>(value);
513  break;
514  case SUMO_ATTR_COLOR:
515  myColor = parse<RGBColor>(value);
516  break;
517  case SUMO_ATTR_EDGES:
518  break;
520  myBlockMovement = parse<bool>(value);
521  break;
523  myBlockShape = parse<bool>(value);
524  break;
525  case GNE_ATTR_SELECTED:
526  if (parse<bool>(value)) {
528  } else {
530  }
531  break;
532  case GNE_ATTR_GENERIC:
534  break;
535  default:
536  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
537  }
538 }
539 
540 
541 /****************************************************************************/
GNETAZ::myCurrentMovingVertexIndex
int myCurrentMovingVertexIndex
index of vertex that is been moved (-1 means that none vertex is been moved)
Definition: GNETAZ.h:159
GUIVisualizationSettings::polySize
GUIVisualizationSizeSettings polySize
Definition: GUIVisualizationSettings.h:607
GNETAZ::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:64
GNETAZFrame::getTAZCurrentModul
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
Definition: GNETAZFrame.cpp:1453
GLHelper::getColor
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:622
GNETAZ::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:346
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
PositionVector::getPolygonCenter
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
Definition: PositionVector.cpp:392
GNEAdditional::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEAdditional.cpp:704
GNEAdditional::getAdditionalID
const std::string & getAdditionalID() const
Definition: GNEAdditional.cpp:578
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1187
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
GNETAZ::deleteGeometryPoint
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNETAZ.cpp:210
GNETAZ::getVertexIndex
int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape's edge
Definition: GNETAZ.cpp:189
GNE_ATTR_AVERAGE_SINK
average sink (used only by TAZs)
Definition: SUMOXMLDefinitions.h:998
GNETAZ::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:255
GNEAdditional::AdditionalGeometry::shape
PositionVector shape
The shape of the additional element.
Definition: GNEAdditional.h:68
GNEAdditional::AdditionalMove::movingGeometryBoundary
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE
Definition: GNEAdditional.h:326
GUIGlObject::drawName
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
Definition: GUIGlObject.cpp:355
GUIVisualizationSettings::angle
double angle
The current view rotation angle.
Definition: GUIVisualizationSettings.h:403
GNEUndoList::p_end
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:80
PositionVector::insertAtClosest
int insertAtClosest(const Position &p)
inserts p between the two closest positions and returns the insertion index
Definition: PositionVector.cpp:951
GNETAZ::myAverageWeightSink
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:184
GUIVisualizationSettings::drawBoundaries
bool drawBoundaries
enable or disable draw boundaries
Definition: GUIVisualizationSettings.h:629
GLHelper::drawBoxLines
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:182
GNENet::removeGLObjectFromGrid
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1279
GNE_ATTR_MIN_SINK
min sink (used only by TAZs)
Definition: SUMOXMLDefinitions.h:990
GNEAdditional::getShape
PositionVector getShape() const
Returns additional element's shape.
Definition: GNEAdditional.cpp:393
SUMO_TAG_TAZSOURCE
a source within a district (connection road)
Definition: SUMOXMLDefinitions.h:136
GNEAttributeCarrier::isGenericParametersValid
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
Definition: GNEAttributeCarrier.cpp:1354
GNETAZ::updateAdditionalParent
void updateAdditionalParent()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:451
SUMO_ATTR_EDGE
Definition: SUMOXMLDefinitions.h:424
GNETAZ::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNETAZ.cpp:410
GNEViewParent::getTAZFrame
GNETAZFrame * getTAZFrame() const
get frame for GNE_NMODE_TAZ
Definition: GNEViewParent.cpp:215
SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:701
Boundary::getHeight
double getHeight() const
Returns the height of the boundary (y-axis)
Definition: Boundary.cpp:161
GNEViewNet
Definition: GNEViewNet.h:43
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:379
GNETAZFrame::TAZCurrent::getTAZ
GNETAZ * getTAZ() const
get current TAZ
Definition: GNETAZFrame.cpp:215
GLHelper.h
GNETAZ::myColor
RGBColor myColor
TAZ Color.
Definition: GNETAZ.h:153
GNEAdditional::changeAdditionalID
void changeAdditionalID(const std::string &newID)
change ID of additional
Definition: GNEAdditional.cpp:604
PositionVector
A list of positions.
Definition: PositionVector.h:46
GNEAdditional::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEAdditional.cpp:634
GNETAZ::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNETAZ.cpp:91
GUIVisualizationSettings::polyName
GUIVisualizationTextSettings polyName
Definition: GUIVisualizationSettings.h:610
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
PositionVector::getBoxBoundary
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Definition: PositionVector.cpp:382
GUISUMOAbstractView::snapToActiveGrid
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.
Definition: GUISUMOAbstractView.cpp:194
GNETAZ::myMaxWeightSource
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:169
GNEAdditional::myMove
AdditionalMove myMove
variable AdditionalMove
Definition: GNEAdditional.h:371
SUMO_ATTR_WEIGHT
Definition: SUMOXMLDefinitions.h:422
GLO_POLYGON
a polygon
Definition: GUIGlObjectTypes.h:105
GNEAdditional::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
Definition: GNEAdditional.h:365
GLHelper::drawBoundary
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:812
GNE_ATTR_MAX_SOURCE
max source (used only by TAZs)
Definition: SUMOXMLDefinitions.h:992
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
GNEAttributeCarrier::GNEChange_Attribute
friend class GNEChange_Attribute
declare friend class
Definition: GNEAttributeCarrier.h:57
GNEUndoList::p_add
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
Definition: GNEUndoList.cpp:132
PositionVector::add
void add(double xoff, double yoff, double zoff)
Definition: PositionVector.cpp:609
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
GNE_ATTR_MIN_SOURCE
min source (used only by TAZs)
Definition: SUMOXMLDefinitions.h:988
GLHelper::drawFilledCircle
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:348
GNEAdditional::isAttributeCarrierSelected
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
Definition: GNEAdditional.cpp:650
PositionVector::nearest_offset_to_point2D
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Definition: PositionVector.cpp:809
GNETAZ::GNETAZ
GNETAZ(const std::string &id, GNEViewNet *viewNet, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:44
GNETAZ::commitShapeChange
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(....
Definition: GNETAZ.cpp:162
RGBColor
Definition: RGBColor.h:40
GNETAZ.h
GNETAZ::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:445
GNETAZ::~GNETAZ
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:60
GNEAdditional::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEAdditional.cpp:619
GNEViewNet.h
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:939
SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:428
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNE_ATTR_AVERAGE_SOURCE
average source (used only by TAZs)
Definition: SUMOXMLDefinitions.h:996
GLHelper::drawShapeDottedContourAroundClosedShape
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
Boundary::getWidth
double getWidth() const
Returns the width of the boudary (x-axis)
Definition: Boundary.cpp:155
GNETAZ::myHintSizeSquared
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:166
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:623
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:309
GNETAZ::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNETAZ.cpp:102
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
Position::x
double x() const
Returns the x-position.
Definition: Position.h:57
GNE_ATTR_BLOCK_SHAPE
block shape of a graphic element (Used mainly in GNEShapes)
Definition: SUMOXMLDefinitions.h:980
GNEViewNet::getUndoList
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:933
GNETAZ::myHintSize
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:163
GLHelper::drawLine
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
GNETAZ::moveVertexShape
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNETAZ.cpp:111
GNE_ATTR_MAX_SINK
max sink (used only by TAZs)
Definition: SUMOXMLDefinitions.h:994
GNETAZ::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes
Definition: GNETAZ.cpp:388
GNETAZFrame.h
PositionVector::indexOfClosest
int indexOfClosest(const Position &p) const
index of the closest position to p
Definition: PositionVector.cpp:932
GNEAdditional::myBlockMovement
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse)
Definition: GNEAdditional.h:377
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:188
GUIVisualizationSizeSettings::minSize
double minSize
The minimum size to draw this object.
Definition: GUIVisualizationSettings.h:104
Position::distanceSquaredTo2D
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:249
GUIVisualizationSettings::colorSettings
GUIVisualizationColorSettings colorSettings
color settings
Definition: GUIVisualizationSettings.h:649
PositionVector::distance2D
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
Definition: PositionVector.cpp:1242
GUIVisualizationColorSettings::selectionColor
RGBColor selectionColor
basic selection color
Definition: GUIVisualizationSettings.h:130
GUIVisualizationSettings::getCircleResolution
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
Definition: GUIVisualizationSettings.cpp:1631
SUMO_TAG_TAZ
a traffic assignment zone
Definition: SUMOXMLDefinitions.h:134
GNEViewParent.h
GNETAZ::myAverageWeightSource
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:175
GLIncludes.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
GNE_ATTR_GENERIC
generic attribute
Definition: SUMOXMLDefinitions.h:986
GNENet::addGLObjectIntoGrid
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1273
SUMO_TAG_TAZSINK
a sink within a district (connection road)
Definition: SUMOXMLDefinitions.h:138
Position::y
double y() const
Returns the y-position.
Definition: Position.h:62
GNETAZ::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:76
PositionVector::positionAtOffset2D
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:268
GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
Definition: GNEViewNetHelper.h:49
InvalidArgument
Definition: UtilExceptions.h:57
GNETAZ::isShapeBlocked
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:243
GNEAdditional::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEAdditional.cpp:678
GNEHierarchicalElementChildren::getAdditionalChildren
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementChildren.cpp:132
GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
Definition: SUMOXMLDefinitions.h:978
GNETAZ::myBlockShape
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:156
GNEAdditional::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEAdditional.cpp:656
PositionVector::getCentroid
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Definition: PositionVector.cpp:406
GNETAZ::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:70
GNEAdditional::myGeometry
AdditionalGeometry myGeometry
geometry to be precomputed in updateGeometry(...)
Definition: GNEAdditional.h:368
GNETAZ::myMinWeightSource
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:172
config.h
RGBColor::invertedColor
RGBColor invertedColor() const
obtain inverted of current RGBColor
Definition: RGBColor.cpp:143
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:968
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:399
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
GNETAZ::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:439
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1165
SUMOXMLDefinitions::isValidListOfTypeID
static bool isValidListOfTypeID(const std::string &value)
whether the given string is a valid list of ids for an edge or vehicle type (empty aren't allowed)
Definition: SUMOXMLDefinitions.cpp:1017
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GLO_TAZ
a TAZ
Definition: GUIGlObjectTypes.h:100
GNEAdditional::isValidAdditionalID
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
Definition: GNEAdditional.cpp:584
GNEUndoList::p_begin
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
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
RGBColor::changedBrightness
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:154
SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:687
GNEAdditional::AdditionalMove::originalViewPosition
Position originalViewPosition
value for saving first original position over lane before moving
Definition: GNEAdditional.h:329
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:164
GNEViewNetHelper::EditModes::networkEditMode
NetworkEditMode networkEditMode
the current Network edit mode
Definition: GNEViewNetHelper.h:312
GNE_NMODE_MOVE
mode for moving network elements
Definition: GNEViewNetHelper.h:63
GNETAZ::moveEntireShape
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNETAZ.cpp:146
GNEChange_Attribute.h
GNENet.h
GUIVisualizationSizeSettings::getExaggeration
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
Definition: GUIVisualizationSettings.cpp:212
GNEViewNet::getViewParent
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
GNETAZ::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:249
GNETAZ::myMaxWeightSink
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:178
PositionVector::removeDoublePoints
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
Definition: PositionVector.cpp:1307
GNETAZ::myMinWeightSink
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:181
GNEUndoList.h
GUIVisualizationSettings::drawForSelecting
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
Definition: GUIVisualizationSettings.h:635