Skip to content

Commit 2f01a3c

Browse files
authored
Merge pull request #897 from lonvia/cleanup-osmdata
osmdata: remove unused projection member
2 parents 4cf7acc + 0d6a9b3 commit 2f01a3c

23 files changed

+35
-47
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ matrix:
7474
env: T="osx_clang_NoDB" LUAJIT_OPTION="OFF" TEST_NODB=1
7575
CXXFLAGS="-pedantic -Werror"
7676
before_install:
77-
- brew install lua;
77+
- brew install lua; brew install lua
7878
before_script:
7979
- xml2-config --version
8080
- proj | head -n1

osm2pgsql.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
6969
}
7070

7171
//let osmdata orchestrate between the middle and the outs
72-
osmdata_t osmdata(middle, outputs, options.projection);
72+
osmdata_t osmdata(middle, outputs);
7373

7474
fprintf(stderr, "Using projection SRS %d (%s)\n",
7575
options.projection->target_srs(),

osmdata.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@
1414
#include "output.hpp"
1515

1616
osmdata_t::osmdata_t(std::shared_ptr<middle_t> mid_,
17-
std::shared_ptr<output_t> const &out_,
18-
std::shared_ptr<reprojection> proj)
19-
: mid(mid_), projection(proj)
17+
std::shared_ptr<output_t> const &out_)
18+
: mid(mid_)
2019
{
2120
outs.push_back(out_);
2221
with_extra = outs[0]->get_options()->extra_attributes;
2322
}
2423

2524
osmdata_t::osmdata_t(std::shared_ptr<middle_t> mid_,
26-
std::vector<std::shared_ptr<output_t> > const &outs_,
27-
std::shared_ptr<reprojection> proj)
28-
: mid(mid_), outs(outs_), projection(proj)
25+
std::vector<std::shared_ptr<output_t>> const &outs_)
26+
: mid(mid_), outs(outs_)
2927
{
3028
if (outs.empty()) {
3129
throw std::runtime_error("Must have at least one output, but none have "
@@ -35,10 +33,6 @@ osmdata_t::osmdata_t(std::shared_ptr<middle_t> mid_,
3533
with_extra = outs[0]->get_options()->extra_attributes;
3634
}
3735

38-
osmdata_t::~osmdata_t()
39-
{
40-
}
41-
4236
int osmdata_t::node_add(osmium::Node const &node)
4337
{
4438
mid->nodes_set(node);
@@ -425,12 +419,12 @@ void osmdata_t::stop() {
425419
}
426420

427421
// should be the same for all outputs
428-
const bool append = outs[0]->get_options()->append;
422+
auto *opts = outs[0]->get_options();
429423

430424
{
431425
//threaded pending processing
432-
pending_threaded_processor ptp(
433-
mid, outs, outs[0]->get_options()->num_procs, append);
426+
pending_threaded_processor ptp(mid, outs, opts->num_procs,
427+
opts->append);
434428

435429
if (!outs.empty()) {
436430
//This stage takes ways which were processed earlier, but might be
@@ -449,7 +443,6 @@ void osmdata_t::stop() {
449443
// Clustering, index creation, and cleanup.
450444
// All the intensive parts of this are long-running PostgreSQL commands
451445
{
452-
auto *opts = outs[0]->get_options();
453446
osmium::thread::Pool pool(opts->parallel_indexing ? opts->num_procs : 1,
454447
512);
455448

osmdata.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@ class osmdata_t
1818
{
1919
public:
2020
osmdata_t(std::shared_ptr<middle_t> mid_,
21-
std::shared_ptr<output_t> const &out_,
22-
std::shared_ptr<reprojection> proj);
21+
std::shared_ptr<output_t> const &out_);
2322
osmdata_t(std::shared_ptr<middle_t> mid_,
24-
std::vector<std::shared_ptr<output_t> > const &outs_,
25-
std::shared_ptr<reprojection> proj);
26-
~osmdata_t();
23+
std::vector<std::shared_ptr<output_t>> const &outs_);
2724

2825
void start();
2926
void type_changed(osmium::item_type new_type);
@@ -44,7 +41,6 @@ class osmdata_t
4441
private:
4542
std::shared_ptr<middle_t> mid;
4643
std::vector<std::shared_ptr<output_t> > outs;
47-
std::shared_ptr<reprojection> projection;
4844
bool with_extra;
4945
};
5046

tests/fixture-tablespace-cleanup

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ BASEDIR=`pwd`
66

77
TBLDIR=${BASEDIR}/osm2pgsql-test-tablespace
88

9-
if find $TBLDIR -maxdepth 1 -mindepth 1 -type d -name 'PG*'; then
10-
rm -r $TBLDIR/PG*
9+
if [ -d "$TBLDIR" ]; then
10+
find $TBLDIR -maxdepth 1 -mindepth 1 -type d -name 'PG*' -delete
1111
fi

tests/test-hstore-match-only.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ int main(int argc, char *argv[]) {
5555

5656
auto out_test = std::make_shared<output_pgsql_t>(mid_pgsql.get(), options);
5757

58-
osmdata_t osmdata(mid_pgsql, out_test, options.projection);
58+
osmdata_t osmdata(mid_pgsql, out_test);
5959

6060
testing::parse("tests/hstore-match-only.osm", "xml",
6161
options, &osmdata);

tests/test-options-projection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void check_tables(pg::tempdb *db, options_t &options,
4545
options.database_options = db->database_options;
4646
auto mid_ram = std::make_shared<middle_ram_t>();
4747
auto out_test = std::make_shared<output_pgsql_t>(mid_ram.get(), options);
48-
osmdata_t osmdata(mid_ram, out_test, options.projection);
48+
osmdata_t osmdata(mid_ram, out_test);
4949

5050
testing::parse("tests/liechtenstein-2013-08-03.osm.pbf", "pbf",
5151
options, &osmdata);

tests/test-output-multi-line-storage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main(int argc, char *argv[]) {
5151
std::vector<std::shared_ptr<output_t> > outputs = output_t::create_outputs(middle.get(), options);
5252

5353
//let osmdata orchestrate between the middle and the outs
54-
osmdata_t osmdata(middle, outputs, options.projection);
54+
osmdata_t osmdata(middle, outputs);
5555

5656
testing::parse("tests/test_output_multi_line_storage.osm", "xml",
5757
options, &osmdata);

tests/test-output-multi-line.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int main(int argc, char *argv[]) {
4949
// This actually uses the multi-backend with C transforms, not Lua transforms. This is unusual and doesn't reflect real practice
5050
auto out_test = std::make_shared<output_multi_t>("foobar_highways", processor, columns, mid_pgsql.get(), options);
5151

52-
osmdata_t osmdata(mid_pgsql, out_test, options.projection);
52+
osmdata_t osmdata(mid_pgsql, out_test);
5353

5454
testing::parse("tests/liechtenstein-2013-08-03.osm.pbf", "pbf",
5555
options, &osmdata);

tests/test-output-multi-point-multi-table.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
5858
outputs.push_back(out_test);
5959
}
6060

61-
osmdata_t osmdata(mid_pgsql, outputs, options.projection);
61+
osmdata_t osmdata(mid_pgsql, outputs);
6262

6363
testing::parse("tests/liechtenstein-2013-08-03.osm.pbf", "pbf",
6464
options, &osmdata);

0 commit comments

Comments
 (0)