Add back code to clip polygons against land mass. This temporarily breaks
the ability for roads/railways to bridge ocean, but I hope to get that fixed soon.
This commit is contained in:
parent
ea58728f5c
commit
b3935db989
1 changed files with 12 additions and 9 deletions
|
@ -471,14 +471,14 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
||||||
polygon_union( land_mask, polys_in.polys[DefaultArea][i] );
|
polygon_union( land_mask, polys_in.polys[DefaultArea][i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up a mask for inland water.
|
// set up a mask for all water.
|
||||||
TGPolygon inland_water_mask;
|
TGPolygon water_mask;
|
||||||
inland_water_mask.erase();
|
water_mask.erase();
|
||||||
for ( i = 0; i < FG_MAX_AREA_TYPES; i++ ) {
|
for ( i = 0; i < FG_MAX_AREA_TYPES; i++ ) {
|
||||||
if (is_water_area(AreaType(i))) {
|
if (is_water_area(AreaType(i))) {
|
||||||
for (unsigned int j = 0; j < polys_in.polys[i].size(); j++) {
|
for (unsigned int j = 0; j < polys_in.polys[i].size(); j++) {
|
||||||
inland_water_mask =
|
water_mask =
|
||||||
polygon_union(inland_water_mask, polys_in.polys[i][j]);
|
polygon_union(water_mask, polys_in.polys[i][j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,17 +505,20 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
||||||
|
|
||||||
tmp = current;
|
tmp = current;
|
||||||
|
|
||||||
|
// if not a hole, clip the area to the land_mask
|
||||||
|
if ( i != HoleArea ) {
|
||||||
|
tmp = polygon_int( tmp, land_mask );
|
||||||
|
}
|
||||||
|
|
||||||
// Airport areas are limited to existing land mass and
|
// Airport areas are limited to existing land mass and
|
||||||
// never override water.
|
// never override water.
|
||||||
if ( i == AirportArea ) {
|
if ( i == AirportArea ) {
|
||||||
tmp = polygon_int(tmp, land_mask);
|
tmp = polygon_int(tmp, land_mask);
|
||||||
tmp = polygon_diff(tmp, inland_water_mask);
|
tmp = polygon_diff(tmp, water_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a water area, cut out potential islands
|
// if a water area, cut out potential islands
|
||||||
if ( i == LakeArea || i == IntLakeArea || i == ReservoirArea ||
|
if ( is_water_area(AreaType(i)) ) {
|
||||||
i == IntReservoirArea || i == StreamArea || i == CanalArea ||
|
|
||||||
i == OceanArea ) {
|
|
||||||
// clip against island mask
|
// clip against island mask
|
||||||
tmp = polygon_diff( tmp, island_mask );
|
tmp = polygon_diff( tmp, island_mask );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue