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 /****************************************************************************/
14 //
15 /****************************************************************************/
16 
17 // ===========================================================================
18 // included modules
19 // ===========================================================================
20 #include <config.h>
21 
22 #include <utils/gui/div/GLHelper.h>
24 #include <netedit/GNEUndoList.h>
25 #include <netedit/GNEViewNet.h>
26 #include <netedit/GNENet.h>
28 #include <netedit/GNEViewParent.h>
30 #include "GNETAZ.h"
31 
32 
33 // ===========================================================================
34 // static members
35 // ===========================================================================
36 const double GNETAZ::myHintSize = 0.8;
37 const double GNETAZ::myHintSizeSquared = 0.64;
38 
39 
40 // ===========================================================================
41 // member method definitions
42 // ===========================================================================
43 GNETAZ::GNETAZ(const std::string& id, GNEViewNet* viewNet, PositionVector shape, RGBColor color, bool blockMovement) :
44  GNEAdditional(id, viewNet, GLO_TAZ, SUMO_TAG_TAZ, "", blockMovement, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}),
45  myColor(color),
46  myTAZShape(shape),
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 }
56 
57 
59 
60 
61 const PositionVector&
63  return myTAZShape;
64 }
65 
66 
67 void
69  // Nothing to do
70 }
71 
72 
75  return myTAZShape.getCentroid();
76 }
77 
78 
81  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
84  } else if (myTAZShape.size() > 0) {
86  b.grow(20);
87  return b;
88  } else {
89  return Boundary(-0.1, -0.1, 0.1, 0.1);
90  }
91 }
92 
93 
94 void
95 GNETAZ::splitEdgeGeometry(const double /*splitPosition*/, const GNENetElement* /*originalElement*/, const GNENetElement* /*newElement*/, GNEUndoList* /*undoList*/) {
96  // geometry of this element cannot be splitted
97 }
98 
99 
100 void
102  // restore old position, apply offset and update Geometry
104  myTAZShape[0].add(offset);
105  // filtern position using snap to active grid
107 }
108 
109 
110 void
112  // commit new position allowing undo/redo
113  undoList->p_begin("position of " + getTagStr());
115  undoList->p_end();
116 }
117 
118 
119 int
120 GNETAZ::moveVertexShape(const int index, const Position& oldPos, const Position& offset) {
121  // only move shape if block movement block shape are disabled
122  if (!myBlockMovement && !myBlockShape && (index != -1)) {
123  // check that index is correct before change position
124  if (index < (int)myTAZShape.size()) {
125  // save current moving Geometry Point
127  // if closed shape and cliked is first or last, move both giving more priority to first always
128  if ((index == 0 || index == (int)myTAZShape.size() - 1)) {
129  // Change position of first shape Geometry Point and filtern position using snap to active grid
130  myTAZShape.front() = oldPos;
131  myTAZShape.front().add(offset);
132  myTAZShape.front() = myViewNet->snapToActiveGrid(myTAZShape.front());
133  // Change position of last shape Geometry Point and filtern position using snap to active grid
134  myTAZShape.back() = oldPos;
135  myTAZShape.back().add(offset);
137  } else {
138  // change position of Geometry Point and filtern position using snap to active grid
139  myTAZShape[index] = oldPos;
140  myTAZShape[index].add(offset);
142  }
143  // return index of moved Geometry Point
144  return index;
145  } else {
146  throw InvalidArgument("Index greater than shape size");
147  }
148  } else {
149  return index;
150  }
151 }
152 
153 
154 void
155 GNETAZ::moveEntireShape(const PositionVector& oldShape, const Position& offset) {
156  // only move shape if block movement is disabled and block shape is enabled
157  if (!myBlockMovement && myBlockShape) {
158  // restore original shape
159  myTAZShape = oldShape;
160  // change all points of the shape shape using offset
161  for (auto& i : myTAZShape) {
162  i.add(offset);
163  }
164  }
165 }
166 
167 
168 void
170  if (!myBlockMovement) {
171  // disable current moving vertex
173  // restore original shape into shapeToCommit
174  PositionVector shapeToCommit = myTAZShape;
175  // restore old shape in polygon (to avoid problems with RTree)
176  myTAZShape = oldShape;
177  // first check if double points has to be removed
178  shapeToCommit.removeDoublePoints(myHintSize);
179  if (shapeToCommit.size() != myTAZShape.size()) {
180  WRITE_WARNING("Merged shape's point")
181  }
182  // check if polygon has to be closed
183  if (shapeToCommit.size() > 1 && shapeToCommit.front().distanceTo2D(shapeToCommit.back()) < (2 * myHintSize)) {
184  shapeToCommit.pop_back();
185  shapeToCommit.push_back(shapeToCommit.front());
186  }
187  // commit new shape
188  undoList->p_begin("moving " + toString(SUMO_ATTR_SHAPE) + " of " + getTagStr());
189  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), SUMO_ATTR_SHAPE, toString(shapeToCommit)));
190  undoList->p_end();
191  }
192 }
193 
194 
195 int
196 GNETAZ::getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid) {
197  // check if position has to be snapped to grid
198  if (snapToGrid) {
199  pos = myViewNet->snapToActiveGrid(pos);
200  }
201  // first check if vertex already exists
202  for (auto i : myTAZShape) {
203  if (i.distanceTo2D(pos) < myHintSize) {
204  return myTAZShape.indexOfClosest(i);
205  }
206  }
207  // if vertex doesn't exist, insert it
208  if (createIfNoExist) {
209  return myTAZShape.insertAtClosest(pos, true);
210  } else {
211  return -1;
212  }
213 }
214 
215 
216 void
217 GNETAZ::deleteGeometryPoint(const Position& pos, bool allowUndo) {
218  if (myTAZShape.size() > 2) {
219  // obtain index
220  PositionVector modifiedShape = myTAZShape;
221  int index = modifiedShape.indexOfClosest(pos);
222  // remove point dependending of
223  if ((index == 0 || index == (int)modifiedShape.size() - 1)) {
224  modifiedShape.erase(modifiedShape.begin());
225  modifiedShape.erase(modifiedShape.end() - 1);
226  modifiedShape.push_back(modifiedShape.front());
227  } else {
228  modifiedShape.erase(modifiedShape.begin() + index);
229  }
230  // set new shape depending of allowUndo
231  if (allowUndo) {
232  myViewNet->getUndoList()->p_begin("delete geometry point");
235  } else {
236  // first remove object from grid due shape is used for boundary
238  // set new shape
239  myTAZShape = modifiedShape;
240  // add object into grid again
242  }
243  } else {
244  WRITE_WARNING("Number of remaining points insufficient")
245  }
246 }
247 
248 
249 bool
251  return myBlockShape;
252 }
253 
254 
255 std::string
257  return myViewNet->getNet()->getMicrosimID();
258 }
259 
260 
261 void
263  // check if boundary has to be drawn
264  if (s.drawBoundaries) {
266  }
267  if (s.polySize.getExaggeration(s, this) == 0) {
268  return;
269  }
270  Boundary boundary = myTAZShape.getBoxBoundary();
271  if (s.scale * MAX2(boundary.getWidth(), boundary.getHeight()) < s.polySize.minSize) {
272  return;
273  }
274  glPushName(getGlID());
275  if (myTAZShape.size() > 1) {
276  glPushMatrix();
277  glTranslated(0, 0, 128);
278  if (drawUsingSelectColor()) {
280  } else {
282  }
285  glPopMatrix();
286  const Position namePos = myTAZShape.getPolygonCenter();
287  drawName(namePos, s.scale, s.polyName, s.angle);
288  }
289  // draw geometry details hints if is not too small and isn't in selecting mode
290  if (s.scale * myHintSize > 1.) {
291  // set values relative to mouse position regarding to shape
292  bool mouseOverVertex = false;
294  Position mousePosition = myViewNet->getPositionInformation();
295  double distanceToShape = myTAZShape.distance2D(mousePosition);
296  // set colors
297  RGBColor invertedColor, darkerColor;
298  if (drawUsingSelectColor()) {
299  invertedColor = s.colorSettings.selectionColor.invertedColor();
300  darkerColor = s.colorSettings.selectionColor.changedBrightness(-32);
301  } else {
302  invertedColor = GLHelper::getColor().invertedColor();
303  darkerColor = GLHelper::getColor().changedBrightness(-32);
304  }
305  // Draw geometry hints if polygon's shape isn't blocked
306  if (myBlockShape == false) {
307  // draw a boundary for moving using darkerColor
308  glPushMatrix();
309  glTranslated(0, 0, GLO_POLYGON + 0.01);
310  GLHelper::setColor(darkerColor);
312  glPopMatrix();
313  // draw shape points only in Network supemode
315  for (auto i : myTAZShape) {
317  glPushMatrix();
318  glTranslated(i.x(), i.y(), GLO_POLYGON + 0.02);
319  // Change color of vertex and flag mouseOverVertex if mouse is over vertex
320  if (modeMove && (i.distanceTo2D(mousePosition) < myHintSize)) {
321  mouseOverVertex = true;
322  GLHelper::setColor(invertedColor);
323  } else {
324  GLHelper::setColor(darkerColor);
325  }
327  glPopMatrix();
328  }
329  }
330  // check if draw moving hint has to be drawed
331  if (modeMove && (mouseOverVertex == false) && (myBlockMovement == false) && (distanceToShape < myHintSize)) {
332  // push matrix
333  glPushMatrix();
335  glTranslated(hintPos.x(), hintPos.y(), GLO_POLYGON + 0.04);
336  GLHelper::setColor(invertedColor);
338  glPopMatrix();
339  }
340  }
341  }
342  }
343  // check if dotted contour has to be drawn
344  if ((myViewNet->getDottedAC() == this) || (myViewNet->getViewParent()->getTAZFrame()->getTAZCurrentModul()->getTAZ() == this)) {
346  }
347  // pop name
348  glPopName();
349 }
350 
351 
352 std::string
354  switch (key) {
355  case SUMO_ATTR_ID:
356  return getAdditionalID();
357  case SUMO_ATTR_SHAPE:
358  return toString(myTAZShape);
359  case SUMO_ATTR_COLOR:
360  return toString(myColor);
361  case SUMO_ATTR_EDGES: {
362  std::vector<std::string> edgeIDs;
363  for (auto i : getChildAdditionals()) {
364  edgeIDs.push_back(i->getAttribute(SUMO_ATTR_EDGE));
365  }
366  return toString(edgeIDs);
367  }
369  return toString(myBlockMovement);
371  return toString(myBlockShape);
372  case GNE_ATTR_SELECTED:
374  case GNE_ATTR_PARAMETERS:
375  return getParametersStr();
376  case GNE_ATTR_MIN_SOURCE:
377  return toString(myMinWeightSource);
378  case GNE_ATTR_MIN_SINK:
379  return toString(myMinWeightSink);
380  case GNE_ATTR_MAX_SOURCE:
381  return toString(myMaxWeightSource);
382  case GNE_ATTR_MAX_SINK:
383  return toString(myMaxWeightSink);
388  default:
389  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
390  }
391 }
392 
393 
394 double
396  switch (key) {
397  case GNE_ATTR_MIN_SOURCE:
398  return myMinWeightSource;
399  case GNE_ATTR_MIN_SINK:
400  return myMinWeightSink;
401  case GNE_ATTR_MAX_SOURCE:
402  return myMaxWeightSource;
403  case GNE_ATTR_MAX_SINK:
404  return myMaxWeightSink;
406  return myAverageWeightSource;
408  return myAverageWeightSink;
409  default:
410  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
411  }
412 }
413 
414 
415 void
416 GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
417  if (value == getAttribute(key)) {
418  return; //avoid needless changes, later logic relies on the fact that attributes have changed
419  }
420  switch (key) {
421  case SUMO_ATTR_ID:
422  case SUMO_ATTR_SHAPE:
423  case SUMO_ATTR_COLOR:
424  case SUMO_ATTR_EDGES:
427  case GNE_ATTR_SELECTED:
428  case GNE_ATTR_PARAMETERS:
429  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
430  break;
431  default:
432  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
433  }
434 }
435 
436 
437 bool
438 GNETAZ::isValid(SumoXMLAttr key, const std::string& value) {
439  switch (key) {
440  case SUMO_ATTR_ID:
441  return isValidAdditionalID(value);
442  case SUMO_ATTR_SHAPE:
443  return canParse<PositionVector>(value);
444  case SUMO_ATTR_COLOR:
445  return canParse<RGBColor>(value);
446  case SUMO_ATTR_EDGES:
447  if (value.empty()) {
448  return true;
449  } else {
451  }
453  return canParse<bool>(value);
455  return canParse<bool>(value);
456  case GNE_ATTR_SELECTED:
457  return canParse<bool>(value);
458  case GNE_ATTR_PARAMETERS:
459  return Parameterised::areParametersValid(value);
460  default:
461  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
462  }
463 }
464 
465 
466 bool
468  return true;
469 }
470 
471 
472 std::string
474  return getTagStr() + ":" + getID();
475 }
476 
477 
478 std::string
480  return getTagStr();
481 }
482 
483 
484 void
486  // reset all stadistic variables
487  myMaxWeightSource = 0;
488  myMinWeightSource = -1;
490  myMaxWeightSink = 0;
491  myMinWeightSink = -1;
493  // declare an extra variables for saving number of children
494  int numberOfSources = 0;
495  int numberOfSinks = 0;
496  // iterate over child additional
497  for (auto i : getChildAdditionals()) {
498  if (i->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) {
499  double weight = i->getAttributeDouble(SUMO_ATTR_WEIGHT);
500  // check max Weight
501  if (myMaxWeightSource < weight) {
502  myMaxWeightSource = weight;
503  }
504  // check min Weight
505  if ((myMinWeightSource == -1) || (weight < myMinWeightSource)) {
506  myMinWeightSource = weight;
507  }
508  // update Average
509  myAverageWeightSource += weight;
510  // update number of sources
511  numberOfSources++;
512  } else if (i->getTagProperty().getTag() == SUMO_TAG_TAZSINK) {
513  double weight = i->getAttributeDouble(SUMO_ATTR_WEIGHT);
514  // check max Weight
515  if (myMaxWeightSink < weight) {
516  myMaxWeightSink = weight;
517  }
518  // check min Weight
519  if ((myMinWeightSink == -1) || (weight < myMinWeightSink)) {
520  myMinWeightSink = weight;
521  }
522  // update Average
523  myAverageWeightSink += weight;
524  // update number of sinks
525  numberOfSinks++;
526  }
527  }
528  // calculate average
529  myAverageWeightSource /= numberOfSources;
530  myAverageWeightSink /= numberOfSinks;
531 }
532 
533 // ===========================================================================
534 // private
535 // ===========================================================================
536 
537 void
538 GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value) {
539  switch (key) {
540  case SUMO_ATTR_ID:
541  changeAdditionalID(value);
542  break;
543  case SUMO_ATTR_SHAPE:
545  myTAZShape = parse<PositionVector>(value);
547  break;
548  case SUMO_ATTR_COLOR:
549  myColor = parse<RGBColor>(value);
550  break;
551  case SUMO_ATTR_EDGES:
552  break;
554  myBlockMovement = parse<bool>(value);
555  break;
557  myBlockShape = parse<bool>(value);
558  break;
559  case GNE_ATTR_SELECTED:
560  if (parse<bool>(value)) {
562  } else {
564  }
565  break;
566  case GNE_ATTR_PARAMETERS:
567  setParametersStr(value);
568  break;
569  default:
570  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
571  }
572 }
573 
574 
575 /****************************************************************************/
GNETAZ::myCurrentMovingVertexIndex
int myCurrentMovingVertexIndex
index of vertex that is been moved (-1 means that none vertex is been moved)
Definition: GNETAZ.h:178
GUIVisualizationSettings::polySize
GUIVisualizationSizeSettings polySize
Definition: GUIVisualizationSettings.h:616
GNETAZ::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:68
GNETAZFrame::getTAZCurrentModul
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
Definition: GNETAZFrame.cpp:1452
GLHelper::getColor
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:627
GNETAZ::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:353
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
Parameterised::getParametersStr
std::string getParametersStr() const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
Definition: Parameterised.cpp:112
PositionVector::getPolygonCenter
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
Definition: PositionVector.cpp:400
GNEAdditional::getAdditionalID
const std::string & getAdditionalID() const
Definition: GNEAdditional.cpp:476
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1289
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
GNETAZ::deleteGeometryPoint
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNETAZ.cpp:217
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:196
GNE_ATTR_AVERAGE_SINK
average sink (used only by TAZs)
Definition: SUMOXMLDefinitions.h:1001
GNETAZ::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:262
GNEAdditional::AdditionalMove::movingGeometryBoundary
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE
Definition: GNEAdditional.h:288
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:354
GUIVisualizationSettings::angle
double angle
The current view rotation angle.
Definition: GUIVisualizationSettings.h:405
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:79
GUIVisualizationSettings::drawForRectangleSelection
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
Definition: GUIVisualizationSettings.h:647
GNETAZ::myAverageWeightSink
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:203
GUIVisualizationSettings::drawBoundaries
bool drawBoundaries
enable or disable draw boundaries
Definition: GUIVisualizationSettings.h:638
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:1328
GNE_ATTR_MIN_SINK
min sink (used only by TAZs)
Definition: SUMOXMLDefinitions.h:993
GNETAZ::myTAZShape
PositionVector myTAZShape
TAZ shape.
Definition: GNETAZ.h:172
SUMO_TAG_TAZSOURCE
a source within a district (connection road)
Definition: SUMOXMLDefinitions.h:135
GNETAZ::updateParentAdditional
void updateParentAdditional()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:485
SUMO_ATTR_EDGE
Definition: SUMOXMLDefinitions.h:423
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:438
GNETAZ::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNETAZ.cpp:395
GNEViewParent::getTAZFrame
GNETAZFrame * getTAZFrame() const
get frame for GNE_NMODE_TAZ
Definition: GNEViewParent.cpp:216
SUMO_ATTR_COLOR
A color information.
Definition: SUMOXMLDefinitions.h:704
Boundary::getHeight
double getHeight() const
Returns the height of the boundary (y-axis)
Definition: Boundary.cpp:160
GNEViewNet
Definition: GNEViewNet.h:42
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
GNETAZFrame::TAZCurrent::getTAZ
GNETAZ * getTAZ() const
get current TAZ
Definition: GNETAZFrame.cpp:214
GLHelper.h
GNETAZ::myColor
RGBColor myColor
TAZ Color.
Definition: GNETAZ.h:169
GNEAdditional::changeAdditionalID
void changeAdditionalID(const std::string &newID)
change ID of additional
Definition: GNEAdditional.cpp:502
PositionVector
A list of positions.
Definition: PositionVector.h:45
GNEAdditional::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEAdditional.cpp:532
GNETAZ::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNETAZ.cpp:101
GUIVisualizationSettings::polyName
GUIVisualizationTextSettings polyName
Definition: GUIVisualizationSettings.h:619
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:621
PositionVector::getBoxBoundary
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Definition: PositionVector.cpp:390
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:196
GNETAZ::myMaxWeightSource
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:188
GNEAdditional::myMove
AdditionalMove myMove
variable AdditionalMove
Definition: GNEAdditional.h:344
SUMO_ATTR_WEIGHT
Definition: SUMOXMLDefinitions.h:421
GLO_POLYGON
a polygon
Definition: GUIGlObjectTypes.h:104
GNEAdditional::myViewNet
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
Definition: GNEAdditional.h:335
GLHelper::drawBoundary
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:817
GNE_ATTR_MAX_SOURCE
max source (used only by TAZs)
Definition: SUMOXMLDefinitions.h:995
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
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:131
PositionVector::add
void add(double xoff, double yoff, double zoff)
Definition: PositionVector.cpp:617
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:1014
GNE_ATTR_MIN_SOURCE
min source (used only by TAZs)
Definition: SUMOXMLDefinitions.h:991
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:548
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:817
GNETAZ::GNETAZ
GNETAZ(const std::string &id, GNEViewNet *viewNet, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:43
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:169
RGBColor
Definition: RGBColor.h:39
GNETAZ::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNETAZ.cpp:95
GNETAZ.h
GNETAZ::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:479
GNETAZ::~GNETAZ
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:58
GNEAdditional::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
Definition: GNEAdditional.cpp:517
GNEViewNet.h
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:149
GNEViewNet::getDottedAC
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:1026
SUMO_ATTR_EDGES
the edges of a route
Definition: SUMOXMLDefinitions.h:427
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNE_ATTR_AVERAGE_SOURCE
average source (used only by TAZs)
Definition: SUMOXMLDefinitions.h:999
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:154
GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
Definition: SUMOXMLDefinitions.h:989
GNETAZ::myHintSizeSquared
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:185
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:632
GNEViewNetHelper::EditModes::currentSupermode
Supermode currentSupermode
the current supermode
Definition: GNEViewNetHelper.h:305
GNETAZ::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNETAZ.cpp:111
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
Position::x
double x() const
Returns the x-position.
Definition: Position.h:56
GNE_ATTR_BLOCK_SHAPE
block shape of a graphic element (Used mainly in GNEShapes)
Definition: SUMOXMLDefinitions.h:983
GNEViewNet::getUndoList
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:1020
GNETAZ::myHintSize
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:182
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:120
GNE_ATTR_MAX_SINK
max sink (used only by TAZs)
Definition: SUMOXMLDefinitions.h:997
GNENetElement
Definition: GNENetElement.h:43
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:416
GNETAZFrame.h
PositionVector::indexOfClosest
int indexOfClosest(const Position &p) const
index of the closest position to p
Definition: PositionVector.cpp:940
GNEAdditional::myBlockMovement
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse)
Definition: GNEAdditional.h:350
GUISUMOAbstractView::getPositionInformation
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Definition: GUISUMOAbstractView.cpp:190
PositionVector::insertAtClosest
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
Definition: PositionVector.cpp:959
GUIVisualizationSizeSettings::minSize
double minSize
The minimum size to draw this object.
Definition: GUIVisualizationSettings.h:103
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:248
GUIVisualizationSettings::colorSettings
GUIVisualizationColorSettings colorSettings
color settings
Definition: GUIVisualizationSettings.h:677
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:1259
GUIVisualizationColorSettings::selectionColor
RGBColor selectionColor
basic selection color
Definition: GUIVisualizationSettings.h:129
GUIVisualizationSettings::getCircleResolution
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
Definition: GUIVisualizationSettings.cpp:1679
SUMO_TAG_TAZ
a traffic assignment zone
Definition: SUMOXMLDefinitions.h:133
Parameterised::setParametersStr
void setParametersStr(const std::string &paramsString)
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
Definition: Parameterised.cpp:139
GNEViewParent.h
GNETAZ::myAverageWeightSource
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:194
GLIncludes.h
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
GNENet::addGLObjectIntoGrid
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1322
SUMO_TAG_TAZSINK
a sink within a district (connection road)
Definition: SUMOXMLDefinitions.h:137
Position::y
double y() const
Returns the y-position.
Definition: Position.h:61
GNETAZ::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:80
PositionVector::positionAtOffset2D
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:273
Parameterised::areParametersValid
static bool areParametersValid(const std::string &value, bool report=false)
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
Definition: Parameterised.cpp:166
GNE_SUPERMODE_DEMAND
Demanding mode (Routes, Vehicles etc..)
Definition: GNEViewNetHelper.h:48
InvalidArgument
Definition: UtilExceptions.h:56
GNETAZ::isShapeBlocked
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:250
GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
Definition: SUMOXMLDefinitions.h:981
GNETAZ::myBlockShape
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:175
GNEAdditional::drawUsingSelectColor
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
Definition: GNEAdditional.cpp:554
PositionVector::getCentroid
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
Definition: PositionVector.cpp:414
GNETAZ::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:74
GNETAZ::myMinWeightSource
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:191
config.h
RGBColor::invertedColor
RGBColor invertedColor() const
obtain inverted of current RGBColor
Definition: RGBColor.cpp:142
Boundary::isInitialised
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:216
GNE_ATTR_SELECTED
element is selected
Definition: SUMOXMLDefinitions.h:971
GNEViewNet::getEditModes
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:434
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
GNETAZ::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:473
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1267
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:1024
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GLO_TAZ
a TAZ
Definition: GUIGlObjectTypes.h:99
GNEAdditional::isValidAdditionalID
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
Definition: GNEAdditional.cpp:482
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:72
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
RGBColor::changedBrightness
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:153
SUMO_ATTR_SHAPE
edge: the shape in xml-definition
Definition: SUMOXMLDefinitions.h:690
GNEAdditional::AdditionalMove::originalViewPosition
Position originalViewPosition
value for saving first original position over lane before moving
Definition: GNEAdditional.h:291
GUIGlObject::getMicrosimID
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.cpp:163
GNEViewNetHelper::EditModes::networkEditMode
NetworkEditMode networkEditMode
the current Network edit mode
Definition: GNEViewNetHelper.h:308
GNE_NMODE_MOVE
mode for moving network elements
Definition: GNEViewNetHelper.h:62
GNEHierarchicalChildElements::getChildAdditionals
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
Definition: GNEHierarchicalChildElements.cpp:131
GNETAZ::moveEntireShape
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNETAZ.cpp:155
GNETAZ::getTAZShape
const PositionVector & getTAZShape() const
get TAZ shape
Definition: GNETAZ.cpp:62
GNETAZ::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNETAZ.cpp:467
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:1008
GNETAZ::getParentName
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:256
GNETAZ::myMaxWeightSink
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:197
PositionVector::removeDoublePoints
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
Definition: PositionVector.cpp:1344
GNETAZ::myMinWeightSink
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:200
GNEUndoList.h