Add an option to fgfs-construct to disable landmass processing (closes #9).
This commit is contained in:
parent
3a83772a09
commit
84cb4efe79
5 changed files with 35 additions and 5 deletions
|
@ -47,8 +47,10 @@ using std::endl;
|
||||||
|
|
||||||
|
|
||||||
// Constructor.
|
// Constructor.
|
||||||
TGClipper::TGClipper() {
|
TGClipper::TGClipper():
|
||||||
nudge=0.0;
|
nudge(0.0),
|
||||||
|
m_ignore_landmass(false)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -461,7 +463,7 @@ bool TGClipper::clip_all(const point2d& min, const point2d& max) {
|
||||||
water_mask.erase();
|
water_mask.erase();
|
||||||
island_mask.erase();
|
island_mask.erase();
|
||||||
for ( i = 0; i < TG_MAX_AREA_TYPES; i++ ) {
|
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 ) {
|
for ( unsigned j = 0; j < (int)polys_in.polys[i].size(); ++j ) {
|
||||||
land_mask =
|
land_mask =
|
||||||
tgPolygonUnion( land_mask, polys_in.polys[i][j] );
|
tgPolygonUnion( land_mask, polys_in.polys[i][j] );
|
||||||
|
@ -491,7 +493,7 @@ bool TGClipper::clip_all(const point2d& min, const point2d& max) {
|
||||||
tmp = current;
|
tmp = current;
|
||||||
|
|
||||||
// if not a hole, clip the area to the land_mask
|
// 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 );
|
tmp = tgPolygonInt( tmp, land_mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,16 @@ public:
|
||||||
inline TGTriNodes get_fixed_elevations() const { return fixed_elevations; }
|
inline TGTriNodes get_fixed_elevations() const { return fixed_elevations; }
|
||||||
|
|
||||||
double nudge;
|
double nudge;
|
||||||
|
|
||||||
|
bool ignore_landmass() const {
|
||||||
|
return m_ignore_landmass;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ignore_landmass(bool b) {
|
||||||
|
m_ignore_landmass = b;
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
bool m_ignore_landmass;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,11 @@
|
||||||
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
TGConstruct::TGConstruct() { }
|
TGConstruct::TGConstruct():
|
||||||
|
useUKGrid(false),
|
||||||
|
writeSharedEdges(true),
|
||||||
|
useOwnSharedEdges(false)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
|
@ -76,6 +76,9 @@ private:
|
||||||
// flag indicating whether the shared edge data of the
|
// flag indicating whether the shared edge data of the
|
||||||
// tile to be built should be used in addition to neighbour data
|
// tile to be built should be used in addition to neighbour data
|
||||||
bool useOwnSharedEdges;
|
bool useOwnSharedEdges;
|
||||||
|
|
||||||
|
// flag indicating whether to ignore the landmass
|
||||||
|
bool ignoreLandmass;
|
||||||
|
|
||||||
// detail level constraints
|
// detail level constraints
|
||||||
int min_nodes;
|
int min_nodes;
|
||||||
|
@ -145,6 +148,10 @@ public:
|
||||||
// own shared edge use flag
|
// own shared edge use flag
|
||||||
inline bool get_use_own_shared_edges() const { return useOwnSharedEdges; }
|
inline bool get_use_own_shared_edges() const { return useOwnSharedEdges; }
|
||||||
inline void set_use_own_shared_edges( const bool b ) { useOwnSharedEdges = b; }
|
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
|
// detail level constraints
|
||||||
inline int get_min_nodes() const { return min_nodes; }
|
inline int get_min_nodes() const { return min_nodes; }
|
||||||
|
|
|
@ -335,6 +335,7 @@ static int load_polys( TGConstruct& c, const TGArray &array ) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
clipper.nudge = nudge;
|
clipper.nudge = nudge;
|
||||||
|
clipper.ignore_landmass( c.get_ignore_landmass() );
|
||||||
|
|
||||||
// initialize clipper
|
// initialize clipper
|
||||||
clipper.init();
|
clipper.init();
|
||||||
|
@ -1046,6 +1047,7 @@ static void usage( const string name ) {
|
||||||
cout << " --useUKgrid" << endl;
|
cout << " --useUKgrid" << endl;
|
||||||
cout << " --no-write-shared-edges" << endl;
|
cout << " --no-write-shared-edges" << endl;
|
||||||
cout << " --use-own-shared-edges" << endl;
|
cout << " --use-own-shared-edges" << endl;
|
||||||
|
cout << " --ignore-landmass" << endl;
|
||||||
cout << " ] <load directory...>" << endl;
|
cout << " ] <load directory...>" << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
@ -1075,6 +1077,8 @@ int main(int argc, char **argv) {
|
||||||
// tile to be built should be used in addition to neighbour data
|
// tile to be built should be used in addition to neighbour data
|
||||||
bool useOwnSharedEdges = false;
|
bool useOwnSharedEdges = false;
|
||||||
|
|
||||||
|
bool ignoreLandmass = false;
|
||||||
|
|
||||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1112,6 +1116,8 @@ int main(int argc, char **argv) {
|
||||||
writeSharedEdges = false;
|
writeSharedEdges = false;
|
||||||
} else if (arg.find("--use-own-shared-edges") == 0) {
|
} else if (arg.find("--use-own-shared-edges") == 0) {
|
||||||
useOwnSharedEdges = true;
|
useOwnSharedEdges = true;
|
||||||
|
} else if (arg.find("--ignore-landmass") == 0) {
|
||||||
|
ignoreLandmass = true;
|
||||||
} else if (arg.find("--") == 0) {
|
} else if (arg.find("--") == 0) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1186,6 +1192,7 @@ int main(int argc, char **argv) {
|
||||||
c.set_useUKGrid( useUKgrid );
|
c.set_useUKGrid( useUKgrid );
|
||||||
c.set_write_shared_edges( writeSharedEdges );
|
c.set_write_shared_edges( writeSharedEdges );
|
||||||
c.set_use_own_shared_edges( useOwnSharedEdges );
|
c.set_use_own_shared_edges( useOwnSharedEdges );
|
||||||
|
c.set_ignore_landmass( ignoreLandmass );
|
||||||
|
|
||||||
c.set_min_nodes( 50 );
|
c.set_min_nodes( 50 );
|
||||||
c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) );
|
c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) );
|
||||||
|
|
Loading…
Reference in a new issue