SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GNEAdditionalHandler.h
Go to the documentation of this file.
1 /****************************************************************************/
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
10 // Copyright (C) 2001-2013 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 #ifndef GNEAdditionalHandler_h
21 #define GNEAdditionalHandler_h
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <vector>
37 #include <utils/geom/Position.h>
38 
39 #include "GNECalibrator.h"
40 #include "GNERerouter.h"
41 #include "GNEVariableSpeedSignal.h"
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
46 
47 class GNENet;
48 class GNEViewNet;
49 class GNEUndoList;
50 class GNEJunction;
51 class GNEEdge;
52 class GNELane;
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
57 
61 public:
63  GNEAdditionalHandler(const std::string& file, GNEViewNet* viewNet);
64 
67 
70 
76  void myStartElement(int element, const SUMOSAXAttributes& attrs);
78 
84 
89  void parseAndBuildVaporizer(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
90 
96  void parseAndBuildVariableSpeedSignal(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
97 
102  void parseAndBuildRerouter(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
103 
108  void parseAndBuildBusStop(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
109 
114  void parseAndBuildContainerStop(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
115 
120  void parseAndBuildChargingStation(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
121 
126  void parseAndBuildCalibrator(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
127 
132  void parseAndBuildDetectorE1(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
133 
138  void parseAndBuildDetectorE2(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
139 
144  void parseAndBuildDetectorE3(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
145 
150  void parseAndBuildDetectorEntry(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
151 
156  void parseAndBuildDetectorExit(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
157 
162  void parseAndBuildRouteProbe(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
163 
168  void parseCalibratorFlow(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
169 
174  void parseVariableSpeedSignalStep(const SUMOSAXAttributes& attrs, const SumoXMLTag& tag);
176 
181 
187  static bool buildAdditional(GNEViewNet* viewNet, SumoXMLTag tag, std::map<SumoXMLAttr, std::string> values);
188 
200  static bool buildBusStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, const std::vector<std::string>& lines, bool blocked);
201 
213  static bool buildContainerStop(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, const std::vector<std::string>& lines, bool blocked);
214 
229  static bool buildChargingStation(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal startPos, SUMOReal endPos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, SUMOReal chargeDelay, bool blocked);
230 
243  static bool buildDetectorE1(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, int freq, const std::string& filename, bool splitByType, bool blocked);
244 
261  static bool buildDetectorE2(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, SUMOReal length, SUMOReal freq, const std::string& filename,
262  bool cont, int timeThreshold, SUMOReal speedThreshold, SUMOReal jamThreshold, bool blocked);
263 
276  static bool buildDetectorE3(GNEViewNet* viewNet, const std::string& id, Position pos, int freq, const std::string& filename, SUMOTime timeThreshold, SUMOReal speedThreshold, bool blocked);
277 
288  static bool buildDetectorEntry(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked);
289 
300  static bool buildDetectorExit(GNEViewNet* viewNet, const std::string& id, GNELane* lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked);
301 
315  static bool buildCalibrator(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, SUMOReal pos, const std::string& outfile, const SUMOTime freq, const std::map<std::string, GNECalibrator::CalibratorFlow>& flowValues, bool blocked);
316 
328  static bool buildRerouter(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector<GNEEdge*>& edges, SUMOReal prob, const std::string& file, bool off, const std::set<GNERerouter::rerouterInterval>& rerouterIntervals, bool blocked);
329 
341  static bool buildRouteProbe(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, int freq, const std::string& file, int begin, bool blocked);
342 
353  static bool buildVariableSpeedSignal(GNEViewNet* viewNet, const std::string& id, Position pos, const std::vector<GNELane*>& destLanes, const std::string& file, const std::map<SUMOTime, SUMOReal>& VSSValues, bool blocked);
354 
365  static bool buildVaporizer(GNEViewNet* viewNet, const std::string& id, GNEEdge* edge, SUMOTime startTime, SUMOTime end, bool blocked);
366 
373  std::string getFileName(const SUMOSAXAttributes& attrs, const std::string& base, const bool allowEmpty = false);
374 
383  SUMOReal getPosition(const SUMOSAXAttributes& attrs, GNELane& lane, const std::string& tt, const std::string& tid);
384 
393  bool checkStopPos(SUMOReal& startPos, SUMOReal& endPos, const SUMOReal laneLength, const SUMOReal minLength, const bool friendlyPos);
394 
395 protected:
398 
401 
404 };
405 
406 
407 #endif
SumoXMLTag
Numbers representing SUMO-XML - element names.
void parseCalibratorFlow(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses flow values of Calibrators.
long long int SUMOTime
Definition: SUMOTime.h:43
static bool buildContainerStop(GNEViewNet *viewNet, const std::string &id, GNELane *lane, SUMOReal startPos, SUMOReal endPos, const std::vector< std::string > &lines, bool blocked)
Builds a container stop.
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;.
static bool buildChargingStation(GNEViewNet *viewNet, const std::string &id, GNELane *lane, SUMOReal startPos, SUMOReal endPos, SUMOReal chargingPower, SUMOReal efficiency, bool chargeInTransit, SUMOReal chargeDelay, bool blocked)
Builds a charging Station.
void parseAndBuildChargingStation(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a charging station.
GNEAdditionalHandler(const std::string &file, GNEViewNet *viewNet)
Constructor.
static bool buildVariableSpeedSignal(GNEViewNet *viewNet, const std::string &id, Position pos, const std::vector< GNELane * > &destLanes, const std::string &file, const std::map< SUMOTime, SUMOReal > &VSSValues, bool blocked)
Builds a VariableSpeedSignal (lane speed trigger)
static bool buildAdditional(GNEViewNet *viewNet, SumoXMLTag tag, std::map< SumoXMLAttr, std::string > values)
Builds additional / additionalSet.
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:87
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:55
static bool buildRerouter(GNEViewNet *viewNet, const std::string &id, Position pos, const std::vector< GNEEdge * > &edges, SUMOReal prob, const std::string &file, bool off, const std::set< GNERerouter::rerouterInterval > &rerouterIntervals, bool blocked)
builds a rerouter
void parseAndBuildVariableSpeedSignal(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Variable Speed Signal (lane speed trigger)
SAX-handler base for SUMO-files.
static bool buildVaporizer(GNEViewNet *viewNet, const std::string &id, GNEEdge *edge, SUMOTime startTime, SUMOTime end, bool blocked)
Builds a vaporizer (lane speed trigger)
Builds trigger objects for GNENet (busStops, chargingStations, detectors, etc..)
void parseAndBuildDetectorE2(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a lane area detector (E2)
static bool buildDetectorE3(GNEViewNet *viewNet, const std::string &id, Position pos, int freq, const std::string &filename, SUMOTime timeThreshold, SUMOReal speedThreshold, bool blocked)
Builds a multi entry exit detector (E3)
bool checkStopPos(SUMOReal &startPos, SUMOReal &endPos, const SUMOReal laneLength, const SUMOReal minLength, const bool friendlyPos)
check if the position of an stoppingPlace over a lane is valid
void parseVariableSpeedSignalStep(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses step values of VariableSpeedSignals.
GNERerouter::rerouterInterval * rerouterIntervalToInsertValues
rerouterInterval in whicn insert closingReroute, destProbReroute, etc.
~GNEAdditionalHandler()
Destructor.
const std::string & getFileName() const
returns the current file name
static bool buildCalibrator(GNEViewNet *viewNet, const std::string &id, GNEEdge *edge, SUMOReal pos, const std::string &outfile, const SUMOTime freq, const std::map< std::string, GNECalibrator::CalibratorFlow > &flowValues, bool blocked)
builds a microscopic calibrator
Encapsulated SAX-Attributes.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
static bool buildRouteProbe(GNEViewNet *viewNet, const std::string &id, GNEEdge *edge, int freq, const std::string &file, int begin, bool blocked)
builds a Route probe
void parseAndBuildRerouter(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a rerouter.
GNEViewNet * myViewNet
pointer to View's Net
static bool buildBusStop(GNEViewNet *viewNet, const std::string &id, GNELane *lane, SUMOReal startPos, SUMOReal endPos, const std::vector< std::string > &lines, bool blocked)
Builds a bus stop.
void parseAndBuildDetectorE3(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a multi entry exit detector (E3)
std::string myAdditionalSetParent
Id of the last inserted GNEAdditionalSet.
void parseAndBuildRouteProbe(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds routeProbe.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:55
static bool buildDetectorE2(GNEViewNet *viewNet, const std::string &id, GNELane *lane, SUMOReal pos, SUMOReal length, SUMOReal freq, const std::string &filename, bool cont, int timeThreshold, SUMOReal speedThreshold, SUMOReal jamThreshold, bool blocked)
Builds a lane Area Detector (E2)
void parseAndBuildCalibrator(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a mesoscopic or microscopic calibrator.
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.
static bool buildDetectorExit(GNEViewNet *viewNet, const std::string &id, GNELane *lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked)
Builds a exit detector (E3)
void parseAndBuildVaporizer(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Builds a vaporization.
SUMOReal getPosition(const SUMOSAXAttributes &attrs, GNELane &lane, const std::string &tt, const std::string &tid)
extracts the position, checks whether it shall be mirrored and checks whether it is within the lane...
#define SUMOReal
Definition: config.h:214
static bool buildDetectorEntry(GNEViewNet *viewNet, const std::string &id, GNELane *lane, SUMOReal pos, std::string idDetectorE3Parent, bool blocked)
Builds a entry detector (E3)
static bool buildDetectorE1(GNEViewNet *viewNet, const std::string &id, GNELane *lane, SUMOReal pos, int freq, const std::string &filename, bool splitByType, bool blocked)
Builds a induction loop detector (E1)
void parseAndBuildDetectorEntry(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Entry detector.