SUMO - Simulation of Urban MObility
GNECalibrator.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 //
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #ifdef _MSC_VER
25 #include <windows_config.h>
26 #else
27 #include <config.h>
28 #endif
29 
30 #include <string>
31 #include <iostream>
32 #include <utility>
37 #include <utils/common/ToString.h>
38 #include <utils/geom/GeomHelper.h>
45 #include <utils/gui/div/GLHelper.h>
49 
50 #include "GNECalibrator.h"
51 #include "GNEEdge.h"
52 #include "GNELane.h"
53 #include "GNEViewNet.h"
54 #include "GNEUndoList.h"
55 #include "GNENet.h"
56 #include "GNEChange_Attribute.h"
57 #include "GNERouteProbe.h"
58 #include "GNECalibratorDialog.h"
59 
60 
61 // ===========================================================================
62 // member method definitions
63 // ===========================================================================
64 
65 GNECalibrator::GNECalibrator(const std::string& id, GNELane* lane, GNEViewNet* viewNet, double pos,
66  double frequency, const std::string& output, const std::vector<GNECalibratorRoute>& calibratorRoutes,
67  const std::vector<GNECalibratorFlow>& calibratorFlows, const std::vector<GNECalibratorVehicleType>& calibratorVehicleTypes) :
69  myPositionOverLane(pos / lane->getLaneParametricLength()),
70  myFrequency(frequency),
71  myOutput(output),
72  myRouteProbe(NULL),
73  myCalibratorRoutes(calibratorRoutes),
74  myCalibratorFlows(calibratorFlows),
75  myCalibratorVehicleTypes(calibratorVehicleTypes) {
76  // This additional belong to a lane
77  myLane = lane;
78  // this additional ISN'T movable
79  myMovable = false;
80  // Update geometry;
82  // Center view in the position of calibrator
83  myViewNet->centerTo(getGlID(), false);
84 }
85 
86 
88 
89 
90 void
92  // This additional cannot be moved currently
93 }
94 
95 
96 void
98  // This additional cannot be moved currently
99 }
100 
101 
102 void
104  // Clear all containers
105  myShapeRotations.clear();
106  myShapeLengths.clear();
107  // clear Shape
108  myShape.clear();
109 
110  // Get shape of lane parent
112 
113  // Obtain first position
114  Position f = myShape[0] - Position(1, 0);
115 
116  // Obtain next position
117  Position s = myShape[0] + Position(1, 0);
118 
119  // Save rotation (angle) of the vector constructed by points f and s
121 
122  // Refresh element (neccesary to avoid grabbing problems)
124 }
125 
126 
127 Position
130 }
131 
132 
133 void
135  // Open calibrator dialog
136  GNECalibratorDialog calibratorDialog(this);
137 }
138 
139 
140 void
141 GNECalibrator::writeAdditional(OutputDevice& device, bool volatileOptionsEnabled) const {
142  // Write parameters
143  device.openTag(getTag());
144  device.writeAttr(SUMO_ATTR_ID, getID());
145  // Check if another lane ID must be changed if sidewalks.guess option is enabled
146  if (volatileOptionsEnabled && OptionsCont::getOptions().getBool("sidewalks.guess") && (myLane->getParentEdge().getLanes().front()->isRestricted(SVC_PEDESTRIAN) == false)) {
147  // add a new extra lane to edge
149  // write ID (now is different because there are a new lane)
150  device.writeAttr(SUMO_ATTR_LANE, myLane->getID());
151  // undo set extra lane
152  myViewNet->getUndoList()->undo();
153  } else {
154  device.writeAttr(SUMO_ATTR_LANE, myLane->getID());
155  }
159  // write all routes of this calibrator
160  for (std::vector<GNECalibratorRoute>::const_iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); ++i) {
161  // Open route tag
162  device.openTag(i->getTag());
163  // Write route ID
164  device.writeAttr(SUMO_ATTR_BEGIN, i->getRouteID());
165  // Write edge IDs
166  device.writeAttr(SUMO_ATTR_BEGIN, i->getEdgesIDs());
167  // Write Color
168  device.writeAttr(SUMO_ATTR_BEGIN, i->getColor());
169  // Close flow tag
170  device.closeTag();
171  }
172  // write all vehicle types of this calibrator
173  for (std::vector<GNECalibratorVehicleType>::const_iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); ++i) {
174  // Open vehicle type tag
175  device.openTag(i->getTag());
176  // write id
177  device.writeAttr(SUMO_ATTR_ID, i->getVehicleTypeID());
178  //write accel
179  device.writeAttr(SUMO_ATTR_ACCEL, i->getAccel());
180  // write decel
181  device.writeAttr(SUMO_ATTR_DECEL, i->getDecel());
182  // write sigma
183  device.writeAttr(SUMO_ATTR_SIGMA, i->getSigma());
184  // write tau
185  device.writeAttr(SUMO_ATTR_TAU, i->getTau());
186  // write lenght
187  device.writeAttr(SUMO_ATTR_LENGTH, i->getLength());
188  // write min gap
189  device.writeAttr(SUMO_ATTR_MINGAP, i->getMinGap());
190  // write max speed
191  device.writeAttr(SUMO_ATTR_MAXSPEED, i->getMaxSpeed());
192  // write speed factor
193  device.writeAttr(SUMO_ATTR_SPEEDFACTOR, i->getSpeedFactor());
194  // write speed dev
195  device.writeAttr(SUMO_ATTR_SPEEDDEV, i->getSpeedDev());
196  // write color
197  device.writeAttr(SUMO_ATTR_COLOR, i->getColor());
198  // write vehicle class
199  device.writeAttr(SUMO_ATTR_VCLASS, i->getVClass());
200  // write emission class
201  device.writeAttr(SUMO_ATTR_EMISSIONCLASS, i->getEmissionClass());
202  // write shape
203  device.writeAttr(SUMO_ATTR_SHAPE, i->getShape());
204  // write width
205  device.writeAttr(SUMO_ATTR_WIDTH, i->getWidth());
206  // write filename
207  device.writeAttr(SUMO_ATTR_FILE, i->getFilename());
208  // write impatience
209  device.writeAttr(SUMO_ATTR_IMPATIENCE, i->getImpatience());
210  // write lane change model
211  device.writeAttr(SUMO_ATTR_LANE_CHANGE_MODEL, i->getLaneChangeModel());
212  // write car follow model
213  device.writeAttr(SUMO_ATTR_CAR_FOLLOW_MODEL, i->getCarFollowModel());
214  // write person capacity
215  device.writeAttr(SUMO_ATTR_PERSON_CAPACITY, i->getPersonCapacity());
216  // write container capacity
217  device.writeAttr(SUMO_ATTR_CONTAINER_CAPACITY, i->getContainerCapacity());
218  // write boarding duration
219  device.writeAttr(SUMO_ATTR_BOARDING_DURATION, i->getBoardingDuration());
220  // write loading duration
221  device.writeAttr(SUMO_ATTR_LOADING_DURATION, i->getLoadingDuration());
222  // write get lat alignment
223  device.writeAttr(SUMO_ATTR_LATALIGNMENT, i->getLatAlignment());
224  // write min gap lat
225  device.writeAttr(SUMO_ATTR_MINGAP_LAT, i->getMinGapLat());
226  // write max speed lat
227  device.writeAttr(SUMO_ATTR_MAXSPEED_LAT, i->getMaxSpeedLat());
228  // Close vehicle type tag
229  device.closeTag();
230  }
231  // Write all flows of this calibrator
232  for (std::vector<GNECalibratorFlow>::const_iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); ++i) {
233  // Open flow tag
234  device.openTag(i->getTag());
235  // Write begin
236  device.writeAttr(SUMO_ATTR_BEGIN, i->getBegin());
237  // Write end
238  device.writeAttr(SUMO_ATTR_END, i->getEnd());
239  // Write type
240  device.writeAttr(SUMO_ATTR_TYPE, i->getVehicleType());
241  // Write route
242  device.writeAttr(SUMO_ATTR_ROUTE, i->getRoute());
243  // Write color
244  device.writeAttr(SUMO_ATTR_COLOR, i->getColor());
245  // Write depart lane
246  device.writeAttr(SUMO_ATTR_DEPARTLANE, i->getDepartLane());
247  // Write depart pos
248  device.writeAttr(SUMO_ATTR_DEPARTPOS, i->getDepartPos());
249  // Write depart speed
250  device.writeAttr(SUMO_ATTR_DEPARTSPEED, i->getDepartSpeed());
251  // Write arrival lane
252  device.writeAttr(SUMO_ATTR_ARRIVALLANE, i->getArrivalLane());
253  // Write arrival pos
254  device.writeAttr(SUMO_ATTR_ARRIVALPOS, i->getArrivalPos());
255  // Write arrival speed
256  device.writeAttr(SUMO_ATTR_ARRIVALSPEED, i->getArrivalSpeed());
257  // Write line
258  device.writeAttr(SUMO_ATTR_LINE, i->getLine());
259  // Write person number
260  device.writeAttr(SUMO_ATTR_PERSON_NUMBER, i->getPersonNumber());
261  // Write container number
262  device.writeAttr(SUMO_ATTR_CONTAINER_NUMBER, i->getContainerNumber());
263  // Write reroute
264  device.writeAttr(SUMO_ATTR_REROUTE, i->getReroute());
265  // Write departPosLat
266  device.writeAttr(SUMO_ATTR_DEPARTPOS_LAT, i->getDepartPosLat());
267  // Write arrivalPosLat
268  device.writeAttr(SUMO_ATTR_ARRIVALPOS_LAT, i->getArrivalPosLat());
269  // Write number
270  device.writeAttr(SUMO_ATTR_NUMBER, i->getNumber());
271  // Write type of flow
272  if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PERIOD) {
273  // write period
274  device.writeAttr(SUMO_ATTR_PERIOD, i->getPeriod());
275  } else if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_VEHSPERHOUR) {
276  // write vehs per hour
277  device.writeAttr(SUMO_ATTR_VEHSPERHOUR, i->getVehsPerHour());
278  } else if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PROBABILITY) {
279  // write probability
280  device.writeAttr(SUMO_ATTR_PROB, i->getProbability());
281  }
282  // Close flow tag
283  device.closeTag();
284  }
285  // Close tag
286  device.closeTag();
287 }
288 
289 
290 void
292  myCalibratorVehicleTypes.push_back(vehicleType);
293 }
294 
295 
296 void
298  myCalibratorFlows.push_back(flow);
299 }
300 
301 
302 void
304  myCalibratorRoutes.push_back(route);
305 }
306 
307 
308 const std::vector<GNECalibratorVehicleType>&
311 }
312 
313 
314 const std::vector<GNECalibratorFlow>&
316  return myCalibratorFlows;
317 }
318 
319 
320 const std::vector<GNECalibratorRoute>&
322  return myCalibratorRoutes;
323 }
324 
325 
326 void
327 GNECalibrator::setCalibratorVehicleTypes(const std::vector<GNECalibratorVehicleType>& calibratorVehicleTypes) {
328  myCalibratorVehicleTypes = calibratorVehicleTypes;
329 }
330 
331 
332 void
333 GNECalibrator::setCalibratorFlows(const std::vector<GNECalibratorFlow>& calibratorFlows) {
334  myCalibratorFlows = calibratorFlows;
335 }
336 
337 
338 void
339 GNECalibrator::setCalibratorRoutes(const std::vector<GNECalibratorRoute>& calibratorRoutes) {
340  myCalibratorRoutes = calibratorRoutes;
341 }
342 
343 
344 std::string
346  int counter = 0;
348  counter++;
349  }
350  return (toString(SUMO_TAG_VTYPE) + toString(counter));
351 }
352 
353 
354 std::string
356  int counter = 0;
357  while (myViewNet->getNet()->flowExists(toString(SUMO_TAG_FLOW) + toString(counter))) {
358  counter++;
359  }
360  return (toString(SUMO_TAG_FLOW) + toString(counter));
361 }
362 
363 
364 std::string
366  int counter = 0;
367  while (myViewNet->getNet()->routeExists(toString(SUMO_TAG_ROUTE) + toString(counter))) {
368  counter++;
369  }
370  return (toString(SUMO_TAG_ROUTE) + toString(counter));
371 }
372 
373 
374 bool
375 GNECalibrator::vehicleTypeExists(std::string vehicleTypeID) const {
376  for (std::vector<GNECalibratorVehicleType>::const_iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); i++) {
377  if (i->getVehicleTypeID() == vehicleTypeID) {
378  return true;
379  }
380  }
381  return false;
382 }
383 
384 
385 bool
386 GNECalibrator::flowExists(std::string flowID) const {
387  for (std::vector<GNECalibratorFlow>::const_iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); i++) {
388  if (i->getFlowID() == flowID) {
389  return true;
390  }
391  }
392  return false;
393 }
394 
395 
396 bool
397 GNECalibrator::routeExists(std::string routeID) const {
398  for (std::vector<GNECalibratorRoute>::const_iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); i++) {
399  if (i->getRouteID() == routeID) {
400  return true;
401  }
402  }
403  return false;
404 }
405 
406 
408 GNECalibrator::getCalibratorVehicleType(const std::string& vehicleTypeID) {
409  for (std::vector<GNECalibratorVehicleType>::iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); i++) {
410  if (i->getVehicleTypeID() == vehicleTypeID) {
411  return (*i);
412  }
413  }
414  throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_VTYPE) + " with id = '" + vehicleTypeID + "'");
415 }
416 
417 
418 const GNECalibratorFlow&
419 GNECalibrator::getCalibratorFlow(const std::string& flowID) {
420  for (std::vector<GNECalibratorFlow>::iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); i++) {
421  if (i->getFlowID() == flowID) {
422  return (*i);
423  }
424  }
425  throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_FLOW) + " with id = '" + flowID + "'");
426 }
427 
428 
429 const GNECalibratorRoute&
430 GNECalibrator::getCalibratorRoute(const std::string& routeID) {
431  for (std::vector<GNECalibratorRoute>::iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); i++) {
432  if (i->getRouteID() == routeID) {
433  return (*i);
434  }
435  }
436  throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_ROUTE) + " with id = '" + routeID + "'");
437 }
438 
439 const std::string&
441  return myLane->getMicrosimID();
442 }
443 
444 
445 void
447  // get values
448  glPushName(getGlID());
449  glLineWidth(1.0);
450  const double exaggeration = s.addSize.getExaggeration(s);
451 
452  for (int i = 0; i < (int)myShape.size(); ++i) {
453  const Position& pos = myShape[i];
454  double rot = myShapeRotations[i];
455  glPushMatrix();
456  glTranslated(pos.x(), pos.y(), getType());
457  glRotated(rot, 0, 0, 1);
458  glTranslated(0, 0, getType());
459  glScaled(exaggeration, exaggeration, 1);
460  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
461 
462  if (isAdditionalSelected()) {
464  } else {
465  GLHelper::setColor(RGBColor(255, 204, 0));
466  }
467  // base
468  glBegin(GL_TRIANGLES);
469  glVertex2d(0 - 1.4, 0);
470  glVertex2d(0 - 1.4, 6);
471  glVertex2d(0 + 1.4, 6);
472  glVertex2d(0 + 1.4, 0);
473  glVertex2d(0 - 1.4, 0);
474  glVertex2d(0 + 1.4, 6);
475  glEnd();
476 
477  // draw text
478  if (s.scale * exaggeration >= 1.) {
479  GLHelper::setColor(RGBColor(0, 0, 0));
480  glTranslated(0, 0, .1);
481  pfSetPosition(0, 0);
482  pfSetScale(3.f);
483  double w = pfdkGetStringWidth("C");
484  glRotated(180, 0, 1, 0);
485  glTranslated(-w / 2., 2, 0);
486  pfDrawString("C");
487  glTranslated(w / 2., -2, 0);
488  }
489  glPopMatrix();
490  }
491  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
492  glPopName();
493 }
494 
495 
496 std::string
498  switch (key) {
499  case SUMO_ATTR_ID:
500  return getAdditionalID();
501  case SUMO_ATTR_LANE:
502  return toString(myLane->getID());
503  case SUMO_ATTR_POSITION:
505  case SUMO_ATTR_FREQUENCY:
506  return toString(myFrequency);
507  case SUMO_ATTR_OUTPUT:
508  return myOutput;
510  if (myRouteProbe) {
511  return myRouteProbe->getID();
512  } else {
513  return "";
514  }
515  default:
516  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
517  }
518 }
519 
520 
521 void
522 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
523  if (value == getAttribute(key)) {
524  return; //avoid needless changes, later logic relies on the fact that attributes have changed
525  }
526  switch (key) {
527  case SUMO_ATTR_ID:
528  case SUMO_ATTR_LANE:
529  case SUMO_ATTR_POSITION:
530  case SUMO_ATTR_FREQUENCY:
531  case SUMO_ATTR_OUTPUT:
533  undoList->p_add(new GNEChange_Attribute(this, key, value));
534  updateGeometry();
535  break;
536  default:
537  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
538  }
539 
540 }
541 
542 
543 bool
544 GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
545  switch (key) {
546  case SUMO_ATTR_ID:
547  if (isValidID(value) && (myViewNet->getNet()->getAdditional(getTag(), value) == NULL)) {
548  return true;
549  } else {
550  return false;
551  }
552  case SUMO_ATTR_LANE:
553  if (myViewNet->getNet()->retrieveLane(value, false) != NULL) {
554  return true;
555  } else {
556  return false;
557  }
558  case SUMO_ATTR_POSITION:
559  if (canParse<double>(value)) {
560  // obtain relative new start position
561  double newStartPos = parse<double>(value) / myLane->getLaneParametricLength();
562  if ((newStartPos < 0) || (newStartPos > 1)) {
563  return false;
564  } else {
565  return true;
566  }
567  }
568  case SUMO_ATTR_FREQUENCY:
569  return (canParse<double>(value) && parse<double>(value) >= 0);
570  case SUMO_ATTR_OUTPUT:
571  return isValidFilename(value);
573  if (myViewNet->getNet()->getAdditional(SUMO_TAG_ROUTEPROBE, value) != NULL) {
574  return true;
575  } else {
576  return false;
577  }
578  default:
579  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
580  }
581 }
582 
583 // ===========================================================================
584 // private
585 // ===========================================================================
586 
587 void
588 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
589  switch (key) {
590  case SUMO_ATTR_ID:
591  setAdditionalID(value);
592  break;
593  case SUMO_ATTR_LANE:
594  changeLane(value);
595  break;
596  case SUMO_ATTR_POSITION:
597  myPositionOverLane = parse<double>(value) / myLane->getShape().length();
598  updateGeometry();
599  getViewNet()->update();
600  break;
601  case SUMO_ATTR_FREQUENCY:
602  myFrequency = parse<double>(value);
603  break;
604  case SUMO_ATTR_OUTPUT:
605  myOutput = value;
606  break;
609  break;
610  default:
611  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
612  }
613 }
614 
615 
616 /****************************************************************************/
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:261
int pfDrawString(const char *c)
Definition: polyfonts.c:1074
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
const std::vector< GNECalibratorRoute > & getCalibratorRoutes() const
get calibrator routes
a routeprobe detector
double scale
information about a lane&#39;s width (temporary, used for a single view)
bool flowExists(std::string flowID) const
check if a flow with ID = flowID exists
description of a vehicle type
void addCalibratorRoute(const GNECalibratorRoute &route)
add calibrator route
bool flowExists(const std::string &flowID) const
Check if exist a flow with these ID.
Definition: GNENet.cpp:1792
is a pedestrian
GUIVisualizationTextSettings addName
GNECalibrator(const std::string &id, GNELane *lane, GNEViewNet *viewNet, double pos, double frequency, const std::string &output, const std::vector< GNECalibratorRoute > &calibratorRoutes, const std::vector< GNECalibratorFlow > &calibratorFlows, const std::vector< GNECalibratorVehicleType > &calibratorVehicleTypes)
Constructor.
const std::vector< GNECalibratorVehicleType > & getCalibratorVehicleTypes() const
get calibrator vehicleTypes
void pfSetScale(double s)
Definition: polyfonts.c:465
a flow definition (used by router)
void addCalibratorFlow(const GNECalibratorFlow &flow)
add calibrator flow
double x() const
Returns the x-position.
Definition: Position.h:63
GNELane * myLane
The lane this additional belongs.
Stores the information about how to visualize structures.
bool vehicleTypeExists(const std::string &vehicleTypeID) const
Check if exist a vehicle type with these ID.
Definition: GNENet.cpp:1779
bool isAdditionalSelected() const
~GNECalibrator()
Destructor.
std::vector< GNECalibratorFlow > myCalibratorFlows
calibrator flow values
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
weights: time range begin
void moveGeometry(const Position &newPosition)
change the position of the element geometry without saving in undoList
bool routeExists(const std::string &routeID) const
Check if exist a route with these ID.
Definition: GNENet.cpp:1766
GNERouteProbe * myRouteProbe
pointer to current RouteProbe
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
bool routeExists(std::string routeID) const
check if a route with ID = routeID exists
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void pfSetPosition(double x, double y)
Definition: polyfonts.c:480
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
bool vehicleTypeExists(std::string vehicleTypeID) const
check if a vehicelType with ID = vehicleTypeID exists
static bool isValidFilename(const std::string &value)
true if value is a valid file value
std::vector< double > myShapeRotations
GUIGlID getGlID() const
Returns the numerical id of the object.
begin/end of the description of a route
void undo()
undo the last command group
void openAdditionalDialog()
open Calibrator Dialog
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
void writeAdditional(OutputDevice &device, bool volatileOptionsEnabled) const
writte additional element into a xml file
GNEUndoList * getUndoList() const
get the undoList object
std::string generateRouteID() const
generate a route ID
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
static bool isValidID(const std::string &value)
true if value is a valid sumo ID
GUIVisualizationSizeSettings addSize
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static const RGBColor selectedAdditionalColor
color of selected additionals
Definition: GNENet.h:112
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
std::string myOutput
output of calibrator
const GNECalibratorRoute & getCalibratorRoute(const std::string &routeID)
get reference calibrator route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:438
bool myMovable
boolean to check if additional element is movable (with the mouse). By default true ...
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1085
const std::string & getAdditionalID() const
returns the ID of additional
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void refreshAdditional(GNEAdditional *additional)
refreshes boundary information of an additional after a geometry update
Definition: GNENet.cpp:998
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in allGNEAttributeCarrier.
PositionVector myShape
The shape of the additional element.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
Definition: GNENet.cpp:958
void setCalibratorVehicleTypes(const std::vector< GNECalibratorVehicleType > &calibratorVehicleType)
set calibrator vehicleTypes values
friend class GNEChange_Attribute
declare friend class
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
double y() const
Returns the y-position.
Definition: Position.h:68
double length() const
Returns the length.
std::vector< double > myShapeLengths
The lengths of the shape parts.
const GNECalibratorVehicleType & getCalibratorVehicleType(const std::string &vehicleTypeID)
get reference to calibrator vehicle type
edge: the shape in xml-definition
void setAdditionalID(const std::string &id)
set the ID of additional
const std::string getID() const
function to support debugging
void changeLane(const std::string &laneID)
change lane of additional
void setCalibratorRoutes(const std::vector< GNECalibratorRoute > &calibratorRoutes)
set calibrator route values
void addCalibratorVehicleType(const GNECalibratorVehicleType &vehicleType)
add calibrator vehicleType
Dialog for edit calibrators.
double myPositionOverLane
position over Lane
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1680
const std::vector< GNECalibratorFlow > & getCalibratorFlows() const
get calibrator flows
std::string generateFlowID() const
generate a flow ID
double pfdkGetStringWidth(const char *c)
Definition: polyfonts.c:1113
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:625
const std::vector< GNELane * > & getLanes()
returns a reference to the lane vector
Definition: GNEEdge.cpp:599
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
weights: time range end
GNENet * getNet() const
get the net object
void setCalibratorFlows(const std::vector< GNECalibratorFlow > &calibratorFlows)
set calibrator flow values
std::vector< GNECalibratorVehicleType > myCalibratorVehicleTypes
calibrator vehicleType values
std::string generateVehicleTypeID() const
generate a vehicleType ID
void commitGeometryMoving(const Position &oldPos, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
SumoXMLTag getTag() const
get XML Tag assigned to this object
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
bool closeTag()
Closes the most recently opened tag.
double myFrequency
Frequency of calibrator.
void updateGeometry()
update pre-computed geometry information
const GNECalibratorFlow & getCalibratorFlow(const std::string &flowID)
get reference to calibrator flow
const std::string & getParentName() const
Returns the name of the parent object (if any)
std::vector< GNECalibratorRoute > myCalibratorRoutes
calibrator route values
double getLaneParametricLength() const
returns the parameteric length of the lane
Definition: GNELane.cpp:719
A color information.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
void duplicateLane(GNELane *lane, GNEUndoList *undoList)
duplicates lane
Definition: GNENet.cpp:544
Position getPositionInView() const
Returns position of additional in view.