diff --git a/src/BuildTiles/Clipper/clipper.cxx b/src/BuildTiles/Clipper/clipper.cxx index 36cadecc..69e6f657 100644 --- a/src/BuildTiles/Clipper/clipper.cxx +++ b/src/BuildTiles/Clipper/clipper.cxx @@ -47,8 +47,10 @@ using std::endl; // Constructor. -TGClipper::TGClipper() { - nudge=0.0; +TGClipper::TGClipper(): + nudge(0.0), + m_ignore_landmass(false) +{ } @@ -461,7 +463,7 @@ bool TGClipper::clip_all(const point2d& min, const point2d& max) { water_mask.erase(); island_mask.erase(); for ( i = 0; i < TG_MAX_AREA_TYPES; i++ ) { - if ( is_landmass_area( i ) ) { + if ( is_landmass_area( i ) && !m_ignore_landmass ) { for ( unsigned j = 0; j < (int)polys_in.polys[i].size(); ++j ) { land_mask = tgPolygonUnion( land_mask, polys_in.polys[i][j] ); @@ -491,7 +493,7 @@ bool TGClipper::clip_all(const point2d& min, const point2d& max) { tmp = current; // if not a hole, clip the area to the land_mask - if ( ! is_hole_area( i ) ) { + if ( !m_ignore_landmass && !is_hole_area( i ) ) { tmp = tgPolygonInt( tmp, land_mask ); } diff --git a/src/BuildTiles/Clipper/clipper.hxx b/src/BuildTiles/Clipper/clipper.hxx index 1fbd9721..bb84e24f 100644 --- a/src/BuildTiles/Clipper/clipper.hxx +++ b/src/BuildTiles/Clipper/clipper.hxx @@ -102,6 +102,16 @@ public: inline TGTriNodes get_fixed_elevations() const { return fixed_elevations; } double nudge; + + bool ignore_landmass() const { + return m_ignore_landmass; + } + + void ignore_landmass(bool b) { + m_ignore_landmass = b; + } +protected: + bool m_ignore_landmass; }; diff --git a/src/BuildTiles/Main/construct.cxx b/src/BuildTiles/Main/construct.cxx index f0c9150e..00e8195f 100644 --- a/src/BuildTiles/Main/construct.cxx +++ b/src/BuildTiles/Main/construct.cxx @@ -29,7 +29,11 @@ // Constructor -TGConstruct::TGConstruct() { } +TGConstruct::TGConstruct(): + useUKGrid(false), + writeSharedEdges(true), + useOwnSharedEdges(false) +{ } // Destructor diff --git a/src/BuildTiles/Main/construct.hxx b/src/BuildTiles/Main/construct.hxx index 1565cd62..942d2b8e 100644 --- a/src/BuildTiles/Main/construct.hxx +++ b/src/BuildTiles/Main/construct.hxx @@ -76,6 +76,9 @@ private: // flag indicating whether the shared edge data of the // tile to be built should be used in addition to neighbour data bool useOwnSharedEdges; + + // flag indicating whether to ignore the landmass + bool ignoreLandmass; // detail level constraints int min_nodes; @@ -145,6 +148,10 @@ public: // own shared edge use flag inline bool get_use_own_shared_edges() const { return useOwnSharedEdges; } inline void set_use_own_shared_edges( const bool b ) { useOwnSharedEdges = b; } + + // ignore landmass flag + inline bool get_ignore_landmass() const { return ignoreLandmass; } + inline void set_ignore_landmass( const bool b) { ignoreLandmass = b; } // detail level constraints inline int get_min_nodes() const { return min_nodes; } diff --git a/src/BuildTiles/Main/main.cxx b/src/BuildTiles/Main/main.cxx index c3ac5ade..542fd841 100644 --- a/src/BuildTiles/Main/main.cxx +++ b/src/BuildTiles/Main/main.cxx @@ -335,6 +335,7 @@ static int load_polys( TGConstruct& c, const TGArray &array ) { int count = 0; clipper.nudge = nudge; + clipper.ignore_landmass( c.get_ignore_landmass() ); // initialize clipper clipper.init(); @@ -1046,6 +1047,7 @@ static void usage( const string name ) { cout << " --useUKgrid" << endl; cout << " --no-write-shared-edges" << endl; cout << " --use-own-shared-edges" << endl; + cout << " --ignore-landmass" << endl; cout << " ] " << endl; exit(-1); } @@ -1075,6 +1077,8 @@ int main(int argc, char **argv) { // tile to be built should be used in addition to neighbour data bool useOwnSharedEdges = false; + bool ignoreLandmass = false; + sglog().setLogLevels( SG_ALL, SG_DEBUG ); // @@ -1112,6 +1116,8 @@ int main(int argc, char **argv) { writeSharedEdges = false; } else if (arg.find("--use-own-shared-edges") == 0) { useOwnSharedEdges = true; + } else if (arg.find("--ignore-landmass") == 0) { + ignoreLandmass = true; } else if (arg.find("--") == 0) { usage(argv[0]); } else { @@ -1186,6 +1192,7 @@ int main(int argc, char **argv) { c.set_useUKGrid( useUKgrid ); c.set_write_shared_edges( writeSharedEdges ); c.set_use_own_shared_edges( useOwnSharedEdges ); + c.set_ignore_landmass( ignoreLandmass ); c.set_min_nodes( 50 ); c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) );