51 #ifdef CHECK_MEMORY_LEAKS 63 rerouterIntervalToInsertValues(NULL) {
134 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
140 const std::string edgeId = attrs.
get<std::string>(
SUMO_ATTR_EDGE,
id.c_str(), ok,
false);
163 WRITE_WARNING(
"The edge '" + edgeId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
177 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
183 const std::string edgeId = attrs.
get<std::string>(
SUMO_ATTR_EDGE,
id.c_str(), ok,
false);
195 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
208 WRITE_WARNING(
"The edge '" + edgeId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
223 std::string flowId = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
259 if (calibratorToInsertFlow == NULL) {
262 calibratorToInsertFlow->
insertFlow(flowId, flow);
285 if (variableSpeedSignalToInsertStep == NULL) {
287 }
else if (!variableSpeedSignalToInsertStep->
insertStep(time, speed)) {
298 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
304 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
310 const std::string listOfLanes = attrs.
get<std::string>(
SUMO_ATTR_LANES,
id.c_str(), ok,
false);
321 std::vector<std::string> lanesID;
325 std::map<SUMOTime, SUMOReal> VSSValues;
327 std::vector<GNELane*> lanes;
328 for (
int i = 0; i < (int)lanesID.size(); i++) {
331 lanes.push_back(lane);
348 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
354 const std::string edgesAttribute = attrs.
get<std::string>(
SUMO_ATTR_EDGES,
id.c_str(), ok,
false);
368 std::vector<std::string> edgesID;
372 std::set<GNERerouter::rerouterInterval> rerouterIntervals;
374 std::vector<GNEEdge*> edges;
375 for (
int i = 0; i < (int)edgesID.size(); i++) {
378 edges.push_back(edge);
395 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
401 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
419 const std::string linesAttribute = attrs.
getOpt<std::string>(
SUMO_ATTR_LINES,
id.c_str(), ok,
"",
false);
424 std::vector<std::string> lines;
430 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
446 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
452 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
470 const std::string linesAttribute = attrs.
getOpt<std::string>(
SUMO_ATTR_LINES,
id.c_str(), ok,
"",
false);
475 std::vector<std::string> lines;
481 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
496 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
502 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
531 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
545 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
551 const std::string laneID = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
573 WRITE_WARNING(
"The lane '" + laneID +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
575 if (
buildCalibrator(
myViewNet,
id, edge, position, outfile, freq, std::map<std::string, GNECalibrator::CalibratorFlow>(),
false)) {
588 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
594 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
612 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
625 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
638 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
644 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
662 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
685 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
688 buildDetectorE2(
myViewNet,
id, lane, position, length, frequency, file, cont, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold,
false);
698 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
710 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
812 std::vector<std::string> lines;
816 return buildBusStop(viewNet,
id, lane, startPos, endPos, lines, blocked);
826 std::vector<std::string> lines;
846 return buildChargingStation(viewNet,
id, lane, startPos, endPos, chargingPower, efficiency, chargeInTransit, chargeDelay, blocked);
860 return buildDetectorE1(viewNet,
id, lane, pos, freq, filename, splitByType, blocked);
872 bool cont = GNEAttributeCarrier::parse<bool>(values[
SUMO_ATTR_CONT]);
878 return buildDetectorE2(viewNet,
id, lane, pos, lenght, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold, blocked);
892 if (pos.size() == 1) {
893 return buildDetectorE3(viewNet,
id, pos[0], freq, filename, timeThreshold, speedThreshold, blocked);
904 if (lane && !detectorE3ParentID.empty()) {
916 if (lane && !detectorE3ParentID.empty()) {
927 std::vector<std::string> laneIds;
930 std::map<SUMOTime, SUMOReal> VSSValues;
932 std::vector<GNELane*> lanes;
933 for (
int i = 0; i < (int)laneIds.size(); i++) {
937 if (pos.size() == 1) {
952 std::map<std::string, GNECalibrator::CalibratorFlow> flowValues;
955 return buildCalibrator(viewNet,
id, edge, pos, outfile, freq, flowValues, blocked);
965 std::vector<std::string> edgeIds;
968 bool off = GNEAttributeCarrier::parse<bool>(values[
SUMO_ATTR_OFF]);
972 std::vector<GNEEdge*> edges;
973 for (
int i = 0; i < (int)edgeIds.size(); i++) {
977 std::set<GNERerouter::rerouterInterval> rerouterIntervals;
979 if (pos.size() == 1) {
980 return buildRerouter(viewNet,
id, pos[0], edges, prob, file, off, rerouterIntervals, blocked);
993 return buildRouteProbe(viewNet,
id, edge, freq, filename, begin, blocked);
1002 int end = GNEAttributeCarrier::parse<int>(values[
SUMO_ATTR_END]);
1005 return buildVaporizer(viewNet,
id, edge, startTime, end, blocked);
1077 GNEAdditionalHandler::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) {
1080 GNEDetectorE2* detectorE2 =
new GNEDetectorE2(
id, lane, viewNet, pos, length, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold, blocked);
1111 if (detectorE3Parent == NULL) {
1133 if (detectorE3Parent == NULL) {
1169 GNERerouter* rerouter =
new GNERerouter(
id, viewNet, pos, edges, file, prob, off, rerouterIntervals, blocked);
1259 WRITE_WARNING(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane.
getID() +
"' length.");
1268 if (minLength > laneLength) {
1272 startPos += laneLength;
1275 endPos += laneLength;
1277 if (endPos < minLength || endPos > laneLength) {
1281 if (endPos < minLength) {
1284 if (endPos > laneLength) {
1285 endPos = laneLength;
1288 if (startPos < 0 || startPos > endPos - minLength) {
1295 if (startPos > endPos - minLength) {
1296 startPos = endPos - minLength;
SumoXMLTag
Numbers representing SUMO-XML - element names.
void parseCalibratorFlow(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses flow values of Calibrators.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
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.
static std::string getConfigurationRelative(const std::string &configPath, const std::string &path)
Returns the second path as a relative path to the first file.
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.
void insertFlow(const std::string &id, const CalibratorFlow &flow)
insert a new flow
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.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
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...
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)
#define WRITE_WARNING(msg)
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
GNEUndoList * getUndoList() const
get the undoList object
SUMOTime getOptSUMOTimeReporting(int attr, const char *objectid, bool &ok, SUMOTime defaultValue, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
void parseVariableSpeedSignalStep(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses step values of VariableSpeedSignals.
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
~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
GNEEdge & getParentEdge()
Returns underlying parent edge.
Encapsulated SAX-Attributes.
static bool isAbsolute(const std::string &path)
Returns the information whether the given path is absolute.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
A point in 2D or 3D with translation and scaling methods.
GNELane * retrieveLane(const std::string &id, bool failHard=true)
get lane by id
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.
A lane area vehicles can halt at (netedit-version)
const std::string getID() const
function to support debugging
GNEViewNet * myViewNet
pointer to View's Net
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
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)
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.
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
SUMOReal getLaneShapeLenght() const
returns the length of the lane's shape
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...
GNENet * getNet() const
get the net object
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
A lane area vehicles can halt at (netedit-version)
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)
Information whether the detector shall be continued on the folowing lanes.
bool insertStep(const SUMOTime time, const SUMOReal speed)
insert a new step in variable speed signal
void parseAndBuildDetectorEntry(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses his values and builds a Entry detector.
static PositionVector parseShapeReporting(const std::string &shpdef, const std::string &objecttype, const char *objectid, bool &ok, bool allowEmpty, bool report=true)
Builds a PositionVector from a string representation, reporting occured errors.