/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2002-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file NIImporter_ArcView.h14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @author Jakob Erdmann17/// @date Sept 200218///19// Importer for networks stored in ArcView-shape format20/****************************************************************************/21#pragma once22#include <config.h>2324#include <string>252627// ===========================================================================28// class declarations29// ===========================================================================30class OptionsCont;31class OGRFeature;323334// ===========================================================================35// class definitions36// ===========================================================================37/**38* @class NIImporter_ArcView39* @brief Importer for networks stored in ArcView-shape format40*41* The current importer works only if SUMO was compiled with GDAL-support.42* If not, an error message is generated.43*44* @todo reinsert import via shapelib45*/46class NIImporter_ArcView {47public:48/** @brief Loads content of the optionally given ArcView Shape files49*50* If the option "shapefile-prefix" is set, the file stored therein is read and51* the network definition stored therein is stored within the given network52* builder.53*54* If the option "shapefile-prefix" is not set, this method simply returns.55*56* @param[in] oc The options to use57* @param[in] nb The network builder to fill58*/59static void loadNetwork(const OptionsCont& oc, NBNetBuilder& nb);606162protected:63/** @brief Constructor64* @param[in] oc Options container to read options from65* @param[in] nc The node container to store nodes into66* @param[in] ec The edge container to store edges into67* @param[in] tc The type container to get edge types from68* @param[in] shp_name The name of the according shape file69* @param[in] speedInKMH Whether the speed shall be assumed to be given in km/h70*/71NIImporter_ArcView(const OptionsCont& oc,72NBNodeCont& nc, NBEdgeCont& ec, NBTypeCont& tc,73const std::string& shp_name,74bool speedInKMH);7576/// @brief Destructor77~NIImporter_ArcView();787980/** @brief Loads the shape files81*/82void load();838485private:86#ifdef HAVE_GDAL87/** @brief Parses the maximum speed allowed on the edge currently processed88* @param[in] f The entry to read the speed from89* @param[in] edgeid The id of the edge for error output90*/91double getSpeed(OGRFeature& f, const std::string& edgeid);9293/** @brief Parses the width off the edge currently processed94* @param[in] f The entry to read the swidth from95* @param[in] edgeid The id of the edge for error output96*/97double getLaneWidth(OGRFeature& f, const std::string& edgeid, int laneNumber);9899/** @brief Parses a custom length for the edge currently processed100* @param[in] f The entry to read the length from101* @param[in] edgeid The id of the edge for error output102*/103double getLength(OGRFeature& f, const std::string& edgeid);104105/** @brief Parses the number of lanes of the edge currently processed106* @param[in] f The entry to read the lane number from107* @param[in] edgeid The id of the edge for error output108* @param[in] speed The edge's speed used to help determinig the edge's lane number109*/110int getLaneNo(OGRFeature& f,111const std::string& edgeid, double speed);112113/** @brief Parses the priority of the edge currently processed114* @param[in] f The entry to read the priority from115* @param[in] edgeid The id of the edge for error output116*/117int getPriority(OGRFeature& f, const std::string& edgeid);118119120/** @brief Checks whether the lane spread shall be changed121*122* If for the given edge an edge into the vice direction is already123* stored, both edges' lane spread functions are set to LaneSpreadFunction::RIGHT.124*125* @param[in] e The edge to check126*/127void checkSpread(NBEdge* e);128129130/** @brief Sets the value from the named field into "into"131*132* If the field's name was set on the command line, the value is tried to be retrieved, returning true on success.133* If it cannot be retrieved, false is retuned, and the field's name is inserted into "into".134*135* If no field name was given, the standard value (defaultName) is used. In this case, an empty string is returned136* if the field does not exist.137* @param[in] poFeature The feature to read from138* @param[in] optionName The name of the option at which an optional field name is stored139* @param[in] defaultName The field's default name140* @param[in] prune Whether the value shall be prunned141* @param[out] into The read value/missing field is stored here142*/143bool getStringEntry(OGRFeature* poFeature, const std::string& optionName, const char* defaultName, bool prune, std::string& into);144145/// @brief return all fields support by the given feature146std::vector<std::string> getFieldNames(OGRFeature* poFeature) const;147148/// @brief add list of parameters to edge149void addParams(NBEdge* edge, OGRFeature* poFeature, const std::vector<std::string>& params) const;150151#endif152153private:154/// @brief The options to use155const OptionsCont& myOptions;156157/// @brief The name of the shape file158std::string mySHPName;159160/// @brief A running number to assure unique edge ids161int myNameAddition;162163/// @brief The container to add nodes to164NBNodeCont& myNodeCont;165166/// @brief The container to add edges to167NBEdgeCont& myEdgeCont;168169/// @brief The container to get the types from170NBTypeCont& myTypeCont;171172/// @brief Whether the speed is given in km/h173bool mySpeedInKMH;174175/// @brief A running number to assure unique ids (as fallback)176int myRunningEdgeID;177int myRunningNodeID;178179180private:181/// @brief Invalidated copy constructor.182NIImporter_ArcView(const NIImporter_ArcView&);183184/// @brief Invalidated assignment operator.185NIImporter_ArcView& operator=(const NIImporter_ArcView&);186187};188189190