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