SUMO - Simulation of Urban MObility
GNEAdditionalHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // Builds trigger objects for netedit
18 /****************************************************************************/
19 #ifndef GNEAdditionalHandler_h
20 #define GNEAdditionalHandler_h
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <vector>
35 #include <utils/geom/Position.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 
44 class GNENet;
45 class GNEViewNet;
46 class GNEUndoList;
47 class GNEJunction;
48 class GNEEdge;
49 class GNELane;
50 class GNEDetectorE3;
51 class GNECalibrator;
54 class GNERerouter;
55 class GNECalibratorRoute;
57 
58 
59 // ===========================================================================
60 // class definitions
61 // ===========================================================================
62 
66 public:
68  GNEAdditionalHandler(const std::string& file, GNEViewNet* viewNet, bool undoAdditionals = true);
69 
72 
75 
81  void myStartElement(int element, const SUMOSAXAttributes& attrs);
83 
89 
94  void parseAndBuildVaporizer(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
95 
101  void parseAndBuildVariableSpeedSign(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
102 
108  void parseAndBuildVariableSpeedSignStep(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
109 
114  void parseAndBuildRerouter(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
115 
120  void parseAndBuildRerouterInterval(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
121 
127 
133 
139 
145 
150  void parseAndBuildBusStop(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
151 
156  void parseAndBuildContainerStop(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
157 
162  void parseAndBuildChargingStation(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
163 
168  void parseAndBuildCalibrator(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
169 
174  void parseAndBuildDetectorE1(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
175 
180  void parseAndBuildDetectorE2(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
181 
186  void parseAndBuildDetectorE3(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
187 
192  void parseAndBuildDetectorEntry(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
193 
198  void parseAndBuildDetectorExit(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
199 
204  void parseAndBuildRouteProbe(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
205 
210  void parseAndBuildCalibratorRoute(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
211 
216  void parseAndBuildCalibratorVehicleType(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
217 
222  void parseAndBuildCalibratorFlow(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
223 
225 
230 
237  static bool buildAdditional(GNEViewNet* viewNet, bool allowUndoRedo, SumoXMLTag tag, std::map<SumoXMLAttr, std::string> values);
238 
252  static bool buildBusStop(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double startPos, double endPos, const std::string& name, const std::vector<std::string>& lines, bool friendlyPosition);
253 
267  static bool buildContainerStop(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double startPos, double endPos, const std::string& name, const std::vector<std::string>& lines, bool friendlyPosition);
268 
285  static bool buildChargingStation(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double startPos, double endPos, const std::string& name, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay, bool friendlyPosition);
286 
300  static bool buildDetectorE1(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, double freq, const std::string& filename, const std::string& vehicleTypes, bool friendlyPos);
301 
319  static bool buildDetectorE2(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, double length, double freq, const std::string& filename,
320  bool cont, const double timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos);
321 
334  static bool buildDetectorE3(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, double freq, const std::string& filename, const double timeThreshold, double speedThreshold);
335 
346  static bool buildDetectorEntry(GNEViewNet* viewNet, bool allowUndoRedo, GNEDetectorE3* E3Parent, GNELane* lane, double pos, bool friendlyPos);
347 
358  static bool buildDetectorExit(GNEViewNet* viewNet, bool allowUndoRedo, GNEDetectorE3* E3Parent, GNELane* lane, double pos, bool friendlyPos);
359 
372  static bool buildCalibrator(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNELane* lane, double pos, const std::string& outfile, double freq);
373 
386  static bool buildCalibrator(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNEEdge* edge, double pos, const std::string& outfile, double freq);
387 
391  static bool buildCalibratorRoute(GNEViewNet* viewNet, bool allowUndoRedo, GNECalibrator* calibratorParent, const std::string& routeID, const std::vector<GNEEdge*>& edges, const RGBColor& color);
392 
396  static bool buildCalibratorVehicleType(GNEViewNet* viewNet, bool allowUndoRedo, GNECalibrator* calibratorParent, std::string vehicleTypeID,
397  double accel, double decel, double sigma, double tau, double length, double minGap, double maxSpeed,
398  double speedFactor, double speedDev, const RGBColor& color, SUMOVehicleClass vClass, const std::string& emissionClass,
399  SUMOVehicleShape shape, double width, const std::string& filename, double impatience, const std::string& laneChangeModel,
400  const std::string& carFollowModel, int personCapacity, int containerCapacity, double boardingDuration,
401  double loadingDuration, const std::string& latAlignment, double minGapLat, double maxSpeedLat);
402 
406  static bool buildCalibratorFlow(GNEViewNet* viewNet, bool allowUndoRedo, GNECalibrator* calibratorParent, const std::string& flowID, GNECalibratorRoute* route,
407  GNECalibratorVehicleType* vtype, const RGBColor& color, const std::string& departLane, const std::string& departPos,
408  const std::string& departSpeed, const std::string& arrivalLane, const std::string& arrivalPos, const std::string& arrivalSpeed,
409  const std::string& line, int personNumber, int containerNumber, bool reroute, const std::string& departPosLat,
410  const std::string& arrivalPosLat, double begin, double end, double vehsPerHour, double period, double probability, int number, int flowType);
411 
422  static bool buildRerouter(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, const std::vector<GNEEdge*>& edges, double prob, const std::string& file, bool off, double timeThreshold);
423 
432  static bool buildRerouterInterval(GNEViewNet* viewNet, bool allowUndoRedo, GNERerouter* rerouterParent, double begin, double end);
433 
437  static bool buildClosingLaneReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNERerouterInterval* rerouterIntervalParent, GNELane* closedLane, SVCPermissions allowedVehicles, SVCPermissions disallowedVehicles);
438 
442  static bool buildClosingReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNERerouterInterval* rerouterIntervalParent, GNEEdge* closedEdge, SVCPermissions allowedVehicles, SVCPermissions disallowedVehicles);
443 
447  static bool builDestProbReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNERerouterInterval* rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability);
448 
452  static bool buildRouteProbReroute(GNEViewNet* viewNet, bool allowUndoRedo, GNERerouterInterval* rerouterIntervalParent, const std::string& newRouteId, double probability);
453 
465  static bool buildRouteProbe(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, GNEEdge* edge, double freq, const std::string& file, double begin);
466 
476  static bool buildVariableSpeedSign(GNEViewNet* viewNet, bool allowUndoRedo, const std::string& id, Position pos, const std::vector<GNELane*>& destLanes, const std::string& file);
477 
487  static bool buildVariableSpeedSignStep(GNEViewNet* viewNet, bool allowUndoRedo, GNEVariableSpeedSign* VSSParent, double time, double speed);
488 
498  static bool buildVaporizer(GNEViewNet* viewNet, bool allowUndoRedo, GNEEdge* edge, double startTime, double end);
499 
506  std::string getFileName(const SUMOSAXAttributes& attrs, const std::string& base, const bool allowEmpty = false);
507 
515  double getPosition(double pos, GNELane& lane, bool friendlyPos, const std::string& additionalID);
516 
525  static bool fixStoppinPlacePosition(double& startPos, double& endPos, const double laneLength, const double minLength, const bool friendlyPos);
526 
533  static bool checkAndFixDetectorPositionPosition(double& pos, const double laneLength, const bool friendlyPos);
534 
542  static bool fixE2DetectorPositionPosition(double& pos, double& length, const double laneLength, const bool friendlyPos);
543 
544 protected:
547 
550 
553 
554 private:
556  int getTypeOfFlowDistribution(std::string flowID, double vehsPerHour, double period, double probability);
557 };
558 
559 
560 #endif
SumoXMLTag
Numbers representing SUMO-XML - element names.
int getTypeOfFlowDistribution(std::string flowID, double vehsPerHour, double period, double probability)
get a error message, if configuration of flow distribution is invalid
void parseAndBuildRerouterRouteProbReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Route Prob Reroute.
void parseAndBuildDetectorE1(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a induction loop detector (E1)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static bool buildVariableSpeedSign(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, Position pos, const std::vector< GNELane *> &destLanes, const std::string &file)
Builds a VariableSpeedSign (lane speed trigger)
void parseAndBuildChargingStation(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a charging station.
const std::string & getFileName() const
returns the current file name
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
static bool builDestProbReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNERerouterInterval *rerouterIntervalParent, GNEEdge *newEdgeDestination, double probability)
bool myUndoAdditionals
flag to check if created additionals must be undo and redo
static bool buildAdditional(GNEViewNet *viewNet, bool allowUndoRedo, SumoXMLTag tag, std::map< SumoXMLAttr, std::string > values)
Build additionals.
static bool checkAndFixDetectorPositionPosition(double &pos, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
static bool buildClosingLaneReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNERerouterInterval *rerouterIntervalParent, GNELane *closedLane, SVCPermissions allowedVehicles, SVCPermissions disallowedVehicles)
void parseAndBuildDetectorExit(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Exit detector.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:91
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:53
static bool buildClosingReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNERerouterInterval *rerouterIntervalParent, GNEEdge *closedEdge, SVCPermissions allowedVehicles, SVCPermissions disallowedVehicles)
static bool buildVaporizer(GNEViewNet *viewNet, bool allowUndoRedo, GNEEdge *edge, double startTime, double end)
Builds a vaporizer (lane speed trigger)
SAX-handler base for SUMO-files.
double getPosition(double pos, GNELane &lane, bool friendlyPos, const std::string &additionalID)
extracts the position, checks whether it shall be mirrored and checks whether it is within the lane...
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
static bool buildDetectorEntry(GNEViewNet *viewNet, bool allowUndoRedo, GNEDetectorE3 *E3Parent, GNELane *lane, double pos, bool friendlyPos)
Builds a entry detector (E3)
void parseAndBuildVariableSpeedSign(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Variable Speed Signal (lane speed trigger)
void parseAndBuildDetectorE2(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a lane area detector (E2)
~GNEAdditionalHandler()
Destructor.
void parseAndBuildCalibratorVehicleType(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses vehicle type values of Calibrators.
static bool buildRouteProbReroute(GNEViewNet *viewNet, bool allowUndoRedo, GNERerouterInterval *rerouterIntervalParent, const std::string &newRouteId, double probability)
void parseAndBuildRerouterInterval(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Rerouter Interval.
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
static bool buildRouteProbe(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNEEdge *edge, double freq, const std::string &file, double begin)
builds a Route probe
GNEAdditionalHandler(const std::string &file, GNEViewNet *viewNet, bool undoAdditionals=true)
Constructor.
void parseAndBuildRerouter(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a rerouter.
void parseAndBuildCalibratorRoute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses route values of Calibrators.
static bool buildCalibratorRoute(GNEViewNet *viewNet, bool allowUndoRedo, GNECalibrator *calibratorParent, const std::string &routeID, const std::vector< GNEEdge *> &edges, const RGBColor &color)
std::string myLastInsertedAdditionalParent
ID of last inserted Additional parent (needed for additionasl that own a child)
static bool buildCalibratorVehicleType(GNEViewNet *viewNet, bool allowUndoRedo, GNECalibrator *calibratorParent, std::string vehicleTypeID, double accel, double decel, double sigma, double tau, double length, double minGap, double maxSpeed, double speedFactor, double speedDev, const RGBColor &color, SUMOVehicleClass vClass, const std::string &emissionClass, SUMOVehicleShape shape, double width, const std::string &filename, double impatience, const std::string &laneChangeModel, const std::string &carFollowModel, int personCapacity, int containerCapacity, double boardingDuration, double loadingDuration, const std::string &latAlignment, double minGapLat, double maxSpeedLat)
static bool buildDetectorE2(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double pos, double length, double freq, const std::string &filename, bool cont, const double timeThreshold, double speedThreshold, double jamThreshold, bool friendlyPos)
Builds a lane Area Detector (E2)
static bool buildChargingStation(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double startPos, double endPos, const std::string &name, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay, bool friendlyPosition)
Builds a charging Station.
GNEViewNet * myViewNet
pointer to View&#39;s Net
void parseAndBuildDetectorE3(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a multi entry exit detector (E3)
static bool buildCalibrator(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double pos, const std::string &outfile, double freq)
builds a microscopic calibrator over a lane
void parseAndBuildRouteProbe(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds routeProbe.
static bool buildVariableSpeedSignStep(GNEViewNet *viewNet, bool allowUndoRedo, GNEVariableSpeedSign *VSSParent, double time, double speed)
Builds a VariableSpeedSign Step.
void parseAndBuildRerouterDestProbReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Destiny Prob Reroute.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:56
void parseAndBuildCalibrator(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a mesoscopic or microscopic calibrator.
void parseAndBuildVariableSpeedSignStep(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Variable Speed Signal Step.
static bool buildContainerStop(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double startPos, double endPos, const std::string &name, const std::vector< std::string > &lines, bool friendlyPosition)
Builds a container stop.
void parseAndBuildBusStop(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a bus stop.
void parseAndBuildContainerStop(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a container stop.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
static bool fixE2DetectorPositionPosition(double &pos, double &length, const double laneLength, const bool friendlyPos)
check if the position of a detector over a lane is valid
void parseAndBuildCalibratorFlow(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses flow values of Calibrators.
void parseAndBuildVaporizer(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Builds a vaporization.
static bool buildRerouter(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, Position pos, const std::vector< GNEEdge *> &edges, double prob, const std::string &file, bool off, double timeThreshold)
builds a rerouter
void parseAndBuildRerouterClosingLaneReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Closing Lane reroute.
static bool buildDetectorE3(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, Position pos, double freq, const std::string &filename, const double timeThreshold, double speedThreshold)
Builds a multi entry exit detector (E3)
static bool buildBusStop(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double startPos, double endPos, const std::string &name, const std::vector< std::string > &lines, bool friendlyPosition)
Builds a bus stop.
static bool fixStoppinPlacePosition(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check if the position of an stoppingPlace over a lane is valid
void parseAndBuildDetectorEntry(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Entry detector.
static bool buildDetectorExit(GNEViewNet *viewNet, bool allowUndoRedo, GNEDetectorE3 *E3Parent, GNELane *lane, double pos, bool friendlyPos)
Builds a exit detector (E3)
static bool buildCalibratorFlow(GNEViewNet *viewNet, bool allowUndoRedo, GNECalibrator *calibratorParent, const std::string &flowID, GNECalibratorRoute *route, GNECalibratorVehicleType *vtype, const RGBColor &color, const std::string &departLane, const std::string &departPos, const std::string &departSpeed, const std::string &arrivalLane, const std::string &arrivalPos, const std::string &arrivalSpeed, const std::string &line, int personNumber, int containerNumber, bool reroute, const std::string &departPosLat, const std::string &arrivalPosLat, double begin, double end, double vehsPerHour, double period, double probability, int number, int flowType)
static bool buildDetectorE1(GNEViewNet *viewNet, bool allowUndoRedo, const std::string &id, GNELane *lane, double pos, double freq, const std::string &filename, const std::string &vehicleTypes, bool friendlyPos)
Builds a induction loop detector (E1)
static bool buildRerouterInterval(GNEViewNet *viewNet, bool allowUndoRedo, GNERerouter *rerouterParent, double begin, double end)
builds a rerouter interval
void parseAndBuildRerouterClosingReroute(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Closing Reroute.