mirror of https://github.com/CGAL/cgal
Add a submenu to view only inside edges
the edges that triangulate the convex hull outside of the domain "pollute" the image
This commit is contained in:
parent
361fc6e3d0
commit
a8440d8eaa
|
|
@ -193,6 +193,8 @@ public slots:
|
|||
|
||||
void on_actionShowDelaunay_toggled(bool checked);
|
||||
|
||||
void on_actionShowTriangulationInDomain_toggled(bool checked);
|
||||
|
||||
void on_actionShow_constrained_edges_toggled(bool checked);
|
||||
|
||||
void on_actionShow_voronoi_edges_toggled(bool checked);
|
||||
|
|
@ -297,6 +299,7 @@ MainWindow::MainWindow()
|
|||
// Check two actions
|
||||
this->actionInsertPolyline->setChecked(true);
|
||||
this->actionShowDelaunay->setChecked(true);
|
||||
this->actionShowTriangulationInDomain->setChecked(false);
|
||||
this->actionShow_faces_in_domain->setChecked(true);
|
||||
this->actionShow_constrained_edges->setChecked(true);
|
||||
this->actionShow_voronoi_edges->setChecked(false);
|
||||
|
|
@ -390,6 +393,23 @@ void
|
|||
MainWindow::on_actionShowDelaunay_toggled(bool checked)
|
||||
{
|
||||
dgi->setVisibleEdges(checked);
|
||||
if(checked)
|
||||
{
|
||||
dgi->setVisibleInsideEdges(false);
|
||||
actionShowTriangulationInDomain->setChecked(false);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
MainWindow::on_actionShowTriangulationInDomain_toggled(bool checked)
|
||||
{
|
||||
dgi->setVisibleInsideEdges(checked);
|
||||
if(checked)
|
||||
{
|
||||
dgi->setVisibleEdges(false);
|
||||
actionShowDelaunay->setChecked(false);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
<addaction name="separator"/>
|
||||
<addaction name="actionShowDelaunay"/>
|
||||
<addaction name="actionShowVoronoi"/>
|
||||
<addaction name="actionShowTriangulationInDomain"/>
|
||||
<addaction name="actionShow_constrained_edges"/>
|
||||
<addaction name="actionShow_voronoi_edges"/>
|
||||
<addaction name="actionShow_faces_in_domain"/>
|
||||
|
|
@ -368,6 +369,14 @@
|
|||
<string>Show seeds</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShowTriangulationInDomain">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show triangulation in domain only</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="Constrained_Delaunay_triangulation_2.qrc"/>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ namespace CGAL {
|
|||
namespace Qt {
|
||||
|
||||
template <typename T>
|
||||
class DelaunayMeshTriangulationGraphicsItem : public ConstrainedTriangulationGraphicsItem<T>
|
||||
class DelaunayMeshTriangulationGraphicsItem
|
||||
: public ConstrainedTriangulationGraphicsItem<T>
|
||||
{
|
||||
typedef ConstrainedTriangulationGraphicsItem<T> Base;
|
||||
typedef typename T::Geom_traits Geom_traits;
|
||||
|
|
@ -49,6 +50,7 @@ public:
|
|||
, seeds_begin()
|
||||
, seeds_end()
|
||||
, visible_seeds(false)
|
||||
, visible_inside_edges(false)
|
||||
{
|
||||
setSeedsPen(QPen(::Qt::black, 10.));
|
||||
}
|
||||
|
|
@ -143,6 +145,18 @@ public:
|
|||
this->update();
|
||||
}
|
||||
|
||||
bool visibleInsideEdges() const
|
||||
{
|
||||
return visible_inside_edges;
|
||||
}
|
||||
|
||||
void setVisibleInsideEdges(const bool b)
|
||||
{
|
||||
visible_inside_edges = b;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
void drawAll(QPainter *painter);
|
||||
void paintSeeds(QPainter *painter);
|
||||
|
|
@ -151,6 +165,7 @@ protected:
|
|||
bool visible_blind_faces;
|
||||
bool visible_voronoi;
|
||||
bool visible_seeds;
|
||||
bool visible_inside_edges;
|
||||
typename std::list<Point>::iterator seeds_begin, seeds_end;
|
||||
|
||||
QBrush in_domain_brush;
|
||||
|
|
@ -177,6 +192,20 @@ DelaunayMeshTriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
|||
}
|
||||
painter->setBrush(::Qt::NoBrush);
|
||||
}
|
||||
if(visibleInsideEdges())
|
||||
{
|
||||
this->painterostream = PainterOstream<typename T::Geom_traits>(painter);
|
||||
painter->setBrush(::Qt::NoBrush);
|
||||
painter->setPen(this->edgesPen());
|
||||
for(typename T::Finite_faces_iterator fit = this->t->finite_faces_begin();
|
||||
fit != this->t->finite_faces_end();
|
||||
++fit){
|
||||
if(fit->is_in_domain()){
|
||||
this->painterostream << this->t->triangle(fit);
|
||||
}
|
||||
}
|
||||
painter->setBrush(::Qt::NoBrush);
|
||||
}
|
||||
if(visibleBlindFaces())
|
||||
{
|
||||
this->painterostream = PainterOstream<typename T::Geom_traits>(painter);
|
||||
|
|
|
|||
Loading…
Reference in New Issue