60 #ifdef CHECK_MEMORY_LEAKS 62 #endif // CHECK_MEMORY_LEAKS 71 oc.
addCallExample(
"-c <CONFIGURATION>",
"create net from given configuration");
72 oc.
addCallExample(
"--grid [grid-network options] -o <OUTPUTFILE>",
"create grid net");
73 oc.
addCallExample(
"--spider [spider-network options] -o <OUTPUTFILE>",
"create spider net");
74 oc.
addCallExample(
"--rand [random-network options] -o <OUTPUTFILE>",
"create random net");
76 oc.
setAdditionalHelpMessage(
" Either \"--grid\", \"--spider\" or \"--rand\" must be supplied.\n In dependance to these switches other options are used.");
96 oc.
addSynonyme(
"default-junction-type",
"junctions");
97 oc.
addDescription(
"default-junction-type",
"Building Defaults",
"[traffic_light|priority|right_before_left] Determines the type of the build junctions");
117 bool hadError =
false;
118 if (oc.
getInt(
"spider.arm-number") < 3) {
119 WRITE_ERROR(
"Spider networks need at least 3 arms.");
122 if (oc.
getInt(
"spider.circle-number") < 1) {
123 WRITE_ERROR(
"Spider networks need at least one circle.");
126 if (oc.
getFloat(
"spider.space-radius") < 10) {
127 WRITE_ERROR(
"The radius of spider networks must be at least 10m.");
136 oc.
getFloat(
"spider.space-radius"), !oc.
getBool(
"spider.omit-center"));
142 int xNo = oc.
getInt(
"grid.x-number");
143 int yNo = oc.
getInt(
"grid.y-number");
148 xNo = oc.
getInt(
"grid.number");
151 yNo = oc.
getInt(
"grid.number");
154 xLength = oc.
getFloat(
"grid.length");
157 yLength = oc.
getFloat(
"grid.length");
160 bool hadError =
false;
161 if (xNo < 2 || yNo < 2) {
162 WRITE_ERROR(
"The number of nodes must be at least 2 in both directions.");
165 if (xLength < 10. || yLength < 10.) {
166 WRITE_ERROR(
"The distance between nodes must be at least 10m in both directions.");
169 if (attachLength != 0.0 && attachLength < 10.) {
170 WRITE_ERROR(
"The length of attached streets must be at least 10m.");
173 const bool alphaIDs = oc.
getBool(
"grid.alphanumerical-ids");
174 if (alphaIDs && xNo > 26) {
175 WRITE_ERROR(
"There must be at most 26 nodes in the x-direction when using alphanumerical ids.");
189 neighborDist.
add(1, oc.
getFloat(
"rand.neighbor-dist1"));
190 neighborDist.
add(2, oc.
getFloat(
"rand.neighbor-dist2"));
191 neighborDist.
add(3, oc.
getFloat(
"rand.neighbor-dist3"));
192 neighborDist.
add(4, oc.
getFloat(
"rand.neighbor-dist4"));
193 neighborDist.
add(5, oc.
getFloat(
"rand.neighbor-dist5"));
194 neighborDist.
add(6, oc.
getFloat(
"rand.neighbor-dist6"));
201 oc.
getInt(
"rand.num-tries"),
251 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
257 }
catch (
const std::exception& e) {
258 if (std::string(e.what()) != std::string(
"")) {
270 std::cout <<
"Success." << std::endl;
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
void add(int numNeighbours, SUMOReal ratio)
adds a neighbour item to list
static void insertRandOptions()
Initialises the given options container with random number options.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
void resetWritable()
Resets all options to be writeable.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
int size() const
Returns the number of edges.
int main(int argc, char **argv)
void createNet(int numNodes)
Builds a NGNet using the set values.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
void compute(OptionsCont &oc, const std::set< std::string > &explicitTurnarounds=std::set< std::string >(), bool removeElements=true)
Performs the network building steps.
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
NGNet * buildNetwork(NBNetBuilder &nb)
void toNB() const
Converts the stored network into its netbuilder-representation.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static void close()
Closes all of an applications subsystems.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
A class that stores a 2D geometrical boundary.
void createChequerBoard(int numX, int numY, SUMOReal spaceX, SUMOReal spaceY, SUMOReal attachLength, bool alphaIDs)
Creates a grid network.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static OptionsCont & getOptions()
Retrieves the options.
static void initRandGlobal(MTRand *which=0)
Reads the given random number options and initialises the random number generator in accordance...
void applyOptions(OptionsCont &oc)
Initialises the storage by applying given options.
void createSpiderWeb(int numRadDiv, int numCircles, SUMOReal spaceRad, bool hasCenter)
Creates a spider network.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
A point in 2D or 3D with translation and scaling methods.
void setAdditionalHelpMessage(const std::string &add)
Sets an additional message to be printed at the begin of the help screen.
NBEdgeCont & getEdgeCont()
Returns the edge container.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
static bool checkOptions()
Checks set options from the OptionsCont-singleton for being valid.
static bool init(OptionsCont &oc)
Initialises the processing and the final instance using the given options.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
The class storing the generated network.
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network stored in the given net builder.
NBNodeCont & getNodeCont()
Returns the node container.
Instance responsible for building networks.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
static void fillOptions()
Inserts options used by the network generator.
static void fillOptions(bool forNetgen)
Inserts options used by the network converter.
int size() const
Returns the number of known nodes.
A class that builds random network using an algorithm by Markus Hartinger.
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
static void fillOptions(bool forNetgen)
Inserts options used by the network writer.
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
#define WRITE_MESSAGE(msg)
static void initOutputOptions()
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.