1
0
Fork 0

Merge branch 'master' of mapserver.flightgear.org:git/terragear-cs

This commit is contained in:
Martin Spott 2011-09-25 13:36:12 -07:00
commit 55e68f9eda
2 changed files with 28 additions and 24 deletions

View file

@ -101,7 +101,7 @@ int load_area_types( const std::string& filename ) {
AreaType index = (AreaType)area_types.size(); AreaType index = (AreaType)area_types.size();
area_types.push_back(descriptor); area_types.push_back(descriptor);
area_names[descriptor.name]=index; area_names[descriptor.name]=index;
SG_LOG(SG_GENERAL, SG_INFO, " " << descriptor.name << " " << descriptor.kind); SG_LOG(SG_GENERAL, SG_INFO, " " << index << " " << descriptor.name << " " << descriptor.kind);
in >> skipcomment; in >> skipcomment;
} }

View file

@ -372,11 +372,11 @@ int TGTriangle::run_triangulate( double angle, const int pass ) {
in.holelist = (REAL *) malloc(in.numberofholes * 2 * sizeof(REAL)); in.holelist = (REAL *) malloc(in.numberofholes * 2 * sizeof(REAL));
counter = 0;
for ( i = 0; i < TG_MAX_AREA_TYPES; i++) { for ( i = 0; i < TG_MAX_AREA_TYPES; i++) {
if ( is_hole_area( i ) ) { if ( is_hole_area( i ) ) {
h_current = polylist[i].begin(); h_current = polylist[i].begin();
h_last = polylist[i].end(); h_last = polylist[i].end();
counter = 0;
for ( ; h_current != h_last; ++h_current ) { for ( ; h_current != h_last; ++h_current ) {
poly = *h_current; poly = *h_current;
for ( j = 0; j < poly.contours(); ++j ) { for ( j = 0; j < poly.contours(); ++j ) {
@ -391,14 +391,16 @@ int TGTriangle::run_triangulate( double angle, const int pass ) {
// region list // region list
in.numberofregions = 0; in.numberofregions = 0;
for ( i = 0; i < TG_MAX_AREA_TYPES; ++i ) { for ( i = 0; i < TG_MAX_AREA_TYPES; ++i ) {
poly_list_iterator h_current, h_last; if ( ! is_hole_area( i ) ) {
h_current = polylist[i].begin(); poly_list_iterator h_current, h_last;
h_last = polylist[i].end(); h_current = polylist[i].begin();
for ( ; h_current != h_last; ++h_current ) { h_last = polylist[i].end();
poly = *h_current; for ( ; h_current != h_last; ++h_current ) {
for ( j = 0; j < poly.contours(); ++j ) { poly = *h_current;
if ( ! poly.get_hole_flag( j ) ) { for ( j = 0; j < poly.contours(); ++j ) {
++in.numberofregions; if ( ! poly.get_hole_flag( j ) ) {
++in.numberofregions;
}
} }
} }
} }
@ -407,20 +409,22 @@ int TGTriangle::run_triangulate( double angle, const int pass ) {
in.regionlist = (REAL *) malloc(in.numberofregions * 4 * sizeof(REAL)); in.regionlist = (REAL *) malloc(in.numberofregions * 4 * sizeof(REAL));
counter = 0; counter = 0;
for ( i = 0; i < TG_MAX_AREA_TYPES; ++i ) { for ( i = 0; i < TG_MAX_AREA_TYPES; ++i ) {
poly_list_iterator h_current, h_last; if ( ! is_hole_area( i ) ) {
h_current = polylist[(int)i].begin(); poly_list_iterator h_current, h_last;
h_last = polylist[(int)i].end(); h_current = polylist[(int)i].begin();
for ( ; h_current != h_last; ++h_current ) { h_last = polylist[(int)i].end();
poly = *h_current; for ( ; h_current != h_last; ++h_current ) {
for ( j = 0; j < poly.contours(); ++j ) { poly = *h_current;
if ( ! poly.get_hole_flag( j ) ) { for ( j = 0; j < poly.contours(); ++j ) {
p = poly.get_point_inside( j ); if ( ! poly.get_hole_flag( j ) ) {
cout << "Region point = " << p << endl; p = poly.get_point_inside( j );
in.regionlist[counter++] = p.x(); // x coord cout << "Region point = " << p << endl;
in.regionlist[counter++] = p.y(); // y coord in.regionlist[counter++] = p.x(); // x coord
in.regionlist[counter++] = i; // region attribute in.regionlist[counter++] = p.y(); // y coord
in.regionlist[counter++] = -1.0; // area constraint in.regionlist[counter++] = i; // region attribute
// (unused) in.regionlist[counter++] = -1.0; // area constraint
// (unused)
}
} }
} }
} }