SUMO - Simulation of Urban MObility
GNECalibrator.cpp
Go to the documentation of this file.
1 /****************************************************************************/
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  myFrequency(frequency),
70  myOutput(output),
71  myRouteProbe(NULL),
72  myCalibratorRoutes(calibratorRoutes),
73  myCalibratorFlows(calibratorFlows),
74  myCalibratorVehicleTypes(calibratorVehicleTypes) {
75  // This additional belong to a lane
76  myLane = lane;
77  // this additional ISN'T movable
78  myMovable = false;
79  // Update geometry;
81  // Set Colors
82  myBaseColor = RGBColor(255, 255, 50, 0);
83  myBaseColorSelected = RGBColor(255, 255, 125, 255);
84  // Center view in the position of calibrator
85  myViewNet->centerTo(getGlID(), false);
86 }
87 
88 
90 
91 
92 void
94  // This additional cannot be moved
95 }
96 
97 
98 void
100  // This additional cannot be moved
101 }
102 
103 
104 void
106  // Clear all containers
107  myShapeRotations.clear();
108  myShapeLengths.clear();
109  // clear Shape
110  myShape.clear();
111 
112  // Get shape of lane parent
114 
115  // Obtain first position
116  Position f = myShape[0] - Position(1, 0);
117 
118  // Obtain next position
119  Position s = myShape[0] + Position(1, 0);
120 
121  // Save rotation (angle) of the vector constructed by points f and s
123 
124  // Refresh element (neccesary to avoid grabbing problems)
126 }
127 
128 
129 Position
131  return myPosition;
132 }
133 
134 void
136  // Open calibrator dialog
137  GNECalibratorDialog calibratorDialog(this);
138 }
139 
140 
141 void
143  // Write parameters
144  device.openTag(getTag());
145  device.writeAttr(SUMO_ATTR_ID, getID());
146  device.writeAttr(SUMO_ATTR_LANE, myLane->getID());
150  // write all routes of this calibrator
151  for (std::vector<GNECalibratorRoute>::const_iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); ++i) {
152  // Open route tag
153  device.openTag(i->getTag());
154  // Write route ID
155  device.writeAttr(SUMO_ATTR_BEGIN, i->getRouteID());
156  // Write edge IDs
157  device.writeAttr(SUMO_ATTR_BEGIN, i->getEdgesIDs());
158  // Write Color
159  device.writeAttr(SUMO_ATTR_BEGIN, i->getColor());
160  // Close flow tag
161  device.closeTag();
162  }
163  // write all vehicle types of this calibrator
164  for (std::vector<GNECalibratorVehicleType>::const_iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); ++i) {
165  // Open vehicle type tag
166  device.openTag(i->getTag());
167  // write id
168  device.writeAttr(SUMO_ATTR_ID, i->getVehicleTypeID());
169  //write accel
170  device.writeAttr(SUMO_ATTR_ACCEL, i->getAccel());
171  // write decel
172  device.writeAttr(SUMO_ATTR_DECEL, i->getDecel());
173  // write sigma
174  device.writeAttr(SUMO_ATTR_SIGMA, i->getSigma());
175  // write tau
176  device.writeAttr(SUMO_ATTR_TAU, i->getTau());
177  // write lenght
178  device.writeAttr(SUMO_ATTR_LENGTH, i->getLength());
179  // write min gap
180  device.writeAttr(SUMO_ATTR_MINGAP, i->getMinGap());
181  // write max speed
182  device.writeAttr(SUMO_ATTR_MAXSPEED, i->getMaxSpeed());
183  // write speed factor
184  device.writeAttr(SUMO_ATTR_SPEEDFACTOR, i->getSpeedFactor());
185  // write speed dev
186  device.writeAttr(SUMO_ATTR_SPEEDDEV, i->getSpeedDev());
187  // write color
188  device.writeAttr(SUMO_ATTR_COLOR, i->getColor());
189  // write vehicle class
190  device.writeAttr(SUMO_ATTR_VCLASS, i->getVClass());
191  // write emission class
192  device.writeAttr(SUMO_ATTR_EMISSIONCLASS, i->getEmissionClass());
193  // write shape
194  device.writeAttr(SUMO_ATTR_SHAPE, i->getShape());
195  // write width
196  device.writeAttr(SUMO_ATTR_WIDTH, i->getWidth());
197  // write filename
198  device.writeAttr(SUMO_ATTR_FILE, i->getFilename());
199  // write impatience
200  device.writeAttr(SUMO_ATTR_IMPATIENCE, i->getImpatience());
201  // write lane change model
202  device.writeAttr(SUMO_ATTR_LANE_CHANGE_MODEL, i->getLaneChangeModel());
203  // write car follow model
204  device.writeAttr(SUMO_ATTR_CAR_FOLLOW_MODEL, i->getCarFollowModel());
205  // write person capacity
206  device.writeAttr(SUMO_ATTR_PERSON_CAPACITY, i->getPersonCapacity());
207  // write container capacity
208  device.writeAttr(SUMO_ATTR_CONTAINER_CAPACITY, i->getContainerCapacity());
209  // write boarding duration
210  device.writeAttr(SUMO_ATTR_BOARDING_DURATION, i->getBoardingDuration());
211  // write loading duration
212  device.writeAttr(SUMO_ATTR_LOADING_DURATION, i->getLoadingDuration());
213  // write get lat alignment
214  device.writeAttr(SUMO_ATTR_LATALIGNMENT, i->getLatAlignment());
215  // write min gap lat
216  device.writeAttr(SUMO_ATTR_MINGAP_LAT, i->getMinGapLat());
217  // write max speed lat
218  device.writeAttr(SUMO_ATTR_MAXSPEED_LAT, i->getMaxSpeedLat());
219  // Close vehicle type tag
220  device.closeTag();
221  }
222  // Write all flows of this calibrator
223  for (std::vector<GNECalibratorFlow>::const_iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); ++i) {
224  // Open flow tag
225  device.openTag(i->getTag());
226  // Write begin
227  device.writeAttr(SUMO_ATTR_BEGIN, i->getBegin());
228  // Write end
229  device.writeAttr(SUMO_ATTR_END, i->getEnd());
230  // Write type
231  device.writeAttr(SUMO_ATTR_TYPE, i->getVehicleType());
232  // Write route
233  device.writeAttr(SUMO_ATTR_ROUTE, i->getRoute());
234  // Write color
235  device.writeAttr(SUMO_ATTR_COLOR, i->getColor());
236  // Write depart lane
237  device.writeAttr(SUMO_ATTR_DEPARTLANE, i->getDepartLane());
238  // Write depart pos
239  device.writeAttr(SUMO_ATTR_DEPARTPOS, i->getDepartPos());
240  // Write depart speed
241  device.writeAttr(SUMO_ATTR_DEPARTSPEED, i->getDepartSpeed());
242  // Write arrival lane
243  device.writeAttr(SUMO_ATTR_ARRIVALLANE, i->getArrivalLane());
244  // Write arrival pos
245  device.writeAttr(SUMO_ATTR_ARRIVALPOS, i->getArrivalPos());
246  // Write arrival speed
247  device.writeAttr(SUMO_ATTR_ARRIVALSPEED, i->getArrivalSpeed());
248  // Write line
249  device.writeAttr(SUMO_ATTR_LINE, i->getLine());
250  // Write person number
251  device.writeAttr(SUMO_ATTR_PERSON_NUMBER, i->getPersonNumber());
252  // Write container number
253  device.writeAttr(SUMO_ATTR_CONTAINER_NUMBER, i->getContainerNumber());
254  // Write reroute
255  device.writeAttr(SUMO_ATTR_REROUTE, i->getReroute());
256  // Write departPosLat
257  device.writeAttr(SUMO_ATTR_DEPARTPOS_LAT, i->getDepartPosLat());
258  // Write arrivalPosLat
259  device.writeAttr(SUMO_ATTR_ARRIVALPOS_LAT, i->getArrivalPosLat());
260  // Write number
261  device.writeAttr(SUMO_ATTR_NUMBER, i->getNumber());
262  // Write type of flow
263  if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PERIOD) {
264  // write period
265  device.writeAttr(SUMO_ATTR_PERIOD, i->getPeriod());
266  } else if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_VEHSPERHOUR) {
267  // write vehs per hour
268  device.writeAttr(SUMO_ATTR_VEHSPERHOUR, i->getVehsPerHour());
269  } else if (i->getFlowType() == GNECalibratorFlow::GNE_CALIBRATORFLOW_PROBABILITY) {
270  // write probability
271  device.writeAttr(SUMO_ATTR_PROB, i->getProbability());
272  }
273  // Close flow tag
274  device.closeTag();
275  }
276  // Close tag
277  device.closeTag();
278 }
279 
280 
281 void
283  myCalibratorVehicleTypes.push_back(vehicleType);
284 }
285 
286 
287 void
289  myCalibratorFlows.push_back(flow);
290 }
291 
292 
293 void
295  myCalibratorRoutes.push_back(route);
296 }
297 
298 
299 const std::vector<GNECalibratorVehicleType>&
302 }
303 
304 
305 const std::vector<GNECalibratorFlow>&
307  return myCalibratorFlows;
308 }
309 
310 
311 const std::vector<GNECalibratorRoute>&
313  return myCalibratorRoutes;
314 }
315 
316 
317 void
318 GNECalibrator::setCalibratorVehicleTypes(const std::vector<GNECalibratorVehicleType>& calibratorVehicleTypes) {
319  myCalibratorVehicleTypes = calibratorVehicleTypes;
320 }
321 
322 
323 void
324 GNECalibrator::setCalibratorFlows(const std::vector<GNECalibratorFlow>& calibratorFlows) {
325  myCalibratorFlows = calibratorFlows;
326 }
327 
328 
329 void
330 GNECalibrator::setCalibratorRoutes(const std::vector<GNECalibratorRoute>& calibratorRoutes) {
331  myCalibratorRoutes = calibratorRoutes;
332 }
333 
334 
335 std::string
337  int counter = 0;
338  while (myViewNet->getNet()->vehicleTypeExists(toString(SUMO_TAG_VTYPE) + toString(counter)) == true) {
339  counter++;
340  }
341  return (toString(SUMO_TAG_VTYPE) + toString(counter));
342 }
343 
344 
345 std::string
347  int counter = 0;
348  while (myViewNet->getNet()->flowExists(toString(SUMO_TAG_FLOW) + toString(counter)) == true) {
349  counter++;
350  }
351  return (toString(SUMO_TAG_FLOW) + toString(counter));
352 }
353 
354 
355 std::string
357  int counter = 0;
358  while (myViewNet->getNet()->routeExists(toString(SUMO_TAG_ROUTE) + toString(counter)) == true) {
359  counter++;
360  }
361  return (toString(SUMO_TAG_ROUTE) + toString(counter));
362 }
363 
364 
365 bool
366 GNECalibrator::vehicleTypeExists(std::string vehicleTypeID) const {
367  for (std::vector<GNECalibratorVehicleType>::const_iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); i++) {
368  if (i->getVehicleTypeID() == vehicleTypeID) {
369  return true;
370  }
371  }
372  return false;
373 }
374 
375 
376 bool
377 GNECalibrator::flowExists(std::string flowID) const {
378  for (std::vector<GNECalibratorFlow>::const_iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); i++) {
379  if (i->getFlowID() == flowID) {
380  return true;
381  }
382  }
383  return false;
384 }
385 
386 
387 bool
388 GNECalibrator::routeExists(std::string routeID) const {
389  for (std::vector<GNECalibratorRoute>::const_iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); i++) {
390  if (i->getRouteID() == routeID) {
391  return true;
392  }
393  }
394  return false;
395 }
396 
397 
399 GNECalibrator::getCalibratorVehicleType(const std::string& vehicleTypeID) {
400  for (std::vector<GNECalibratorVehicleType>::iterator i = myCalibratorVehicleTypes.begin(); i != myCalibratorVehicleTypes.end(); i++) {
401  if (i->getVehicleTypeID() == vehicleTypeID) {
402  return (*i);
403  }
404  }
405  throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_VTYPE) + " with id = '" + vehicleTypeID + "'");
406 }
407 
408 
409 const GNECalibratorFlow&
410 GNECalibrator::getCalibratorFlow(const std::string& flowID) {
411  for (std::vector<GNECalibratorFlow>::iterator i = myCalibratorFlows.begin(); i != myCalibratorFlows.end(); i++) {
412  if (i->getFlowID() == flowID) {
413  return (*i);
414  }
415  }
416  throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_FLOW) + " with id = '" + flowID + "'");
417 }
418 
419 
420 const GNECalibratorRoute&
421 GNECalibrator::getCalibratorRoute(const std::string& routeID) {
422  for (std::vector<GNECalibratorRoute>::iterator i = myCalibratorRoutes.begin(); i != myCalibratorRoutes.end(); i++) {
423  if (i->getRouteID() == routeID) {
424  return (*i);
425  }
426  }
427  throw InvalidArgument(toString(getTag()) + " " + getID() + " doesn't have a " + toString(SUMO_TAG_ROUTE) + " with id = '" + routeID + "'");
428 }
429 
430 const std::string&
432  return myLane->getMicrosimID();
433 }
434 
435 
436 void
438  // get values
439  glPushName(getGlID());
440  glLineWidth(1.0);
441  const double exaggeration = s.addSize.getExaggeration(s);
442 
443  for (int i = 0; i < (int)myShape.size(); ++i) {
444  const Position& pos = myShape[i];
445  double rot = myShapeRotations[i];
446  glPushMatrix();
447  glTranslated(pos.x(), pos.y(), getType());
448  glRotated(rot, 0, 0, 1);
449  glTranslated(0, 0, getType());
450  glScaled(exaggeration, exaggeration, 1);
451  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
452 
453  glBegin(GL_TRIANGLES);
454  glColor3d(1, .8f, 0);
455  // base
456  glVertex2d(0 - 1.4, 0);
457  glVertex2d(0 - 1.4, 6);
458  glVertex2d(0 + 1.4, 6);
459  glVertex2d(0 + 1.4, 0);
460  glVertex2d(0 - 1.4, 0);
461  glVertex2d(0 + 1.4, 6);
462  glEnd();
463 
464  // draw text
465  if (s.scale * exaggeration >= 1.) {
466  glTranslated(0, 0, .1);
467  glColor3d(0, 0, 0);
468  pfSetPosition(0, 0);
469  pfSetScale(3.f);
470  double w = pfdkGetStringWidth("C");
471  glRotated(180, 0, 1, 0);
472  glTranslated(-w / 2., 2, 0);
473  pfDrawString("C");
474  glTranslated(w / 2., -2, 0);
475  }
476  glPopMatrix();
477  }
478  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
479  glPopName();
480 }
481 
482 
483 std::string
485  switch (key) {
486  case SUMO_ATTR_ID:
487  return getAdditionalID();
488  case SUMO_ATTR_LANE:
489  return toString(myLane->getID());
490  case SUMO_ATTR_POSITION:
491  return toString(myPosition.x());
492  case SUMO_ATTR_FREQUENCY:
493  return toString(myFrequency);
494  case SUMO_ATTR_OUTPUT:
495  return myOutput;
497  if (myRouteProbe) {
498  return myRouteProbe->getID();
499  } else {
500  return "";
501  }
502  default:
503  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
504  }
505 }
506 
507 
508 void
509 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
510  if (value == getAttribute(key)) {
511  return; //avoid needless changes, later logic relies on the fact that attributes have changed
512  }
513  switch (key) {
514  case SUMO_ATTR_ID:
515  case SUMO_ATTR_LANE:
516  case SUMO_ATTR_POSITION:
517  case SUMO_ATTR_FREQUENCY:
518  case SUMO_ATTR_OUTPUT:
520  undoList->p_add(new GNEChange_Attribute(this, key, value));
521  updateGeometry();
522  break;
523  default:
524  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
525  }
526 
527 }
528 
529 
530 bool
531 GNECalibrator::isValid(SumoXMLAttr key, const std::string& value) {
532  switch (key) {
533  case SUMO_ATTR_ID:
534  if (myViewNet->getNet()->getAdditional(getTag(), value) == NULL) {
535  return true;
536  } else {
537  return false;
538  }
539  case SUMO_ATTR_LANE:
540  if (myViewNet->getNet()->retrieveLane(value, false) != NULL) {
541  return true;
542  } else {
543  return false;
544  }
545  case SUMO_ATTR_POSITION:
546  case SUMO_ATTR_FREQUENCY:
547  return (canParse<double>(value) && parse<double>(value) >= 0);
548  case SUMO_ATTR_OUTPUT:
549  return isValidFilename(value);
551  if (myViewNet->getNet()->getAdditional(SUMO_TAG_ROUTEPROBE, value) != NULL) {
552  return true;
553  } else {
554  return false;
555  }
556  default:
557  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
558  }
559 }
560 
561 // ===========================================================================
562 // private
563 // ===========================================================================
564 
565 void
566 GNECalibrator::setAttribute(SumoXMLAttr key, const std::string& value) {
567  switch (key) {
568  case SUMO_ATTR_ID:
569  setAdditionalID(value);
570  break;
571  case SUMO_ATTR_LANE:
572  changeLane(value);
573  break;
574  case SUMO_ATTR_POSITION:
575  myPosition = Position(parse<double>(value), 0);
576  updateGeometry();
577  getViewNet()->update();
578  break;
579  case SUMO_ATTR_FREQUENCY:
580  myFrequency = parse<double>(value);
581  break;
582  case SUMO_ATTR_OUTPUT:
583  myOutput = value;
584  break;
587  break;
588  default:
589  throw InvalidArgument(toString(getTag()) + " doesn't have an attribute of type '" + toString(key) + "'");
590  }
591 }
592 
593 
594 /****************************************************************************/
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:256
int pfDrawString(const char *c)
Definition: polyfonts.c:1074
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
a routeprobe detector
double scale
information about a lane&#39;s width (temporary, used for a single view)
const std::vector< GNECalibratorFlow > & getCalibratorFlows() const
get calibrator flows
description of a vehicle type
void addCalibratorRoute(const GNECalibratorRoute &route)
add calibrator route
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.
bool routeExists(const std::string &routeID) const
Check if exist a route with these ID.
Definition: GNENet.cpp:1417
void pfSetScale(double s)
Definition: polyfonts.c:465
a flow definition (used by router)
const std::string & getAdditionalID() const
returns the ID of additional
void addCalibratorFlow(const GNECalibratorFlow &flow)
add calibrator flow
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
Definition: GNENet.cpp:1331
GNELane * myLane
The lane this additional belongs.
Stores the information about how to visualize structures.
double y() const
Returns the y-position.
Definition: Position.h:68
std::string getAttribute(SumoXMLAttr key) const
bool vehicleTypeExists(const std::string &vehicleTypeID) const
Check if exist a vehicle type with these ID.
Definition: GNENet.cpp:1430
double getPositionRelativeToParametricLength(double position) const
Definition: GNELane.cpp:727
~GNECalibrator()
Destructor.
std::vector< GNECalibratorFlow > myCalibratorFlows
calibrator flow values
double x() const
Returns the x-position.
Definition: Position.h:63
Position getPositionInView() const
Returns position of Calibrator in view.
weights: time range begin
GNERouteProbe * myRouteProbe
pointer to current RouteProbe
std::string generateVehicleTypeID() const
generate a vehicleType ID
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
bool vehicleTypeExists(std::string vehicleTypeID) const
check if a vehicelType with ID = vehicleTypeID exists
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void pfSetPosition(double x, double y)
Definition: polyfonts.c:480
const std::vector< GNECalibratorRoute > & getCalibratorRoutes() const
get calibrator routes
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
static bool isValidFilename(const std::string &value)
true if value is a valid file value
std::vector< double > myShapeRotations
bool routeExists(std::string routeID) const
check if a route with ID = routeID exists
void commmitAdditionalGeometryMoved(double, double, GNEUndoList *)
updated geometry changes in the attributes of additional
begin/end of the description of a route
void openAdditionalDialog()
open Calibrator Dialog
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
RGBColor myBaseColorSelected
base color selected (Default blue)
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GUIVisualizationSizeSettings addSize
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
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
bool myMovable
boolean to check if additional element is movable (with the mouse). By default true ...
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:825
PositionVector myShape
The shape of the additional element.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
Definition: GNENet.cpp:785
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
std::vector< double > myShapeLengths
The lengths of the shape parts.
void writeAdditional(OutputDevice &device) const
writte additional element into a xml file
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
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
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
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
std::string generateFlowID() const
generate a flow ID
const std::string & getParentName() const
Returns the name of the parent object (if any)
Dialog for edit calibrators.
double pfdkGetStringWidth(const char *c)
Definition: polyfonts.c:1113
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
const PositionVector & getShape() const
returns the shape of the lane
Definition: GNELane.cpp:621
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:62
weights: time range end
RGBColor myBaseColor
base color (Default green)
bool flowExists(std::string flowID) const
check if a flow with ID = flowID exists
const std::vector< GNECalibratorVehicleType > & getCalibratorVehicleTypes() const
get calibrator vehicleTypes
void setCalibratorFlows(const std::vector< GNECalibratorFlow > &calibratorFlows)
set calibrator flow values
std::vector< GNECalibratorVehicleType > myCalibratorVehicleTypes
calibrator vehicleType values
GNENet * getNet() const
get the net object
bool flowExists(const std::string &flowID) const
Check if exist a flow with these ID.
Definition: GNENet.cpp:1443
GUIGlID getGlID() const
Returns the numerical id of the object.
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
Position myPosition
The position in which this additional element is located.
bool closeTag()
Closes the most recently opened tag.
double myFrequency
Frequency of calibrator.
void updateGeometry()
update pre-computed geometry information
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string generateRouteID() const
generate a route ID
const GNECalibratorFlow & getCalibratorFlow(const std::string &flowID)
get reference to calibrator flow
std::vector< GNECalibratorRoute > myCalibratorRoutes
calibrator route values
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
A color information.
void moveAdditionalGeometry(double, double)
change the position of the calibrator geometry
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
SumoXMLTag getTag() const
get XML Tag assigned to this object