61 oc.
addCallExample(
"-c <CONFIGURATION>",
"create net from given configuration");
62 oc.
addCallExample(
"--grid [grid-network options] -o <OUTPUTFILE>",
"create grid net");
63 oc.
addCallExample(
"--spider [spider-network options] -o <OUTPUTFILE>",
"create spider net");
64 oc.
addCallExample(
"--rand [random-network options] -o <OUTPUTFILE>",
"create random net");
66 oc.
setAdditionalHelpMessage(
" Either \"--grid\", \"--spider\" or \"--rand\" must be supplied.\n In dependence to these switches other options are used.");
89 oc.
addSynonyme(
"default-junction-type",
"junctions");
90 oc.
addDescription(
"default-junction-type",
"Building Defaults",
TL(
"[traffic_light|priority|right_before_left|left_before_right|traffic_light_right_on_red|priority_stop|allway_stop|...] Determines junction type (see wiki/Networks/PlainXML#Node_types)"));
94 oc.
addDescription(
"tls.discard-simple",
"TLS Building",
"Does not instantiate traffic lights at geometry-like nodes");
97 oc.
addDescription(
"railway.signal.permit-unsignalized",
"TLS Building",
TL(
"List rail classes that may run without rail signals"));
117 double minLength = (oc.
getInt(
"default.lanenumber") + oc.
getInt(
"turn-lanes")) * 2 * laneWidth + oc.
getFloat(
"default.junctions.radius") * 2 + POSITION_EPS;
121 bool hadError =
false;
122 if (oc.
getInt(
"spider.arm-number") < 3) {
126 if (oc.
getInt(
"spider.arm-number") > 4 && !oc.
getBool(
"spider.omit-center")) {
127 WRITE_WARNING(
TL(
"Spider networks with many arms should use option spider.omit-center"));
129 if (oc.
getInt(
"spider.circle-number") < 1) {
130 WRITE_ERROR(
TL(
"Spider networks need at least one circle."));
133 minLength =
MAX2(minLength, laneWidth * 2 *
MAX2(oc.
getInt(
"spider.arm-number"), 3) / (2 *
M_PI));
134 if (oc.
getFloat(
"spider.space-radius") < POSITION_EPS) {
137 }
else if (oc.
getFloat(
"spider.space-radius") < minLength) {
138 WRITE_WARNINGF(
TL(
"The radius of spider networks should be at least % for the given lanenumber, lanewidth and junction radius"),
toString(minLength));
147 oc.
getFloat(
"spider.attach-length"));
153 int xNo = oc.
getInt(
"grid.x-number");
154 int yNo = oc.
getInt(
"grid.y-number");
155 double xLength = oc.
getFloat(
"grid.x-length");
156 double yLength = oc.
getFloat(
"grid.y-length");
157 double xAttachLength = oc.
getFloat(
"grid.x-attach-length");
158 double yAttachLength = oc.
getFloat(
"grid.y-attach-length");
160 xNo = oc.
getInt(
"grid.number");
163 yNo = oc.
getInt(
"grid.number");
166 xLength = oc.
getFloat(
"grid.length");
169 yLength = oc.
getFloat(
"grid.length");
172 xAttachLength = oc.
getFloat(
"grid.attach-length");
175 yAttachLength = oc.
getFloat(
"grid.attach-length");
178 bool hadError =
false;
179 if (xNo < 1 || yNo < 1 || (xAttachLength == 0 && yAttachLength == 0 && (xNo < 2 && yNo < 2))) {
180 WRITE_ERROR(
TL(
"The number of nodes must be positive and at least 2 in one direction if there are no attachments."));
183 const double minAttachLength = minLength / 2 + POSITION_EPS / 2;
184 if (xLength < POSITION_EPS || yLength < POSITION_EPS) {
187 }
else if (xLength < minLength || yLength < minLength) {
188 WRITE_WARNINGF(
TL(
"The distance between nodes should be at least % for the given lanenumber, lanewidth and junction radius"),
toString(minLength));
190 if (xAttachLength != 0.0 && xAttachLength < POSITION_EPS) {
193 }
else if (xAttachLength != 0.0 && xAttachLength < minAttachLength) {
194 WRITE_WARNINGF(
TL(
"The length of attached streets should be at least % for the given lanenumber, lanewidth and junction radius"),
toString(minAttachLength));
195 }
else if (yAttachLength != 0.0 && yAttachLength < POSITION_EPS) {
198 }
else if (yAttachLength != 0.0 && yAttachLength < minAttachLength) {
199 WRITE_WARNINGF(
TL(
"The length of attached streets should be at least % for the given lanenumber, lanewidth and junction radius"),
toString(minAttachLength));
211 neighborDist.
add(1, oc.
getFloat(
"rand.neighbor-dist1"));
212 neighborDist.
add(2, oc.
getFloat(
"rand.neighbor-dist2"));
213 neighborDist.
add(3, oc.
getFloat(
"rand.neighbor-dist3"));
214 neighborDist.
add(4, oc.
getFloat(
"rand.neighbor-dist4"));
215 neighborDist.
add(5, oc.
getFloat(
"rand.neighbor-dist5"));
216 neighborDist.
add(6, oc.
getFloat(
"rand.neighbor-dist6"));
223 oc.
getInt(
"rand.num-tries"),
235 oc.
setApplicationName(
"netgenerate",
"Eclipse SUMO netgenerate Version " VERSION_STRING);
258 if (oc.
isSet(
"type-files")) {
273 if (oc.
getBool(
"tls.discard-simple")) {
284 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
290 }
catch (
const std::exception& e) {
291 if (std::string(e.what()) != std::string(
"")) {
303 std::cout <<
"Success." << std::endl;
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGEF(...)
#define WRITE_MESSAGE(msg)
#define WRITE_WARNING(msg)
const double SUMO_const_laneWidth
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static void initOutputOptions()
init output options
int size() const
Returns the number of edges.
static void fillOptions(OptionsCont &oc, bool forNetgen)
Inserts options used by the network converter.
static bool checkOptions(OptionsCont &oc)
Checks set options from the OptionsCont-singleton for being valid.
Instance responsible for building networks.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool mayAddOrRemove=true)
Performs the network building steps.
int size() const
Returns the number of nodes stored in this container.
void printBuiltNodesStatistics() const
Prints statistics about built nodes.
void discardTrafficLights(NBTrafficLightLogicCont &tlc, bool geometryLike)
int getNumExtracted() const
return the number of extracted traffic light definitions
static void fillOptions()
Inserts options used by the network generator.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
The class storing the generated network.
void toNB() const
Converts the stored network into its netbuilder-representation.
void createChequerBoard(int numX, int numY, double spaceX, double spaceY, double xAttachLength, double yAttachLength)
Creates a grid network.
void createSpiderWeb(int numRadDiv, int numCircles, double spaceRad, bool hasCenter, double attachLength)
Creates a spider network.
A class that builds random network using an algorithm by Markus Hartinger.
void createNet(int numNodes, bool gridMode)
Builds a NGNet using the set values.
static bool load(SUMOSAXHandler &handler, const std::vector< std::string > &files, const std::string &type, const bool stringParse=false)
Importer for edge type information stored in XML.
static void fillOptions(OptionsCont &oc, bool forNetgen)
Inserts options used by the network writer.
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network stored in the given net builder.
static bool checkOptions(OptionsCont &oc)
Checks set options for being valid.
A storage for options typed value containers)
void setAdditionalHelpMessage(const std::string &add)
Sets an additional message to be printed at the begin of the help screen.
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
void resetWritable()
Resets all options to be writeable.
static OptionsCont & getOptions()
Retrieves the options.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
A point in 2D or 3D with translation and scaling methods.
static void insertRandOptions(OptionsCont &oc)
Initialises the given options container with random number options.
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
Represents a generic random distribution.
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
static void close()
Closes all of an applications subsystems.
static bool checkOptions(OptionsCont &oc)
checks shared options and sets StdDefs
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
static void init()
Initialises the xml-subsystem.
int main(int argc, char **argv)
NGNet * buildNetwork(NBNetBuilder &nb)