mirror of https://github.com/CGAL/cgal
Working on the demo, coloring the vertices of small triangulations
This commit is contained in:
parent
8e2e8b9ac8
commit
f26692677f
|
|
@ -110,7 +110,7 @@ MainWindow::MainWindow()
|
||||||
QObject::connect(this, SIGNAL(changed()),
|
QObject::connect(this, SIGNAL(changed()),
|
||||||
pt_gi, SLOT(modelChanged()));
|
pt_gi, SLOT(modelChanged()));
|
||||||
|
|
||||||
pt_gi->setVerticesPen(QPen(Qt::red, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
pt_gi->setVerticesPen(QPen(Qt::red, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
scene.addItem(pt_gi);
|
scene.addItem(pt_gi);
|
||||||
|
|
||||||
// Add a GraphicItem for the Voronoi diagram
|
// Add a GraphicItem for the Voronoi diagram
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,7 @@ namespace CGAL {
|
||||||
|
|
||||||
if(visibleEdges()) {
|
if(visibleEdges()) {
|
||||||
painter->setPen(this->edgesPen());
|
painter->setPen(this->edgesPen());
|
||||||
for (typename T::Periodic_segment_iterator psit = t->periodic_segments_begin();
|
t->draw_triangulation(painterostream);
|
||||||
psit != t->periodic_segments_end(); ++psit) {
|
|
||||||
painterostream << t->segment(*psit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
paintVertices(painter);
|
paintVertices(painter);
|
||||||
|
|
@ -191,9 +188,27 @@ namespace CGAL {
|
||||||
if(visibleVertices()) {
|
if(visibleVertices()) {
|
||||||
Converter<Geom_traits> convert;
|
Converter<Geom_traits> convert;
|
||||||
|
|
||||||
painter->setPen(verticesPen());
|
|
||||||
QMatrix matrix = painter->matrix();
|
QMatrix matrix = painter->matrix();
|
||||||
painter->resetMatrix();
|
painter->resetMatrix();
|
||||||
|
|
||||||
|
QPen pen = verticesPen();
|
||||||
|
if (t->number_of_vertices() < 8) {
|
||||||
|
int v_index=1;
|
||||||
|
for (typename T::Unique_vertex_iterator vit = t->unique_vertices_begin();
|
||||||
|
vit != t->unique_vertices_end(); ++vit) {
|
||||||
|
pen.setColor(QColor(255*(v_index&1), 255*((v_index>>1)&1), 255*((v_index>>2)&1)));
|
||||||
|
painter->setPen(pen);
|
||||||
|
|
||||||
|
painter->drawPoint(matrix.map(convert(t->point(vit))));
|
||||||
|
std::vector<typename T::Vertex_handle> copies = t->periodic_copies(vit);
|
||||||
|
for (size_t i=0; i<copies.size(); ++i)
|
||||||
|
painter->drawPoint(matrix.map(convert(t->point(copies[i]))));
|
||||||
|
|
||||||
|
++v_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
painter->setPen(verticesPen());
|
||||||
for (typename T::Periodic_point_iterator ppit = t->periodic_points_begin();
|
for (typename T::Periodic_point_iterator ppit = t->periodic_points_begin();
|
||||||
ppit != t->periodic_points_end(); ++ppit)
|
ppit != t->periodic_points_end(); ++ppit)
|
||||||
{
|
{
|
||||||
|
|
@ -201,6 +216,9 @@ namespace CGAL {
|
||||||
painter->drawPoint(point);
|
painter->drawPoint(point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
painter->setMatrix(matrix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
||||||
|
|
@ -100,22 +100,6 @@ PeriodicTriangulationVoronoiGraphicsItem<DT>::paint(QPainter *painter, const QSt
|
||||||
|
|
||||||
painter->setPen(edgesPen());
|
painter->setPen(edgesPen());
|
||||||
dt->draw_dual(pos);
|
dt->draw_dual(pos);
|
||||||
// TODO(NGHK): Not yet implement
|
|
||||||
// for(typename DT::Finite_edges_iterator eit = dt->finite_edges_begin();
|
|
||||||
// eit != dt->finite_edges_end();
|
|
||||||
// eit++){
|
|
||||||
// CGAL::Object o = dt->dual(eit);
|
|
||||||
// typename DT::Segment s;
|
|
||||||
// typename DT::Geom_traits::Ray_2 r;
|
|
||||||
// typename DT::Geom_traits::Line_2 l;
|
|
||||||
// if(CGAL::assign(s,o)){
|
|
||||||
// pos << s;
|
|
||||||
// } else if(CGAL::assign(r,o)) {
|
|
||||||
// pos << r;
|
|
||||||
// }else if(CGAL::assign(l,o)) {
|
|
||||||
// pos << l;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1096,6 +1096,16 @@ public:
|
||||||
CGAL_triangulation_assertion(_virtual_vertices_reverse.find(v) != _virtual_vertices_reverse.end());
|
CGAL_triangulation_assertion(_virtual_vertices_reverse.find(v) != _virtual_vertices_reverse.end());
|
||||||
return _virtual_vertices_reverse.find(v)->second;
|
return _virtual_vertices_reverse.find(v)->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// NGHK: Not yet implemented
|
||||||
|
template<class Stream>
|
||||||
|
Stream& draw_triangulation(Stream& os) const {
|
||||||
|
Edge_iterator it = edges_begin();
|
||||||
|
for (; it != edges_end(); ++it) {
|
||||||
|
os << segment(it);
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
/// NGHK: implemented
|
/// NGHK: implemented
|
||||||
std::vector<Vertex_handle> insert_dummy_points();
|
std::vector<Vertex_handle> insert_dummy_points();
|
||||||
|
|
@ -1230,20 +1240,8 @@ protected:
|
||||||
|
|
||||||
// template members
|
// template members
|
||||||
|
|
||||||
/// NGHK: Not yet implemented
|
|
||||||
template<class Stream>
|
|
||||||
Stream& draw_triangulation(Stream& os) const {
|
|
||||||
NGHK_NYI;
|
|
||||||
Edge_iterator it = edges_begin();
|
|
||||||
for (; it != edges_end(); ++it) {
|
|
||||||
os << segment(it);
|
|
||||||
}
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// NGHK: Not yet implemented
|
/// NGHK: Not yet implemented
|
||||||
bool well_oriented(Vertex_handle v) const {
|
bool well_oriented(Vertex_handle v) const {
|
||||||
NGHK_NYI;
|
|
||||||
typedef typename Geom_traits::Orientation_2 Orientation_2;
|
typedef typename Geom_traits::Orientation_2 Orientation_2;
|
||||||
Face_circulator fc = incident_faces(v), done(fc);
|
Face_circulator fc = incident_faces(v), done(fc);
|
||||||
do {
|
do {
|
||||||
|
|
@ -1265,18 +1263,6 @@ protected:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// NGHK: Not yet implemented
|
|
||||||
bool from_convex_hull(Vertex_handle v) {
|
|
||||||
NGHK_NYI;
|
|
||||||
CGAL_triangulation_precondition(!is_infinite(v));
|
|
||||||
Vertex_circulator vc = adjacent_vertices(v), done(vc);
|
|
||||||
do {
|
|
||||||
if (is_infinite(vc))
|
|
||||||
return true;
|
|
||||||
} while (++vc != done);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// NGHK: Not yet implemented
|
/// NGHK: Not yet implemented
|
||||||
template<class EdgeIt>
|
template<class EdgeIt>
|
||||||
Vertex_handle star_hole(const Point& p, EdgeIt edge_begin, EdgeIt edge_end) {
|
Vertex_handle star_hole(const Point& p, EdgeIt edge_begin, EdgeIt edge_end) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue