Merge branch 'Surface_modeling-new_package-GF' of ssh://scm.cgal.org/var/git/cgal into Surface_modeling-new_package-GF

This commit is contained in:
iyaz 2013-06-14 15:20:35 +03:00
commit e1f28c1d3d
4 changed files with 26 additions and 4 deletions

View File

@ -45,6 +45,17 @@ public:
(std::max)(ymax, b.ymax),
(std::max)(zmax, b.zmax));
}
bool operator==(const Bbox&b) const{
return
xmin==b.xmin && xmax==b.xmax &&
ymin==b.ymin && ymax==b.ymax &&
zmin==b.zmin && zmax==b.zmax;
}
bool operator!=(const Bbox& b) const{
return !(*this == b);
}
double width() const { return xmax-xmin; }
double height() const { return ymax-ymin; }

View File

@ -59,10 +59,15 @@ Scene::replaceItem(Scene::Item_id index, Scene_item* item)
this, SLOT(itemChanged()));
std::swap(m_entries[index], item);
emit updated_bbox();
if ( item->isFinite() && !item->isEmpty() &&
m_entries[index]->isFinite() && !m_entries[index]->isEmpty() &&
item->bbox()!=m_entries[index]->bbox() )
{
emit updated_bbox();
}
emit updated();
itemChanged(index);
QAbstractListModel::reset();
// QAbstractListModel::reset();
return item;
}

View File

@ -27,6 +27,7 @@ Scene_edit_polyhedron_item::Scene_edit_polyhedron_item(Scene_polyhedron_item* po
poly_item(poly_item),
deform_mesh(*(poly_item->polyhedron()), Vertex_index_map(), Edge_index_map(), Array_based_vertex_point_map(&positions)),
is_rot_free(true),
own_poly_item(true),
quadric(gluNewQuadric())
{
gluQuadricNormals(quadric, GLU_SMOOTH);
@ -88,7 +89,7 @@ Scene_edit_polyhedron_item::~Scene_edit_polyhedron_item()
delete_handle_group(false);
}
gluDeleteQuadric(quadric);
delete poly_item;
if (own_poly_item) delete poly_item;
}
struct Get_vertex_handle : public CGAL::Modifier_base<Polyhedron::HDS>
@ -356,7 +357,7 @@ void Scene_edit_polyhedron_item::changed()
Scene_polyhedron_item* Scene_edit_polyhedron_item::to_polyhedron_item() {
Scene_polyhedron_item* poly_item_tmp = poly_item;
poly_item->set_color_vector_read_only(false);
poly_item = NULL;
own_poly_item=false;
return poly_item_tmp;
}
@ -438,6 +439,9 @@ bool Scene_edit_polyhedron_item::keyPressEvent(QKeyEvent* e)
if (e->key()==Qt::Key_R && !state.ctrl_pressing)
{
is_rot_free = !is_rot_free;
rot_constraint.setRotationConstraintType( is_rot_free?
qglviewer::AxisPlaneConstraint::FREE:
qglviewer::AxisPlaneConstraint::AXIS);
return true;
}
return false;

View File

@ -276,6 +276,8 @@ typedef std::list<Handle_group_data> Handle_group_data_list;
//For constraint rotation
qglviewer::LocalConstraint rot_constraint;
bool is_rot_free;
bool own_poly_item; //indicates if the poly_item should be deleted by the destructor
public:
// Deformation related functions //
bool insert_handle(vertex_descriptor v)