#include <NIImporter_DlrNavteq.h>

Being a LineHandler, this class retrieves each line from a LineReader and parses these information assuming they contain node definitions in DLRNavteq's unsplit format.
Definition at line 83 of file NIImporter_DlrNavteq.h.
Public Member Functions | |
| NodesHandler (NBNodeCont &nc, const std::string &file, std::map< std::string, Position2DVector > &geoms) throw () | |
| Constructor. | |
| bool | report (const std::string &result) throw (ProcessError) |
| Parsing method. | |
| ~NodesHandler () throw () | |
| Destructor. | |
Protected Attributes | |
| std::map< std::string, Position2DVector > & | myGeoms |
| A container for parsed geometries. | |
| NBNodeCont & | myNodeCont |
Private Member Functions | |
| NodesHandler (const NodesHandler &) | |
| Invalidated copy constructor. | |
| NodesHandler & | operator= (const NodesHandler &) |
| Invalidated assignment operator. | |
| NIImporter_DlrNavteq::NodesHandler::NodesHandler | ( | NBNodeCont & | nc, | |
| const std::string & | file, | |||
| std::map< std::string, Position2DVector > & | geoms | |||
| ) | throw () |
Constructor.
| in,filled] | nc The node control to insert loaded nodes into | |
| [in] | file | The name of the parsed file |
| in,geoms] | geoms Storage for read edge geometries |
Definition at line 107 of file NIImporter_DlrNavteq.cpp.
00110 : myNodeCont(nc), myGeoms(geoms) {}
| NIImporter_DlrNavteq::NodesHandler::~NodesHandler | ( | ) | throw () |
| NIImporter_DlrNavteq::NodesHandler::NodesHandler | ( | const NodesHandler & | ) | [private] |
Invalidated copy constructor.
| NodesHandler& NIImporter_DlrNavteq::NodesHandler::operator= | ( | const NodesHandler & | ) | [private] |
Invalidated assignment operator.
| bool NIImporter_DlrNavteq::NodesHandler::report | ( | const std::string & | result | ) | throw (ProcessError) [virtual] |
Parsing method.
Implementation of the LineHandler-interface called by a LineReader; interprets the retrieved information and stores it into "myNodeCont". Additionally, edge geometries are parsed and stored into "myGeoms".
| [in] | result | The read line |
| ProcessError | if something fails |
Implements LineHandler.
Definition at line 117 of file NIImporter_DlrNavteq.cpp.
References NBNodeCont::insert(), myGeoms, myNodeCont, Position2DVector::push_back(), and GeoConvHelper::x2cartesian().
00117 { 00118 if (result[0]=='#') { 00119 return true; 00120 } 00121 std::string id; 00122 double x, y; 00123 int no_geoms, intermediate; 00124 // parse 00125 std::istringstream stream(result); 00126 // id 00127 stream >> id; 00128 if (stream.fail()) { 00129 throw ProcessError("Something is wrong with the following data line\n" + result); 00130 } 00131 // intermediate? 00132 stream >> intermediate; 00133 if (stream.fail()) { 00134 throw ProcessError("Non-numerical value for intermediate status in node " + id + "."); 00135 } 00136 // number of geometrical information 00137 stream >> no_geoms; 00138 if (stream.fail()) { 00139 throw ProcessError("Non-numerical value for number of geometries in node " + id + "."); 00140 } 00141 // geometrical information 00142 Position2DVector geoms; 00143 for (int i=0; i<no_geoms; i++) { 00144 stream >> x; 00145 if (stream.fail()) { 00146 throw ProcessError("Non-numerical value for x-position in node " + id + "."); 00147 } 00148 stream >> y; 00149 if (stream.fail()) { 00150 throw ProcessError("Non-numerical value for y-position in node " + id + "."); 00151 } 00152 Position2D pos(x, y); 00153 if (!GeoConvHelper::x2cartesian(pos, true, x, y)) { 00154 throw ProcessError("Unable to project coordinates for node " + id + "."); 00155 } 00156 geoms.push_back(pos); 00157 } 00158 00159 if (intermediate==0) { 00160 NBNode *n = new NBNode(id, geoms[0]); 00161 if (!myNodeCont.insert(n)) { 00162 delete n; 00163 throw ProcessError("Could not add node '" + id + "'."); 00164 } 00165 } else { 00166 myGeoms[id] = geoms; 00167 } 00168 return true; 00169 }
std::map<std::string, Position2DVector>& NIImporter_DlrNavteq::NodesHandler::myGeoms [protected] |
A container for parsed geometries.
Definition at line 117 of file NIImporter_DlrNavteq.h.
Referenced by report().
NBNodeCont& NIImporter_DlrNavteq::NodesHandler::myNodeCont [protected] |
1.5.6