1
0
Fork 0

(running tgvpf --chunk=e020n40 --work-dir=Lakes --material=Lake /home/romosan/scenery/vmaplv0 eurnasia hydro inwatera).

It looks like the program gets into an infinite loop while findind
edges for a contour (inserting the same edge over and over until the
program runs out of memory). i am not quite sure i understand the code
but the following patch solved the problem for me:
This commit is contained in:
curt 2003-12-18 17:38:05 +00:00
parent a27a7d9367
commit b635ee443d
2 changed files with 26 additions and 15 deletions

View file

@ -77,6 +77,7 @@ VpfContour::getLines () const
const VpfTable &edg = getEDG();
int current_offset = 0;
int current_edge = _start_edge;
// std::cout << "start edge: " << _start_edge << std::endl;
int previous_edge = -1;
do {
int row = edg.findMatch("id", current_edge);
@ -93,6 +94,9 @@ VpfContour::getLines () const
info.isLR = true;
current_edge = edg.getValue(row, "right_edge")
.getCrossRef().current_tile_key;
if (edg.getValue(row, "left_face")
.getCrossRef().current_tile_key == _polygon_id)
std::cout << "right face also left face" << std::endl;
} else if (edg.getValue(row, "left_face")
.getCrossRef().current_tile_key == _polygon_id) {
info.isLR = false;
@ -102,6 +106,17 @@ VpfContour::getLines () const
throw VpfException("edge does not belong to face");
}
for ( vector<line_info>::reverse_iterator it = _lines->rbegin();
it != _lines->rend(); it++ )
{
if ( it->id == info.id )
{
std::cout << "eeek!!! infinite loop..." << std::endl;
_nPoints -= info.size;
return *_lines;
}
}
_lines->push_back(info);
} while (current_edge != _start_edge);
}

View file

@ -12,11 +12,13 @@ using std::string;
VpfTile::VpfTile (VpfTableManager &tableManager,
const string &path, int tile_id)
: VpfComponent(tableManager, path),
_tile_id(tile_id), // FIXME: kludge
_face_id(-1),
_tile_id(tile_id),
_aft(0),
_fbr(0)
{
const VpfTable &aft = getAFT();
int row = aft.findMatch("id", _tile_id);
_face_id = aft.getValue(row, "fac_id").getInt();
}
VpfTile::VpfTile (const VpfTile &tile)
@ -55,12 +57,6 @@ VpfTile::getBoundingRectangle () const
VpfRectangle rect;
const VpfTable &fbr = getFBR();
if (_face_id == -1) {
const VpfTable &aft = getAFT();
int row = aft.findMatch("id", _tile_id);
_face_id = aft.getValue(row, "fac_id").getInt();
}
int row = fbr.findMatch("id", _face_id);
rect.minX = fbr.getValue(row, "xmin").getReal();
rect.minY = fbr.getValue(row, "ymin").getReal();