51 #ifdef CHECK_MEMORY_LEAKS 63 rerouterIntervalToInsertValues(NULL) {
135 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
142 const std::string edgeId = attrs.
get<std::string>(
SUMO_ATTR_EDGE,
id.c_str(), ok,
false);
168 WRITE_WARNING(
"The edge '" + edgeId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
183 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
190 const std::string edgeId = attrs.
get<std::string>(
SUMO_ATTR_EDGE,
id.c_str(), ok,
false);
204 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
218 WRITE_WARNING(
"The edge '" + edgeId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
234 std::string flowId = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
273 if (calibratorToInsertFlow == NULL) {
276 calibratorToInsertFlow->
insertFlow(flowId, flow);
302 if (variableSpeedSignalToInsertStep == NULL) {
304 }
else if (!variableSpeedSignalToInsertStep->
insertStep(time, speed)) {
316 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
323 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
330 const std::string listOfLanes = attrs.
get<std::string>(
SUMO_ATTR_LANES,
id.c_str(), ok,
false);
342 std::vector<std::string> lanesID;
346 std::map<SUMOTime, SUMOReal> VSSValues;
348 std::vector<GNELane*> lanes;
349 for (
int i = 0; i < (int)lanesID.size(); i++) {
352 lanes.push_back(lane);
370 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
377 const std::string edgesAttribute = attrs.
get<std::string>(
SUMO_ATTR_EDGES,
id.c_str(), ok,
false);
392 std::vector<std::string> edgesID;
396 std::set<GNERerouter::rerouterInterval> rerouterIntervals;
398 std::vector<GNEEdge*> edges;
399 for (
int i = 0; i < (int)edgesID.size(); i++) {
402 edges.push_back(edge);
420 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
427 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
448 const std::string linesAttribute = attrs.
getOpt<std::string>(
SUMO_ATTR_LINES,
id.c_str(), ok,
"",
false);
453 std::vector<std::string> lines;
459 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
476 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
483 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
504 const std::string linesAttribute = attrs.
getOpt<std::string>(
SUMO_ATTR_LINES,
id.c_str(), ok,
"",
false);
509 std::vector<std::string> lines;
515 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
531 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
538 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
570 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
585 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
592 const std::string laneID = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
616 WRITE_WARNING(
"The lane '" + laneID +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
618 if (
buildCalibrator(
myViewNet,
id, edge, position, outfile, freq, std::map<std::string, GNECalibrator::CalibratorFlow>(),
false)) {
632 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
639 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
660 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
674 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
688 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
695 const std::string laneId = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok,
false);
716 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
741 WRITE_WARNING(
"The lane '" + laneId +
"' to use within the " +
toString(tag) +
" '" +
id +
"' is not known.");
744 buildDetectorE2(
myViewNet,
id, lane, position, length, frequency, file, cont, haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold,
false);
755 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID, 0, ok,
false);
769 const std::string file = attrs.
get<std::string>(
SUMO_ATTR_FILE,
id.c_str(), ok,
false);
878 std::vector<std::string> lines;
882 return buildBusStop(viewNet,
id, lane, startPos, endPos, lines, blocked);
892 std::vector<std::string> lines;
912 return buildChargingStation(viewNet,
id, lane, startPos, endPos, chargingPower, efficiency, chargeInTransit, chargeDelay, blocked);
926 return buildDetectorE1(viewNet,
id, lane, pos, freq, filename, splitByType, blocked);
938 bool cont = GNEAttributeCarrier::parse<bool>(values[
SUMO_ATTR_CONT]);
944 return buildDetectorE2(viewNet,
id, lane, pos, lenght, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold, blocked);
958 if (pos.size() == 1) {
959 return buildDetectorE3(viewNet,
id, pos[0], freq, filename, timeThreshold, speedThreshold, blocked);
970 if (lane && !detectorE3ParentID.empty()) {
982 if (lane && !detectorE3ParentID.empty()) {
993 std::vector<std::string> laneIds;
996 std::map<SUMOTime, SUMOReal> VSSValues;
998 std::vector<GNELane*> lanes;
999 for (
int i = 0; i < (int)laneIds.size(); i++) {
1003 if (pos.size() == 1) {
1018 std::map<std::string, GNECalibrator::CalibratorFlow> flowValues;
1021 return buildCalibrator(viewNet,
id, edge, pos, outfile, freq, flowValues, blocked);
1031 std::vector<std::string> edgeIds;
1034 bool off = GNEAttributeCarrier::parse<bool>(values[
SUMO_ATTR_OFF]);
1038 std::vector<GNEEdge*> edges;
1039 for (
int i = 0; i < (int)edgeIds.size(); i++) {
1043 std::set<GNERerouter::rerouterInterval> rerouterIntervals;
1045 if (pos.size() == 1) {
1046 return buildRerouter(viewNet,
id, pos[0], edges, prob, file, off, rerouterIntervals, blocked);
1059 return buildRouteProbe(viewNet,
id, edge, freq, filename, begin, blocked);
1068 int end = GNEAttributeCarrier::parse<int>(values[
SUMO_ATTR_END]);
1071 return buildVaporizer(viewNet,
id, edge, startTime, end, blocked);
1143 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) {
1146 GNEDetectorE2* detectorE2 =
new GNEDetectorE2(
id, lane, viewNet, pos, length, freq, filename, cont, timeThreshold, speedThreshold, jamThreshold, blocked);
1177 if (detectorE3Parent == NULL) {
1199 if (detectorE3Parent == NULL) {
1235 GNERerouter* rerouter =
new GNERerouter(
id, viewNet, pos, edges, file, prob, off, rerouterIntervals, blocked);
1325 WRITE_WARNING(
"The position of " + tt +
" '" + tid +
"' lies beyond the lane's '" + lane.
getID() +
"' length.");
1334 if (minLength > laneLength) {
1338 startPos += laneLength;
1341 endPos += laneLength;
1343 if (endPos < minLength || endPos > laneLength) {
1347 if (endPos < minLength) {
1350 if (endPos > laneLength) {
1351 endPos = laneLength;
1354 if (startPos < 0 || startPos > endPos - minLength) {
1361 if (startPos > endPos - minLength) {
1362 startPos = endPos - minLength;
SumoXMLTag
Numbers representing SUMO-XML - element names.
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)
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.
GNEAdditional * getAdditional(SumoXMLTag type, const std::string &id) const
Returns the named additional.
const std::string & getFileName() const
returns the current file name
GNEAdditionalHandler(const std::string &file, GNEViewNet *viewNet)
Constructor.
void insertFlow(const std::string &id, const CalibratorFlow &flow)
insert a new flow
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...
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)
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
#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
void parseVariableSpeedSignalStep(const SUMOSAXAttributes &attrs, const SumoXMLTag &tag)
Parses step values of VariableSpeedSignals.
GNEUndoList * getUndoList() const
get the undoList object
static void parseStringVector(const std::string &def, std::vector< std::string > &into)
Splits the given string.
~GNEAdditionalHandler()
Destructor.
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
SUMOReal getLaneShapeLenght() const
returns the length of the lane's shape
GNEEdge & getParentEdge()
Returns underlying parent edge.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
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.
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.
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)
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 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
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.