Skip to content

Commit 837adff

Browse files
authored
Merge pull request #157 from cvvergara/develop
cleaned code from latest changes
2 parents 0fbdc24 + 285ae92 commit 837adff

File tree

6 files changed

+4
-101
lines changed

6 files changed

+4
-101
lines changed

Diff for: AUTHORS.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
* Daniel Wendt (Initial author)
1515
* Jordan Anderson
1616
* J Kishore Kumar
17+
* Luís de Sousa
1718
* Sarthak Agarwal

Diff for: NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ osm2pgRouting 2.2.0
55
* New mapconfig_for_bicycles.xml
66
* Improved the C++ code.
77
* remove the use of pointers to avoid leaks.
8+
* Table `osm_ways_tags` because information is redundant.
89

910

1011

Diff for: mapconfig_for_pedestrian.xml

-28
This file was deleted.

Diff for: src/Export2DB.cpp

-32
Original file line numberDiff line numberDiff line change
@@ -425,12 +425,6 @@ void Export2DB::fill_vertices_table(const std::string &table, const std::string
425425

426426
PGresult* q_result = PQexec(mycon, sql.c_str());
427427
std::cout << "Vertices inserted " << PQcmdTuples(q_result);
428-
#if 0
429-
if (PQresultStatus(q_result) == PGRES_COMMAND_OK)
430-
std::cout << " OK " << PQcmdStatus(q_result) << std::endl;
431-
else
432-
std::cout << " " << PQresultErrorMessage(q_result) << std::endl;
433-
#endif
434428
PQclear(q_result);
435429
}
436430

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

905899

906-
// return; // TODO
907-
/*
908-
ALTER TABLE osm_way_classes
909-
ADD FOREIGN KEY (type_id) REFERENCES osm_way_types (type_id) ON UPDATE NO ACTION ON DELETE NO ACTION;
910-
*/
911-
912900
std::string fk_classes(
913901
"ALTER TABLE " + addSchema("osm_way_classes") + " ADD FOREIGN KEY (type_id) REFERENCES " + addSchema("osm_way_types") + "(type_id)");
914902
PGresult *result = PQexec(mycon, fk_classes.c_str());
@@ -922,30 +910,10 @@ void Export2DB::createFKeys() {
922910
std::cout << "Foreign keys for " + addSchema("osm_way_classes") + " table created" << std::endl;
923911
}
924912

925-
#if 0
926-
std::string fk_way_tag(
927-
"ALTER TABLE " + addSchema("osm_way_tags") + " ADD FOREIGN KEY (class_id) REFERENCES " + addSchema("osm_way_classes") + "(class_id); " +
928-
"ALTER TABLE " + addSchema("osm_way_tags") + " ADD FOREIGN KEY (way_id) REFERENCES " + addSchema(ways_name) + "(gid); ");
929-
result = PQexec(mycon, fk_way_tag.c_str());
930-
if (PQresultStatus(result) != PGRES_COMMAND_OK) {
931-
std::cerr << PQresultStatus(result);
932-
std::cerr << "foreign keys for " + addSchema("osm_way_tags") + " failed: "
933-
<< PQerrorMessage(mycon)
934-
<< std::endl;
935-
PQclear(result);
936-
} else {
937-
std::cout << "Foreign keys for " + addSchema("osm_way_tags") + " table created" << std::endl;
938-
}
939-
#endif
940913

941914
std::string fk_relations(
942915
"ALTER TABLE " + addSchema(full_table_name("relations_ways")) + " ADD FOREIGN KEY (relation_id) REFERENCES " + addSchema("osm_relations") + "(relation_id); ");
943916
result = PQexec(mycon, fk_relations.c_str());
944-
#if 0
945-
// its not working as there are several ways with the same osm_id
946-
// the gid is not possible because that is "on the fly" sequential
947-
"ALTER TABLE " + addSchema(full_table_name("relations_ways")) + " ADD FOREIGN KEY (way_id) REFERENCES " + addSchema(full_table_name("ways")) + "(osm_id);");
948-
#endif
949917
if (PQresultStatus(result) != PGRES_COMMAND_OK) {
950918
std::cerr << PQresultStatus(result);
951919
std::cerr << "foreign keys for " + addSchema(full_table_name("relations_ways")) + " failed: "

Diff for: src/osm2pgrouting.cpp

+1-40
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,6 @@
3838
#include "./Export2DB.h"
3939
#include "./prog_options.h"
4040

41-
#if 0
42-
static
43-
size_t lines_in_file(const std::string file_name) {
44-
FILE *in;
45-
char buff[512];
46-
std::string command = "wc -l " + file_name;
47-
48-
if (!(in = popen(command.c_str(), "r"))) {
49-
exit(1);
50-
}
51-
52-
std::string word;
53-
if (fgets(buff, 512, in) != NULL) {
54-
word = buff;
55-
}
56-
pclose(in);
57-
std::istringstream iss(word);
58-
std::string number;
59-
iss >> number;
60-
61-
return boost::lexical_cast<size_t>(number);
62-
}
63-
#endif
6441

6542
int main(int argc, char* argv[]) {
6643
#ifdef WITH_TIME
@@ -74,9 +51,7 @@ int main(int argc, char* argv[]) {
7451
std::chrono::steady_clock::time_point begin_elapsed =
7552
std::chrono::steady_clock::now();
7653
#endif
77-
#if 1
7854
try {
79-
#endif
8055
po::options_description od_desc("Allowed options");
8156
get_option_description(od_desc);
8257

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

143118
size_t total_lines = 100000;
144-
#if 0
145-
auto total_lines = lines_in_file(dataFile);
146-
147-
std::cout << "Opening data file: "
148-
<< dataFile
149-
<< " total lines "
150-
<< total_lines
151-
<< endl;
152-
#endif
119+
153120
osm2pgr::OSMDocument document(config, total_lines);
154121
osm2pgr::OSMDocumentParserCallback callback(document);
155122

@@ -187,10 +154,6 @@ int main(int argc, char* argv[]) {
187154
dbConnection.exportRelations(document.relations(), config);
188155
std::cout << "\nExport RelationsWays ..." << endl;
189156
dbConnection.exportRelationsWays(document.relations(), config);
190-
#if 0
191-
std::cout << "\nexport Tags ..." << endl;
192-
dbConnection.exportTags(document.m_SplitWays, config);
193-
#endif
194157
std::cout << "\nExport Ways ..." << endl;
195158
dbConnection.exportWays(document.ways(), config);
196159

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

229192
std::cout << "#########################" << endl;
230193
return 0;
231-
#if 1
232194
}
233195
catch (exception &e) {
234196
std::cout << e.what() << endl;
@@ -242,5 +204,4 @@ int main(int argc, char* argv[]) {
242204
std::cout << "Terminating" << endl;
243205
return 1;
244206
}
245-
#endif
246207
}

Diff for: tools/spelling/fix_typos.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ EXCLUDED_FILES="$EXCLUDED_FILES,*/tools/*"
6262
#WORDS_WHITE_LIST="$WORDS_WHITE_LIST,THRESHHOLD_BILEVEL,THRESHHOLD_HALFTONE,THRESHHOLD_ERRORDIFFUSE"
6363

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

0 commit comments

Comments
 (0)