60 #ifdef CHECK_MEMORY_LEAKS 62 #endif // CHECK_MEMORY_LEAKS 74 myNet(net), myActionBuilder(net),
75 myCurrentIsInternalToSkip(false),
76 myDetectorBuilder(detBuilder), myTriggerBuilder(triggerBuilder),
77 myEdgeControlBuilder(edgeBuilder), myJunctionControlBuilder(junctionBuilder),
78 myAmInTLLogicMode(false), myCurrentIsBroken(false),
79 myHaveWarnedAboutDeprecatedLanes(false),
80 myLastParameterised(0),
81 myHaveSeenInternalEdge(false),
269 if (edge != 0 && from != 0 && to != 0) {
322 WRITE_ERROR(
"Edge '" +
id +
"' has an invalid type.");
402 if (shape.size() < 2) {
403 WRITE_ERROR(
"Shape of lane '" +
id +
"' is broken.\n Can not build according edge.");
408 if (permissions !=
SVCAll) {
418 WRITE_ERROR(
"Another lane with the id '" +
id +
"' exists.");
444 if (shape.size() > 2) {
453 WRITE_ERROR(
"An unknown or invalid junction type occured in junction '" +
id +
"'.");
458 std::vector<MSLane*> incomingLanes;
461 std::vector<MSLane*> internalLanes;
462 #ifdef HAVE_INTERNAL_LANES 473 WRITE_ERROR(e.what() + std::string(
"\n Can not build according junction."));
482 const std::string& def, std::vector<MSLane*>& into,
bool& ok) {
485 std::string laneID = st.
next();
491 WRITE_ERROR(
"An unknown lane ('" + laneID +
"') was tried to be set as incoming to junction '" + junctionID +
"'.");
495 into.push_back(lane);
592 #ifdef HAVE_INTERNAL_LANES 601 if (request >= 0 && response.length() > 0) {
640 WRITE_ERROR(
"Traffic light '" +
id +
"' has unknown type '" + typeS +
"'");
698 friendlyPos, splitByType);
780 const std::string lsaid = attrs.
getOpt<std::string>(
SUMO_ATTR_TLID,
id.c_str(), ok,
"<invalid>");
781 const std::string toLane = attrs.
getOpt<std::string>(
SUMO_ATTR_TO,
id.c_str(), ok,
"<invalid>");
795 if (lsaid !=
"<invalid>") {
796 if (toLane ==
"<invalid>") {
800 haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold,
806 haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold,
817 haltingTimeThreshold, haltingSpeedThreshold, jamDistThreshold,
842 frequency, haltingSpeedThreshold, haltingTimeThreshold);
888 const std::string type = attrs.
getOpt<std::string>(
SUMO_ATTR_TYPE,
id.c_str(), ok,
"performance");
900 excludeEmpty[0] !=
't' && excludeEmpty[0] !=
'T' && excludeEmpty[0] !=
'1' && excludeEmpty[0] !=
'x',
901 excludeEmpty ==
"defaults", withInternal, trackVehicles,
902 maxTravelTime, minSamples, haltingSpeedThreshold, vtypes,
929 #ifdef HAVE_INTERNAL_LANES 935 WRITE_ERROR(
"Unknown from-edge '" + fromID +
"' in connection");
940 WRITE_ERROR(
"Unknown to-edge '" + toID +
"' in connection");
943 if (fromLaneIdx < 0 || static_cast<unsigned int>(fromLaneIdx) >= from->getLanes().size() ||
944 toLaneIdx < 0 || static_cast<unsigned int>(toLaneIdx) >= to->
getLanes().size()) {
945 WRITE_ERROR(
"Invalid lane index in connection from '" + from->getID() +
"' to '" + to->
getID() +
"'.");
948 MSLane* fromLane = from->getLanes()[fromLaneIdx];
958 if ((tlLinkIdx < 0 || tlLinkIdx >= (
int)logic->getCurrentPhaseDef().getState().size())
959 && logic->getLogicType() !=
"railSignal") {
961 "' in connection controlled by '" + tlID +
"'");
972 #ifdef HAVE_INTERNAL_LANES 978 "') should be set as a via-lane for lane '" + toLane->
getID() +
"'.");
983 link =
new MSLink(toLane, via, dir, state, length, keepClear);
990 link =
new MSLink(toLane, dir, state, length, keepClear);
1050 WRITE_WARNING(
"no valid geo projection loaded from network. fcd-output.geo will not work");
1072 sink->
initialize(
new std::vector<MSLane*>());
1078 source->
initialize(
new std::vector<MSLane*>());
1081 for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
1093 if (shape.size() != 0) {
1132 for (std::vector<std::string>::iterator it = edgeIDs.begin(); it != edgeIDs.end(); ++it) {
1135 WRITE_ERROR(
"Unknown edge '" + (*it) +
"' in roundabout");
1175 WRITE_ERROR(
"Lane '" + laneID +
"' to place poi '" + poiID +
"' on is not known.");
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
void postLoadInitialization()
initialize junctions after all connections have been loaded
const std::string & getActiveKey() const
Returns the active key.
void beginE3Detector(const SUMOSAXAttributes &attrs)
Starts building of an e3 detector using the given specification.
void initTrafficLightLogic(const std::string &id, const std::string &programID, TrafficLightType type, SUMOTime offset)
Begins the reading of a traffic lights logic.
void addWAUTJunction(const SUMOSAXAttributes &attrs)
Builds detectors for microsim.
virtual void addE2Detector(const SUMOSAXAttributes &attrs)
Builds an e2 detector using the given specification.
static RGBColor parseColor(std::string coldef)
Parses a color information.
minimum duration of a phase
bool myCurrentIsInternalToSkip
Information whether the currently parsed edge is internal and not wished, here.
Whether vehicles must keep the junction clear.
const SUMOReal SUMO_const_laneWidth
void addSuccessor(MSEdge *edge)
Adds an edge to the list of edges which may be reached from this edge and to the incoming of the othe...
virtual MSEdge * closeEdge()
Closes the building of an edge; The edge is completely described by now and may not be opened again...
size_t getNumberOfLoadedPhases() const
return the number of phases loaded so far (for error reporting)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
virtual void openWAUT(const SUMOSAXAttributes &attrs)
const Position geometryPositionAtOffset(SUMOReal offset) const
void initialize(const std::vector< MSLane * > *lanes)
Initialize the edge.
void addIncoming(MSEdge *edge)
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
void parseLanes(const std::string &junctionID, const std::string &def, std::vector< MSLane * > &into, bool &ok)
virtual MSEdge * buildEdge(const std::string &id, const MSEdge::EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, const int priority)
Builds an edge instance (MSEdge in this case)
void addE3Entry(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an entry point of an e3 detector.
const std::string & getActiveSubKey() const
Returns the active sub key.
SUMOReal getLength() const
Returns the lane's length.
The base class for an intersection.
static std::string getJunctionIDFromInternalEdge(const std::string internalEdge)
return the junction id when given an edge of type internal, crossing or WalkingArea ...
void addLink(MSLink *link)
Delayed initialization.
virtual void addVTypeProbeDetector(const SUMOSAXAttributes &attrs)
Builds a vtype-detector using the given specification.
void addRoundabout(const SUMOSAXAttributes &attrs)
NLDetectorBuilder & myDetectorBuilder
The detector builder to use.
void parseAndBuildChargingStation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a charging station.
void parseAndBuildRerouter(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a rerouter.
void buildInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, SUMOTime splInterval, const std::string &device, bool friendlyPos, bool splitByType)
Builds an e1 detector and adds it to the net.
void closeJunctionLogic()
Ends the building of a junction logic (row-logic)
SUMOReal myNetworkVersion
the loaded network version
void addE3Exit(const std::string &lane, SUMOReal pos, bool friendlyPos)
Builds an exit point of an e3 detector.
The edge is a macroscopic connector (source/sink)
void addIncomingLane(MSLane *lane, MSLink *viaLink)
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
virtual void addE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
NLHandler(const std::string &file, MSNet &net, NLDetectorBuilder &detBuilder, NLTriggerBuilder &triggerBuilder, NLEdgeControlBuilder &edgeBuilder, NLJunctionControlBuilder &junctionBuilder)
Constructor.
void beginEdgeParsing(const SUMOSAXAttributes &attrs)
begins the processing of an edge
maximum duration of a phase
static StringBijection< LinkState > LinkStates
const SVCPermissions SVCAll
void createEdgeLaneMeanData(const std::string &id, SUMOTime frequency, SUMOTime begin, SUMOTime end, const std::string &type, const bool useLanes, const bool withEmpty, const bool printDefaults, const bool withInternal, const bool trackVehicles, const SUMOReal maxTravelTime, const SUMOReal minSamples, const SUMOReal haltSpeed, const std::string &vTypes, const std::string &device)
Creates edge based mean data collector using the given specification.
void parseAndBuildBusStop(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a bus stop.
std::string myCurrentDistrictID
The id of the current district.
EdgeBasicFunction
Defines possible edge types.
void closeWAUT(const std::string &wautid)
Closes loading of a WAUT.
void buildVTypeProbe(const std::string &id, const std::string &vtype, SUMOTime frequency, const std::string &device)
Builds a vTypeProbe and adds it to the net.
virtual void endE3Detector()
Builds of an e3 detector using collected values.
void endE3Detector()
Builds of an e3 detector using collected values.
void addLink(MSLink *link, MSLane *lane, unsigned int pos)
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
virtual SumoXMLEdgeFunc getEdgeFunc(bool &ok) const =0
Returns the value of the named attribute.
A class that stores a 2D geometrical boundary.
The purpose of the edge is not known.
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
static OptionsCont & getOptions()
Retrieves the options.
bool myAmInTLLogicMode
internal information whether a tls-logic is currently read
void closeJunction(const std::string &basePath)
Closes (ends) the processing of the current junction.
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.
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
void addParam(const SUMOSAXAttributes &attrs)
void addDistrict(const SUMOSAXAttributes &attrs)
static StringBijection< LinkDirection > LinkDirections
void addApproachingLane(MSLane *lane, bool warnMultiCon)
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
void setLocation(const SUMOSAXAttributes &attrs)
Parses network location description.
void addPhase(SUMOTime duration, const std::string &state, SUMOTime min, SUMOTime max)
Adds a phase to the currently built traffic lights logic.
The definition of a periodic event.
virtual void openJunction(const SUMOSAXAttributes &attrs)
opens a junction for processing
const std::string & getFileName() const
returns the current file name
NLEdgeControlBuilder & myEdgeControlBuilder
The edge builder to use.
The edge is a district edge.
MSTrafficLightLogic * getActive() const
void addE3Entry(const SUMOSAXAttributes &attrs)
Adds an entry to the currently processed e3 detector.
Encapsulated SAX-Attributes.
An instantenous induction loop.
std::string getCurrentE3ID() const
Returns the id of the currently built e3 detector.
void addE3Exit(const SUMOSAXAttributes &attrs)
Adds an exit to the currently processed e3 detector.
static StringBijection< TrafficLightType > TrafficLightTypes
Builder of microsim-junctions and tls.
Position getLanePos(const std::string &poiID, const std::string &laneID, SUMOReal lanePos)
get position for a given laneID
ShapeContainer & getShapeContainer()
Returns the shapes container.
A point in 2D or 3D with translation and scaling methods.
void parseAndBuildContainerStop(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a container stop.
virtual void closeTrafficLightLogic(const std::string &basePath)
Ends the building of a traffic lights logic.
void addWAUTSwitch(const SUMOSAXAttributes &attrs)
JunctionGraph myJunctionGraph
void addRequest(const SUMOSAXAttributes &attrs)
adds a request item to the current junction logic
void setPermissionsFound()
Labels the network to contain vehicle class permissions.
void addConnection(const SUMOSAXAttributes &attrs)
adds a connection
std::string myCurrentTypeID
The id of the currently processed edge type.
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
void addAction(const SUMOSAXAttributes &attrs, const std::string &basePath)
Builds an action and saves it for further use.
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
SUMOTime string2time(const std::string &r)
Information within the junction logic which internal lanes block external.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
MSJunction * retrieve(const std::string id)
try to retrieve junction by id
bool myHaveSeenInternalEdge
whether the loaded network contains internal lanes
LinkDirection parseLinkDir(const std::string &dir)
Parses the given character into an enumeration typed link direction.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
SVCPermissions parseVehicleClasses(const std::string &allowedS)
Parses the given definition of allowed vehicle classes into the given containers Deprecated classes g...
void openJunction(const std::string &id, const std::string &key, const SumoXMLNodeType type, SUMOReal x, SUMOReal y, const PositionVector &shape, const std::vector< MSLane * > &incomingLanes, const std::vector< MSLane * > &internalLanes)
Begins the processing of the named junction.
MSTLLogicControl & getTLLogicControlToUse() const
Returns the used tls control.
void addParam(const std::string &key, const std::string &value)
Adds a parameter.
void buildRouteProbe(const std::string &id, const std::string &edge, SUMOTime frequency, SUMOTime begin, const std::string &device)
Builds a routeProbe and adds it to the net.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
virtual SumoXMLNodeType getNodeType(bool &ok) const =0
Returns the value of the named attribute.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void addOutgoing(MSEdge *edge)
MSTLLogicControl::TLSLogicVariants & getTLLogic(const std::string &id) const
Returns a previously build tls logic.
void addWAUTJunction(const std::string &wautid, const std::string &tls, const std::string &proc, bool synchron)
Adds a tls to the list of tls to be switched by the named WAUT.
virtual std::vector< std::string > getStringVector(int attr) const =0
Tries to read given attribute assuming it is a string vector.
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
std::string myCurrentWAUTID
The id of the currently processed WAUT.
The edge is a pedestrian walking area (a special type of internal edge)
virtual void myEndElement(int element)
Called when a closing tag occurs.
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
virtual void addInstantE1Detector(const SUMOSAXAttributes &attrs)
Builds an e1 detector using the given specification.
virtual void closeEdge()
Closes the process of building an edge.
virtual void addRouteProbeDetector(const SUMOSAXAttributes &attrs)
Builds a routeProbe-detector using the given specification.
void addLane(const SUMOSAXAttributes &attrs)
adds a lane to the previously opened edge
virtual ~NLHandler()
Destructor.
virtual bool addPolygon(const std::string &id, const std::string &type, const RGBColor &color, SUMOReal layer, SUMOReal angle, const std::string &imgFile, const PositionVector &shape, bool fill)
Builds a polygon using the given values and adds it to the container.
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
NLTriggerBuilder & myTriggerBuilder
The trigger builder to use.
void initJunctionLogic(const std::string &id)
Initialises a junction logic.
The edge is a normal street.
The link is controlled by a tls which is off and blinks, has to brake.
static std::string checkForRelativity(const std::string &filename, const std::string &basePath)
Returns the path from a configuration so that it is accessable from the current working directory...
bool myNetIsLoaded
whether the location element was already loadee
void addWAUT(SUMOTime refTime, const std::string &id, const std::string &startProg)
Adds a WAUT definition.
The edge is a pedestrian crossing (a special type of internal edge)
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
virtual MSLane * addLane(const std::string &id, SUMOReal maxSpeed, SUMOReal length, const PositionVector &shape, SUMOReal width, SVCPermissions permissions)
Adds a lane to the current edge;.
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
void addPhase(const SUMOSAXAttributes &attrs)
adds a phase to the traffic lights logic currently build
void addDistrictEdge(const SUMOSAXAttributes &attrs, bool isSource)
MSNet & myNet
The net to fill (preinitialised)
void addRestriction(const std::string &id, const SUMOVehicleClass svc, const SUMOReal speed)
Adds a restriction for an edge type.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
LinkState parseLinkState(const std::string &state)
Parses the given character into an enumeration typed link state.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
The abstract direction of a link.
void setJunctions(MSJunction *from, MSJunction *to)
T get(const std::string &str) const
void buildE2Detector(const std::string &id, const std::string &lane, SUMOReal pos, SUMOReal length, bool cont, SUMOTime splInterval, const std::string &device, SUMOTime haltingTimeThreshold, SUMOReal haltingSpeedThreshold, SUMOReal jamDistThreshold, bool friendlyPos)
Builds an e2 detector with a fixed interval and adds it to the net.
const PositionVector & getShape() const
Returns this lane's shape.
The parent class for traffic light logics.
void beginEdgeParsing(const std::string &id, const MSEdge::EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Begins building of an MSEdge.
NLDiscreteEventBuilder myActionBuilder
A builder for object actions.
void addWAUTSwitch(const std::string &wautid, SUMOTime when, const std::string &to)
Adds a WAUT switch step to a previously built WAUT.
void buildInstantInductLoop(const std::string &id, const std::string &lane, SUMOReal pos, const std::string &device, bool friendlyPos)
Builds an instantenous induction and adds it to the net.
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.
virtual void myEndElement(int element)
Called when a closing tag occurs.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual void addEdgeLaneMeanData(const SUMOSAXAttributes &attrs, int objecttype)
Builds edge or lane base mean data collector using the given specification.
Builds trigger objects for microsim.
void initJunctionLogic(const SUMOSAXAttributes &attrs)
begins the reading of a junction row logic
The edge is an internal edge.
bool myLefthand
whether the loaded network was built for left hand traffic
void beginE3Detector(const std::string &id, const std::string &device, SUMOTime splInterval, SUMOReal haltingSpeedThreshold, SUMOTime haltingTimeThreshold)
Stores temporary the initial information about an e3 detector to build.
Parameterised * myLastParameterised
void closePolygon()
ensures that the last position equals the first
Information whether the detector shall be continued on the folowing lanes.
Representation of a lane in the micro simulation.
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
NLJunctionControlBuilder & myJunctionControlBuilder
The junction builder to use.
Parser and container for routes during their loading.
void initTrafficLightLogic(const SUMOSAXAttributes &attrs)
begins the reading of a traffic lights logic
static const Position INVALID
Interface for building edges.
void addLogicItem(int request, const std::string &response, const std::string &foes, bool cont)
Adds a logic item.