bool NIImporter_DlrNavteq::TrafficlightsHandler::report(const std::string& result) { // #ID POICOL-TYPE DESCRIPTION LONGITUDE LATITUDE NAVTEQ_LINK_ID NODEID if (result[0] == '#') { return true; } StringTokenizer st(result, StringTokenizer::WHITECHARS); const std::string edgeID = st.get(5); NBEdge* edge = myEdgeCont.retrieve(edgeID); if (edge == nullptr) { WRITE_WARNING("The traffic light edge '" + edgeID + "' could not be found"); } else { NBNode* node = edge->getToNode(); if (node->getType() != NODETYPE_TRAFFIC_LIGHT) { node->reinit(node->getPosition(), NODETYPE_TRAFFIC_LIGHT); // @note. There may be additional information somewhere in the GDF files about traffic light type ... TrafficLightType type = SUMOXMLDefinitions::TrafficLightTypes.get(OptionsCont::getOptions().getString("tls.default-type")); // @note actually we could use the navteq node ID here NBTrafficLightDefinition* tlDef = new NBOwnTLDef(node->getID(), node, 0, type); if (!myTLLogicCont.insert(tlDef)) { // actually, nothing should fail here delete tlDef; throw ProcessError("Could not allocate tls for '" + node->getID() + "'."); } } } return true; }
void NBNodeCont::discardTrafficLights(NBTrafficLightLogicCont& tlc, bool geometryLike) { for (NodeCont::const_iterator i = myNodes.begin(); i != myNodes.end(); ++i) { NBNode* node = i->second; if (!geometryLike || node->geometryLike()) { // make a copy of tldefs const std::set<NBTrafficLightDefinition*> tldefs = node->getControllingTLS(); for (std::set<NBTrafficLightDefinition*>::const_iterator it = tldefs.begin(); it != tldefs.end(); ++it) { NBTrafficLightDefinition* tlDef = *it; node->removeTrafficLight(tlDef); tlc.extract(tlDef); } node->reinit(node->getPosition(), NODETYPE_UNKNOWN); } } }
void NBNodeCont::discardTrafficLights(NBTrafficLightLogicCont& tlc, bool geometryLike, bool guessSignals) { for (NodeCont::const_iterator i = myNodes.begin(); i != myNodes.end(); ++i) { NBNode* node = i->second; if (!geometryLike || node->geometryLike()) { // make a copy of tldefs const std::set<NBTrafficLightDefinition*> tldefs = node->getControllingTLS(); if (guessSignals && node->isTLControlled() && node->geometryLike()) { // record signal location const EdgeVector& outgoing = node->getOutgoingEdges(); for (EdgeVector::const_iterator it_o = outgoing.begin(); it_o != outgoing.end(); ++it_o) { (*it_o)->setSignalOffset((*it_o)->getLength()); } } for (std::set<NBTrafficLightDefinition*>::const_iterator it = tldefs.begin(); it != tldefs.end(); ++it) { NBTrafficLightDefinition* tlDef = *it; node->removeTrafficLight(tlDef); tlc.extract(tlDef); } node->reinit(node->getPosition(), NODETYPE_UNKNOWN); } } }