fixed bug in new_window when tr1.number_of_vertices() <= 1

This commit is contained in:
Radu Ursu 2003-02-11 10:09:44 +00:00
parent cefb1df112
commit 3c4f2d82d9
1 changed files with 15 additions and 13 deletions

View File

@ -231,19 +231,21 @@ private slots:
Window *ed = new Window(500, 500);
ed->setCaption("Layer");
ed->show();
Vertex_iterator it = tr1.vertices_begin();
xmin = xmax = (*it).point().x();
ymin = ymax = (*it).point().y();
while(it != tr1.vertices_end()) {
if(xmin > (*it).point().x())
xmin = (*it).point().x();
if(xmax < (*it).point().x())
xmax = (*it).point().x();
if(ymin > (*it).point().y())
ymin = (*it).point().y();
if(ymax < (*it).point().y())
ymax = (*it).point().y();
it++;
if(tr1.number_of_vertices() > 1){
Vertex_iterator it = tr1.vertices_begin();
xmin = xmax = (*it).point().x();
ymin = ymax = (*it).point().y();
while(it != tr1.vertices_end()) {
if(xmin > (*it).point().x())
xmin = (*it).point().x();
if(xmax < (*it).point().x())
xmax = (*it).point().x();
if(ymin > (*it).point().y())
ymin = (*it).point().y();
if(ymax < (*it).point().y())
ymax = (*it).point().y();
it++;
}
}
ed->set_window(xmin, xmax, ymin, ymax);
something_changed();