Eclipse SUMO - Simulation of Urban MObility
NIImporter_ArcView.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // Importer for networks stored in ArcView-shape format
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
30 #include <utils/common/ToString.h>
34 #include <utils/geom/GeomHelper.h>
35 #include <netbuild/NBNetBuilder.h>
36 #include <netbuild/NBHelpers.h>
37 #include <netbuild/NBEdge.h>
38 #include <netbuild/NBEdgeCont.h>
39 #include <netbuild/NBTypeCont.h>
40 #include <netbuild/NBNode.h>
41 #include <netbuild/NBNodeCont.h>
45 #include "NILoader.h"
46 #include "NIImporter_ArcView.h"
47 
48 #ifdef HAVE_GDAL
49 #if __GNUC__ > 3
50 #pragma GCC diagnostic push
51 #pragma GCC diagnostic ignored "-Wpedantic"
52 #endif
53 #include <ogrsf_frmts.h>
54 #if __GNUC__ > 3
55 #pragma GCC diagnostic pop
56 #endif
57 #endif
58 
59 
60 // ===========================================================================
61 // method definitions
62 // ===========================================================================
63 // ---------------------------------------------------------------------------
64 // static methods (interface in this case)
65 // ---------------------------------------------------------------------------
66 void
68  if (!oc.isSet("shapefile-prefix")) {
69  return;
70  }
71  // check whether the correct set of entries is given
72  // and compute both file names
73  std::string dbf_file = oc.getString("shapefile-prefix") + ".dbf";
74  std::string shp_file = oc.getString("shapefile-prefix") + ".shp";
75  std::string shx_file = oc.getString("shapefile-prefix") + ".shx";
76  // check whether the files do exist
77  if (!FileHelpers::isReadable(dbf_file)) {
78  WRITE_ERROR("File not accessible: " + dbf_file);
79  }
80  if (!FileHelpers::isReadable(shp_file)) {
81  WRITE_ERROR("File not accessible: " + shp_file);
82  }
83  if (!FileHelpers::isReadable(shx_file)) {
84  WRITE_ERROR("File not accessible: " + shx_file);
85  }
86  if (MsgHandler::getErrorInstance()->wasInformed()) {
87  return;
88  }
89  // load the arcview files
90  NIImporter_ArcView loader(oc,
91  nb.getNodeCont(), nb.getEdgeCont(), nb.getTypeCont(),
92  dbf_file, shp_file, oc.getBool("speed-in-kmh"));
93  loader.load();
94 }
95 
96 
97 
98 // ---------------------------------------------------------------------------
99 // loader methods
100 // ---------------------------------------------------------------------------
102  NBNodeCont& nc,
103  NBEdgeCont& ec,
104  NBTypeCont& tc,
105  const std::string& dbf_name,
106  const std::string& shp_name,
107  bool speedInKMH)
108  : myOptions(oc), mySHPName(shp_name),
109  myNameAddition(0),
110  myNodeCont(nc), myEdgeCont(ec), myTypeCont(tc),
111  mySpeedInKMH(speedInKMH),
112  myRunningEdgeID(0),
113  myRunningNodeID(0) {
114  UNUSED_PARAMETER(dbf_name);
115 }
116 
117 
119 
120 
121 void
123 #ifdef HAVE_GDAL
124  PROGRESS_BEGIN_MESSAGE("Loading data from '" + mySHPName + "'");
125 #if GDAL_VERSION_MAJOR < 2
126  OGRRegisterAll();
127  OGRDataSource* poDS = OGRSFDriverRegistrar::Open(mySHPName.c_str(), FALSE);
128 #else
129  GDALAllRegister();
130  GDALDataset* poDS = (GDALDataset*)GDALOpenEx(mySHPName.c_str(), GDAL_OF_VECTOR | GA_ReadOnly, NULL, NULL, NULL);
131 #endif
132  if (poDS == NULL) {
133  WRITE_ERROR("Could not open shape description '" + mySHPName + "'.");
134  return;
135  }
136 
137  // begin file parsing
138  OGRLayer* poLayer = poDS->GetLayer(0);
139  poLayer->ResetReading();
140 
141  // build coordinate transformation
142  OGRSpatialReference* origTransf = poLayer->GetSpatialRef();
143  OGRSpatialReference destTransf;
144  // use wgs84 as destination
145  destTransf.SetWellKnownGeogCS("WGS84");
146  OGRCoordinateTransformation* poCT = OGRCreateCoordinateTransformation(origTransf, &destTransf);
147  if (poCT == NULL) {
148  if (myOptions.isSet("shapefile.guess-projection")) {
149  OGRSpatialReference origTransf2;
150  origTransf2.SetWellKnownGeogCS("WGS84");
151  poCT = OGRCreateCoordinateTransformation(&origTransf2, &destTransf);
152  }
153  if (poCT == 0) {
154  WRITE_WARNING("Could not create geocoordinates converter; check whether proj.4 is installed.");
155  }
156  }
157 
158  const bool saveOrigIDs = OptionsCont::getOptions().getBool("output.original-names");
159  OGRFeature* poFeature;
160  poLayer->ResetReading();
161 
162  const double nodeJoinDist = myOptions.getFloat("shapefile.node-join-dist");
163  const std::vector<std::string> params = myOptions.getStringVector("shapefile.add-params");
164 
165  int featureIndex = 0;
166  bool warnNotUnique = true;
167  std::string idPrefix = ""; // prefix for non-unique street-id values
168  int idIndex = 1; // running index to make street-id unique
169  while ((poFeature = poLayer->GetNextFeature()) != NULL) {
170  // read in edge attributes
171  if (featureIndex == 0) {
172  WRITE_MESSAGE("Available fields: " + toString(getFieldNames(poFeature)));
173  }
174  std::string id;
175  std::string name;
176  std::string from_node;
177  std::string to_node;
178  if (!getStringEntry(poFeature, "shapefile.street-id", "LINK_ID", true, id)) {
179  WRITE_ERROR("Needed field '" + id + "' (street-id) is missing.");
180  id = "";
181  }
182  if (id == "") {
183  id = toString(myRunningEdgeID++);
184  }
185 
186  getStringEntry(poFeature, "shapefile.name", "ST_NAME", true, name);
187  name = StringUtils::replace(name, "&", "&amp;");
188 
189  if (!getStringEntry(poFeature, "shapefile.from-id", "REF_IN_ID", true, from_node)) {
190  WRITE_ERROR("Needed field '" + from_node + "' (from node id) is missing.");
191  from_node = "";
192  }
193  if (!getStringEntry(poFeature, "shapefile.to-id", "NREF_IN_ID", true, to_node)) {
194  WRITE_ERROR("Needed field '" + to_node + "' (to node id) is missing.");
195  to_node = "";
196  }
197 
198  if (from_node == "" || to_node == "") {
199  from_node = toString(myRunningNodeID++);
200  to_node = toString(myRunningNodeID++);
201  }
202 
203  std::string type;
204  if (myOptions.isSet("shapefile.type-id") && poFeature->GetFieldIndex(myOptions.getString("shapefile.type-id").c_str()) >= 0) {
205  type = poFeature->GetFieldAsString(myOptions.getString("shapefile.type-id").c_str());
206  } else if (poFeature->GetFieldIndex("ST_TYP_AFT") >= 0) {
207  type = poFeature->GetFieldAsString("ST_TYP_AFT");
208  }
209  if ((type != "" || myOptions.isSet("shapefile.type-id")) && !myTypeCont.knows(type)) {
210  WRITE_WARNING("Unknown type '" + type + "' for edge '" + id + "'");
211  }
212  double width = myTypeCont.getWidth(type);
213  bool oneway = myTypeCont.knows(type) ? myTypeCont.getIsOneWay(type) : false;
214  double speed = getSpeed(*poFeature, id);
215  int nolanes = getLaneNo(*poFeature, id, speed);
216  int priority = getPriority(*poFeature, id);
217  if (nolanes <= 0 || speed <= 0) {
218  if (myOptions.getBool("shapefile.use-defaults-on-failure")) {
219  nolanes = nolanes <= 0 ? myTypeCont.getNumLanes(type) : nolanes;
220  speed = speed <= 0 ? myTypeCont.getSpeed(type) : speed;
221  } else {
222  const std::string lanesField = myOptions.isSet("shapefile.laneNumber") ? myOptions.getString("shapefile.laneNumber") : "nolanes";
223  const std::string speedField = myOptions.isSet("shapefile.speed") ? myOptions.getString("shapefile.speed") : "speed";
224  WRITE_ERROR("Required field '" + lanesField + "' or '" + speedField + "' is missing (add fields or set option --shapefile.use-defaults-on-failure).");
225  WRITE_ERROR("Available fields: " + toString(getFieldNames(poFeature)));
226  OGRFeature::DestroyFeature(poFeature);
227  return;
228  }
229  }
230  if (mySpeedInKMH) {
231  speed = speed / (double) 3.6;
232  }
233 
234 
235  // read in the geometry
236  OGRGeometry* poGeometry = poFeature->GetGeometryRef();
237  OGRwkbGeometryType gtype = poGeometry->getGeometryType();
238  if (gtype != wkbLineString && gtype != wkbLineString25D) {
239  OGRFeature::DestroyFeature(poFeature);
240  WRITE_ERROR("Road geometry must be of type 'linestring' or 'linestring25D' (found '" + toString(gtype) + "')");
241  return;
242  }
243  OGRLineString* cgeom = (OGRLineString*) poGeometry;
244  if (poCT != 0) {
245  // try transform to wgs84
246  cgeom->transform(poCT);
247  }
248 
249  PositionVector shape;
250  for (int j = 0; j < cgeom->getNumPoints(); j++) {
251  Position pos((double) cgeom->getX(j), (double) cgeom->getY(j), (double) cgeom->getZ(j));
253  WRITE_WARNING("Unable to project coordinates for edge '" + id + "'.");
254  }
255  shape.push_back_noDoublePos(pos);
256  }
257 
258  // build from-node
259  NBNode* from = myNodeCont.retrieve(from_node);
260  if (from == 0) {
261  Position from_pos = shape[0];
262  from = myNodeCont.retrieve(from_pos, nodeJoinDist);
263  if (from == 0) {
264  from = new NBNode(from_node, from_pos);
265  if (!myNodeCont.insert(from)) {
266  WRITE_ERROR("Node '" + from_node + "' could not be added");
267  delete from;
268  continue;
269  }
270  }
271  }
272  // build to-node
273  NBNode* to = myNodeCont.retrieve(to_node);
274  if (to == 0) {
275  Position to_pos = shape[-1];
276  to = myNodeCont.retrieve(to_pos, nodeJoinDist);
277  if (to == 0) {
278  to = new NBNode(to_node, to_pos);
279  if (!myNodeCont.insert(to)) {
280  WRITE_ERROR("Node '" + to_node + "' could not be added");
281  delete to;
282  continue;
283  }
284  }
285  }
286 
287  if (from == to) {
288  WRITE_WARNING("Edge '" + id + "' connects identical nodes, skipping.");
289  continue;
290  }
291 
292  // retrieve the information whether the street is bi-directional
293  std::string dir;
294  int index = poFeature->GetDefnRef()->GetFieldIndex("DIR_TRAVEL");
295  if (index >= 0 && poFeature->IsFieldSet(index)) {
296  dir = poFeature->GetFieldAsString(index);
297  }
298  const std::string origID = saveOrigIDs ? id : "";
299  // check for duplicate ids
300  NBEdge* existing = myEdgeCont.retrieve(id);
301  NBEdge* existingReverse = myEdgeCont.retrieve("-" + id);
302  if (existing != nullptr || existingReverse != nullptr) {
303  std::string duplicateID = existing != nullptr ? id : existingReverse->getID();
304  if ((existing != 0 && existing->getGeometry() == shape)
305  || (existingReverse != 0 && existingReverse->getGeometry() == shape.reverse())) {
306  WRITE_ERROR("Edge '" + duplicateID + " is not unique");
307  } else {
308  if (id != idPrefix) {
309  idPrefix = id;
310  idIndex = 1;
311  }
312  id += "#" + toString(idIndex);
313  if (warnNotUnique) {
314  WRITE_WARNING("street-id '" + idPrefix + "' is not unique. Renaming subsequent edge to '" + id + "'");
315  warnNotUnique = false;
316  }
317  idIndex++;
318  }
319  }
320  // add positive direction if wanted
321  if (dir == "B" || dir == "F" || dir == "" || myOptions.getBool("shapefile.all-bidirectional")) {
322  if (myEdgeCont.retrieve(id) == 0) {
323  LaneSpreadFunction spread = dir == "B" || dir == "FALSE" ? LANESPREAD_RIGHT : LANESPREAD_CENTER;
324  NBEdge* edge = new NBEdge(id, from, to, type, speed, nolanes, priority, width, NBEdge::UNSPECIFIED_OFFSET, shape, name, origID, spread);
326  myEdgeCont.insert(edge);
327  checkSpread(edge);
328  addParams(edge, poFeature, params);
329  } else {
330  WRITE_ERROR("Could not create edge '" + id + "'. An edge with the same id already exists");
331  }
332  }
333  // add negative direction if wanted
334  if ((dir == "B" || dir == "T" || myOptions.getBool("shapefile.all-bidirectional")) && !oneway) {
335  if (myEdgeCont.retrieve("-" + id) == 0) {
336  LaneSpreadFunction spread = dir == "B" || dir == "FALSE" ? LANESPREAD_RIGHT : LANESPREAD_CENTER;
337  NBEdge* edge = new NBEdge("-" + id, to, from, type, speed, nolanes, priority, width, NBEdge::UNSPECIFIED_OFFSET, shape.reverse(), name, origID, spread);
339  myEdgeCont.insert(edge);
340  checkSpread(edge);
341  addParams(edge, poFeature, params);
342  } else {
343  WRITE_ERROR("Could not create edge '-" + id + "'. An edge with the same id already exists");
344  }
345  }
346  //
347  OGRFeature::DestroyFeature(poFeature);
348  featureIndex++;
349  }
350 #if GDAL_VERSION_MAJOR < 2
351  OGRDataSource::DestroyDataSource(poDS);
352 #else
353  GDALClose(poDS);
354 #endif
356 #else
357  WRITE_ERROR("SUMO was compiled without GDAL support.");
358 #endif
359 }
360 
361 #ifdef HAVE_GDAL
362 double
363 NIImporter_ArcView::getSpeed(OGRFeature& poFeature, const std::string& edgeid) {
364  if (myOptions.isSet("shapefile.speed")) {
365  int index = poFeature.GetDefnRef()->GetFieldIndex(myOptions.getString("shapefile.speed").c_str());
366  if (index >= 0 && poFeature.IsFieldSet(index)) {
367  const double speed = poFeature.GetFieldAsDouble(index);
368  if (speed <= 0) {
369  WRITE_WARNING("invalid value for field: '"
370  + myOptions.getString("shapefile.laneNumber")
371  + "': '" + std::string(poFeature.GetFieldAsString(index)) + "'");
372  } else {
373  return speed;
374  }
375  }
376  }
377  if (myOptions.isSet("shapefile.type-id")) {
378  return myTypeCont.getSpeed(poFeature.GetFieldAsString((char*)(myOptions.getString("shapefile.type-id").c_str())));
379  }
380  // try to get definitions as to be found in SUMO-XML-definitions
381  // idea by John Michael Calandrino
382  int index = poFeature.GetDefnRef()->GetFieldIndex("speed");
383  if (index >= 0 && poFeature.IsFieldSet(index)) {
384  return (double) poFeature.GetFieldAsDouble(index);
385  }
386  index = poFeature.GetDefnRef()->GetFieldIndex("SPEED");
387  if (index >= 0 && poFeature.IsFieldSet(index)) {
388  return (double) poFeature.GetFieldAsDouble(index);
389  }
390  // try to get the NavTech-information
391  index = poFeature.GetDefnRef()->GetFieldIndex("SPEED_CAT");
392  if (index >= 0 && poFeature.IsFieldSet(index)) {
393  std::string def = poFeature.GetFieldAsString(index);
394  return NINavTeqHelper::getSpeed(edgeid, def);
395  }
396  return -1;
397 }
398 
399 
400 int
401 NIImporter_ArcView::getLaneNo(OGRFeature& poFeature, const std::string& edgeid,
402  double speed) {
403  if (myOptions.isSet("shapefile.laneNumber")) {
404  int index = poFeature.GetDefnRef()->GetFieldIndex(myOptions.getString("shapefile.laneNumber").c_str());
405  if (index >= 0 && poFeature.IsFieldSet(index)) {
406  const int laneNumber = poFeature.GetFieldAsInteger(index);
407  if (laneNumber <= 0) {
408  WRITE_WARNING("invalid value for field '"
409  + myOptions.getString("shapefile.laneNumber")
410  + "': '" + std::string(poFeature.GetFieldAsString(index)) + "'");
411  } else {
412  return laneNumber;
413  }
414  }
415  }
416  if (myOptions.isSet("shapefile.type-id")) {
417  return (int) myTypeCont.getNumLanes(poFeature.GetFieldAsString((char*)(myOptions.getString("shapefile.type-id").c_str())));
418  }
419  // try to get definitions as to be found in SUMO-XML-definitions
420  // idea by John Michael Calandrino
421  int index = poFeature.GetDefnRef()->GetFieldIndex("nolanes");
422  if (index >= 0 && poFeature.IsFieldSet(index)) {
423  return (int) poFeature.GetFieldAsInteger(index);
424  }
425  index = poFeature.GetDefnRef()->GetFieldIndex("NOLANES");
426  if (index >= 0 && poFeature.IsFieldSet(index)) {
427  return (int) poFeature.GetFieldAsInteger(index);
428  }
429  index = poFeature.GetDefnRef()->GetFieldIndex("rnol");
430  if (index >= 0 && poFeature.IsFieldSet(index)) {
431  return (int) poFeature.GetFieldAsInteger(index);
432  }
433  index = poFeature.GetDefnRef()->GetFieldIndex("LANE_CAT");
434  if (index >= 0 && poFeature.IsFieldSet(index)) {
435  std::string def = poFeature.GetFieldAsString(index);
436  return NINavTeqHelper::getLaneNumber(edgeid, def, speed);
437  }
438  return 0;
439 }
440 
441 
442 int
443 NIImporter_ArcView::getPriority(OGRFeature& poFeature, const std::string& /*edgeid*/) {
444  if (myOptions.isSet("shapefile.type-id")) {
445  return myTypeCont.getPriority(poFeature.GetFieldAsString((char*)(myOptions.getString("shapefile.type-id").c_str())));
446  }
447  // try to get definitions as to be found in SUMO-XML-definitions
448  // idea by John Michael Calandrino
449  int index = poFeature.GetDefnRef()->GetFieldIndex("priority");
450  if (index >= 0 && poFeature.IsFieldSet(index)) {
451  return poFeature.GetFieldAsInteger(index);
452  }
453  index = poFeature.GetDefnRef()->GetFieldIndex("PRIORITY");
454  if (index >= 0 && poFeature.IsFieldSet(index)) {
455  return poFeature.GetFieldAsInteger(index);
456  }
457  // try to determine priority from NavTechs FUNC_CLASS attribute
458  index = poFeature.GetDefnRef()->GetFieldIndex("FUNC_CLASS");
459  if (index >= 0 && poFeature.IsFieldSet(index)) {
460  return poFeature.GetFieldAsInteger(index);
461  }
462  return 0;
463 }
464 
465 void
466 NIImporter_ArcView::checkSpread(NBEdge* e) {
467  NBEdge* ret = e->getToNode()->getConnectionTo(e->getFromNode());
468  if (ret != 0) {
471  }
472 }
473 
474 bool
475 NIImporter_ArcView::getStringEntry(OGRFeature* poFeature, const std::string& optionName, const char* defaultName, bool prune, std::string& into) {
476  std::string v(defaultName);
477  if (myOptions.isSet(optionName)) {
478  v = myOptions.getString(optionName);
479  }
480  if (poFeature->GetFieldIndex(v.c_str()) < 0) {
481  if (myOptions.isSet(optionName)) {
482  into = v;
483  return false;
484  }
485  into = "";
486  return true;
487  }
488  into = poFeature->GetFieldAsString((char*)v.c_str());
489  if (prune) {
490  into = StringUtils::prune(into);
491  }
492  return true;
493 }
494 
495 std::vector<std::string>
496 NIImporter_ArcView::getFieldNames(OGRFeature* poFeature) const {
497  std::vector<std::string> fields;
498  for (int i = 0; i < poFeature->GetFieldCount(); i++) {
499  fields.push_back(poFeature->GetFieldDefnRef(i)->GetNameRef());
500  }
501  return fields;
502 }
503 
504 void
505 NIImporter_ArcView::addParams(NBEdge* edge, OGRFeature* poFeature, const std::vector<std::string>& params) const {
506  for (const std::string& p : params) {
507  int index = poFeature->GetDefnRef()->GetFieldIndex(p.c_str());
508  if (index >= 0 && poFeature->IsFieldSet(index)) {
509  edge->setParameter(p, poFeature->GetFieldAsString(index));
510  }
511  }
512 }
513 
514 #endif
515 
516 
517 
518 /****************************************************************************/
519 
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:108
int myNameAddition
A running number to assure unique edge ids.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Definition: MsgHandler.cpp:81
double getSpeed(const std::string &type) const
Returns the maximal velocity for the given type [m/s].
Definition: NBTypeCont.cpp:178
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:161
~NIImporter_ArcView()
Destructor.
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
static bool isReadable(std::string path)
Checks whether the given file is readable.
Definition: FileHelpers.cpp:49
static double getSpeed(const std::string &id, const std::string &speedClassS)
Returns the speed evaluating the given Navteq-description.
std::string mySHPName
The name of the shape file.
NBTypeCont & myTypeCont
The container to get the types from.
The representation of a single edge during network building.
Definition: NBEdge.h:86
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given ArcView Shape files.
int getPriority(const std::string &type) const
Returns the priority for the given type.
Definition: NBTypeCont.cpp:184
const OptionsCont & myOptions
The options to use.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:306
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
Definition: NBEdge.cpp:3413
void load()
Loads the shape files.
PositionVector reverse() const
reverse position vector
int getNumLanes(const std::string &type) const
Returns the number of lanes for the given type.
Definition: NBTypeCont.cpp:172
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
double getWidth(const std::string &type) const
Returns the lane width for the given type [m].
Definition: NBTypeCont.cpp:228
NBEdge * getConnectionTo(NBNode *n) const
get connection to certain node
Definition: NBNode.cpp:2161
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool knows(const std::string &type) const
Returns whether the named type is in the container.
Definition: NBTypeCont.cpp:72
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
Definition: NBEdgeCont.cpp:152
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:151
A list of positions.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const std::string & getID() const
Definition: NBEdge.h:1364
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:61
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
Importer for networks stored in ArcView-shape format.
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:241
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:680
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
static std::string replace(std::string str, const char *what, const char *by)
NIImporter_ArcView(const OptionsCont &oc, NBNodeCont &nc, NBEdgeCont &ec, NBTypeCont &tc, const std::string &dbf_name, const std::string &shp_name, bool speedInKMH)
Constructor.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
Definition: StringUtils.cpp:47
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:156
Instance responsible for building networks.
Definition: NBNetBuilder.h:110
NBNodeCont & myNodeCont
The container to add nodes to.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:245
A storage for options typed value containers)
Definition: OptionsCont.h:90
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:79
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge&#39;s lateral offset shal...
int myRunningEdgeID
A running number to assure unique ids (as fallback)
Represents a single node (junction) during network building.
Definition: NBNode.h:68
static int getLaneNumber(const std::string &id, const std::string &laneNoS, double speed)
Returns the lane number evaluating the given Navteq-description.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:479
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:60
NBEdgeCont & myEdgeCont
The container to add edges to.
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:242
bool getIsOneWay(const std::string &type) const
Returns whether edges are one-way per default for the given type.
Definition: NBTypeCont.cpp:190
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:877
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:240
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:486
bool mySpeedInKMH
Whether the speed is given in km/h.
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
Definition: NBTypeCont.cpp:222
A storage for available types of edges.
Definition: NBTypeCont.h:55