void NIImporter_SUMO::addJunction(const SUMOSAXAttributes& attrs) { // get the id, report an error if not given or empty... myCurrentJunction.node = 0; myCurrentJunction.intLanes.clear(); myCurrentJunction.response.clear(); bool ok = true; std::string id = attrs.get<std::string>(SUMO_ATTR_ID, 0, ok); if (!ok) { return; } if (id[0] == ':') { // internal node return; } SumoXMLNodeType type = attrs.getNodeType(ok); if (ok) { if (type == NODETYPE_DEAD_END_DEPRECATED || type == NODETYPE_DEAD_END) { // dead end is a computed status. Reset this to unknown so it will // be corrected if additional connections are loaded type = NODETYPE_UNKNOWN; } } else { WRITE_WARNING("Unknown node type for junction '" + id + "'."); } Position pos = readPosition(attrs, id, ok); NBNetBuilder::transformCoordinates(pos, true, myLocation); NBNode* node = new NBNode(id, pos, type); if (!myNodeCont.insert(node)) { WRITE_ERROR("Problems on adding junction '" + id + "'."); delete node; return; } myCurrentJunction.node = node; SUMOSAXAttributes::parseStringVector(attrs.get<std::string>(SUMO_ATTR_INTLANES, 0, ok, false), myCurrentJunction.intLanes); // set optional radius if (attrs.hasAttribute(SUMO_ATTR_RADIUS)) { node->setRadius(attrs.get<SUMOReal>(SUMO_ATTR_RADIUS, id.c_str(), ok)); } // handle custom shape if (attrs.getOpt<bool>(SUMO_ATTR_CUSTOMSHAPE, 0, ok, false)) { node->setCustomShape(attrs.get<PositionVector>(SUMO_ATTR_SHAPE, id.c_str(), ok)); } if (myCustomShapeMaps.count(id) > 0) { NBNode::CustomShapeMap customShapes = myCustomShapeMaps[id]; for (NBNode::CustomShapeMap::const_iterator it = customShapes.begin(); it != customShapes.end(); ++it) { node->setCustomLaneShape(it->first, it->second); } } if (type == NODETYPE_RAIL_SIGNAL || type == NODETYPE_RAIL_CROSSING) { // both types of nodes come without a tlLogic myRailSignals.insert(id); } }