Skip to content

Commit

Permalink
Merge pull request #157 from cvvergara/develop
Browse files Browse the repository at this point in the history
cleaned code from latest changes
  • Loading branch information
cvvergara authored Nov 4, 2016
2 parents 0fbdc24 + 285ae92 commit 837adff
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 101 deletions.
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
* Daniel Wendt (Initial author)
* Jordan Anderson
* J Kishore Kumar
* Luís de Sousa
* Sarthak Agarwal
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ osm2pgRouting 2.2.0
* New mapconfig_for_bicycles.xml
* Improved the C++ code.
* remove the use of pointers to avoid leaks.
* Table `osm_ways_tags` because information is redundant.



Expand Down
28 changes: 0 additions & 28 deletions mapconfig_for_pedestrian.xml

This file was deleted.

32 changes: 0 additions & 32 deletions src/Export2DB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,6 @@ void Export2DB::fill_vertices_table(const std::string &table, const std::string

PGresult* q_result = PQexec(mycon, sql.c_str());
std::cout << "Vertices inserted " << PQcmdTuples(q_result);
#if 0
if (PQresultStatus(q_result) == PGRES_COMMAND_OK)
std::cout << " OK " << PQcmdStatus(q_result) << std::endl;
else
std::cout << " " << PQresultErrorMessage(q_result) << std::endl;
#endif
PQclear(q_result);
}

Expand Down Expand Up @@ -903,12 +897,6 @@ void Export2DB::createFKeys() {
auto vertices_name = ways_name + "_vertices_pgr";


// return; // TODO
/*
ALTER TABLE osm_way_classes
ADD FOREIGN KEY (type_id) REFERENCES osm_way_types (type_id) ON UPDATE NO ACTION ON DELETE NO ACTION;
*/

std::string fk_classes(
"ALTER TABLE " + addSchema("osm_way_classes") + " ADD FOREIGN KEY (type_id) REFERENCES " + addSchema("osm_way_types") + "(type_id)");
PGresult *result = PQexec(mycon, fk_classes.c_str());
Expand All @@ -922,30 +910,10 @@ void Export2DB::createFKeys() {
std::cout << "Foreign keys for " + addSchema("osm_way_classes") + " table created" << std::endl;
}

#if 0
std::string fk_way_tag(
"ALTER TABLE " + addSchema("osm_way_tags") + " ADD FOREIGN KEY (class_id) REFERENCES " + addSchema("osm_way_classes") + "(class_id); " +
"ALTER TABLE " + addSchema("osm_way_tags") + " ADD FOREIGN KEY (way_id) REFERENCES " + addSchema(ways_name) + "(gid); ");
result = PQexec(mycon, fk_way_tag.c_str());
if (PQresultStatus(result) != PGRES_COMMAND_OK) {
std::cerr << PQresultStatus(result);
std::cerr << "foreign keys for " + addSchema("osm_way_tags") + " failed: "
<< PQerrorMessage(mycon)
<< std::endl;
PQclear(result);
} else {
std::cout << "Foreign keys for " + addSchema("osm_way_tags") + " table created" << std::endl;
}
#endif

std::string fk_relations(
"ALTER TABLE " + addSchema(full_table_name("relations_ways")) + " ADD FOREIGN KEY (relation_id) REFERENCES " + addSchema("osm_relations") + "(relation_id); ");
result = PQexec(mycon, fk_relations.c_str());
#if 0
// its not working as there are several ways with the same osm_id
// the gid is not possible because that is "on the fly" sequential
"ALTER TABLE " + addSchema(full_table_name("relations_ways")) + " ADD FOREIGN KEY (way_id) REFERENCES " + addSchema(full_table_name("ways")) + "(osm_id);");
#endif
if (PQresultStatus(result) != PGRES_COMMAND_OK) {
std::cerr << PQresultStatus(result);
std::cerr << "foreign keys for " + addSchema(full_table_name("relations_ways")) + " failed: "
Expand Down
41 changes: 1 addition & 40 deletions src/osm2pgrouting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,6 @@
#include "./Export2DB.h"
#include "./prog_options.h"

#if 0
static
size_t lines_in_file(const std::string file_name) {
FILE *in;
char buff[512];
std::string command = "wc -l " + file_name;

if (!(in = popen(command.c_str(), "r"))) {
exit(1);
}

std::string word;
if (fgets(buff, 512, in) != NULL) {
word = buff;
}
pclose(in);
std::istringstream iss(word);
std::string number;
iss >> number;

return boost::lexical_cast<size_t>(number);
}
#endif

int main(int argc, char* argv[]) {
#ifdef WITH_TIME
Expand All @@ -74,9 +51,7 @@ int main(int argc, char* argv[]) {
std::chrono::steady_clock::time_point begin_elapsed =
std::chrono::steady_clock::now();
#endif
#if 1
try {
#endif
po::options_description od_desc("Allowed options");
get_option_description(od_desc);

Expand Down Expand Up @@ -141,15 +116,7 @@ int main(int argc, char* argv[]) {
}

size_t total_lines = 100000;
#if 0
auto total_lines = lines_in_file(dataFile);

std::cout << "Opening data file: "
<< dataFile
<< " total lines "
<< total_lines
<< endl;
#endif

osm2pgr::OSMDocument document(config, total_lines);
osm2pgr::OSMDocumentParserCallback callback(document);

Expand Down Expand Up @@ -187,10 +154,6 @@ int main(int argc, char* argv[]) {
dbConnection.exportRelations(document.relations(), config);
std::cout << "\nExport RelationsWays ..." << endl;
dbConnection.exportRelationsWays(document.relations(), config);
#if 0
std::cout << "\nexport Tags ..." << endl;
dbConnection.exportTags(document.m_SplitWays, config);
#endif
std::cout << "\nExport Ways ..." << endl;
dbConnection.exportWays(document.ways(), config);

Expand Down Expand Up @@ -228,7 +191,6 @@ int main(int argc, char* argv[]) {

std::cout << "#########################" << endl;
return 0;
#if 1
}
catch (exception &e) {
std::cout << e.what() << endl;
Expand All @@ -242,5 +204,4 @@ int main(int argc, char* argv[]) {
std::cout << "Terminating" << endl;
return 1;
}
#endif
}
2 changes: 1 addition & 1 deletion tools/spelling/fix_typos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ EXCLUDED_FILES="$EXCLUDED_FILES,*/tools/*"
#WORDS_WHITE_LIST="$WORDS_WHITE_LIST,THRESHHOLD_BILEVEL,THRESHHOLD_HALFTONE,THRESHHOLD_ERRORDIFFUSE"

python3 fix_typos/codespell/codespell.py -w -i 3 -q 2 -S $EXCLUDED_FILES \
-x tools/scripts/typos_whitelist.txt --words-white-list=$WORDS_WHITE_LIST \
-x tools/spelling/typos_whitelist.txt --words-white-list=$WORDS_WHITE_LIST \
-D fix_typos/gdal_dict.txt .

0 comments on commit 837adff

Please sign in to comment.