mirror of https://github.com/CGAL/cgal
Incorporated reviewers remarks
This commit is contained in:
parent
f7adea31f0
commit
b073a2356b
|
|
@ -17,7 +17,7 @@ class ConstrainedTriangulationGraphicsItem : public TriangulationGraphicsItem<T>
|
||||||
typedef typename T::Geom_traits Geom_traits;
|
typedef typename T::Geom_traits Geom_traits;
|
||||||
public:
|
public:
|
||||||
ConstrainedTriangulationGraphicsItem(T * t_)
|
ConstrainedTriangulationGraphicsItem(T * t_)
|
||||||
: TriangulationGraphicsItem<T>(t_)
|
: TriangulationGraphicsItem<T>(t_), visible_constraints(true)
|
||||||
{
|
{
|
||||||
constraints_pen = this->edgesPen();
|
constraints_pen = this->edgesPen();
|
||||||
constraints_pen.setColor(::Qt::red);
|
constraints_pen.setColor(::Qt::red);
|
||||||
|
|
@ -35,10 +35,25 @@ public:
|
||||||
constraints_pen = pen;
|
constraints_pen = pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool visibleConstraints() const
|
||||||
|
{
|
||||||
|
return visible_constraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setvisibleConstraints(const bool b)
|
||||||
|
{
|
||||||
|
visible_constraints = b;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawAll(QPainter *painter);
|
void drawAll(QPainter *painter);
|
||||||
|
|
||||||
QPen constraints_pen;
|
QPen constraints_pen;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool visible_constraints;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
@ -46,18 +61,19 @@ void
|
||||||
ConstrainedTriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
ConstrainedTriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
||||||
{
|
{
|
||||||
this->painterostream = PainterOstream<Geom_traits>(painter);
|
this->painterostream = PainterOstream<Geom_traits>(painter);
|
||||||
if(this->drawEdges()) {
|
for(typename T::Finite_edges_iterator eit = this->t->finite_edges_begin();
|
||||||
for(typename T::Finite_edges_iterator eit = this->t->finite_edges_begin();
|
eit != this->t->finite_edges_end();
|
||||||
eit != this->t->finite_edges_end();
|
++eit){
|
||||||
++eit){
|
if(this->t->is_constrained(*eit)){
|
||||||
if(this->t->is_constrained(*eit)){
|
painter->setPen(constraintsPen());
|
||||||
painter->setPen(constraintsPen());
|
} else {
|
||||||
} else {
|
painter->setPen(this->edgesPen());
|
||||||
painter->setPen(this->edgesPen());
|
}
|
||||||
}
|
if(this->visibleEdges() || this->visibleConstraints()){
|
||||||
this->painterostream << this->t->segment(*eit);
|
this->painterostream << this->t->segment(*eit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->paintVertices(painter);
|
this->paintVertices(painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,16 +82,17 @@ void
|
||||||
ConstrainedTriangulationGraphicsItem<T>::operator()(typename T::Face_handle fh)
|
ConstrainedTriangulationGraphicsItem<T>::operator()(typename T::Face_handle fh)
|
||||||
{
|
{
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
if (this->drawEdges() &&
|
if ( fh < fh->neighbor(i) || this->t->is_infinite(fh->neighbor(i)) ) {
|
||||||
( fh < fh->neighbor(i) || this->t->is_infinite(fh->neighbor(i)) ) ) {
|
|
||||||
if(this->t->is_constrained(typename T::Edge(fh,i))){
|
if(this->t->is_constrained(typename T::Edge(fh,i))){
|
||||||
this->m_painter->setPen(constraintsPen());
|
this->m_painter->setPen(constraintsPen());
|
||||||
} else {
|
} else {
|
||||||
this->m_painter->setPen(this->edgesPen());
|
this->m_painter->setPen(this->edgesPen());
|
||||||
}
|
}
|
||||||
this->painterostream << this->t->segment(fh,i);
|
if(this->visibleEdges() || this->visibleConstraints()){
|
||||||
|
this->painterostream << this->t->segment(fh,i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(this->drawVertices()) {
|
if(this->visibleVertices()) {
|
||||||
paintOneVertex(fh->vertex(i)->point());
|
paintOneVertex(fh->vertex(i)->point());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ public:
|
||||||
if(const Segment_2 *s = CGAL::object_cast<Segment_2>(&o)){
|
if(const Segment_2 *s = CGAL::object_cast<Segment_2>(&o)){
|
||||||
return this->operator()(*s);
|
return this->operator()(*s);
|
||||||
} else if(const Point_2 *p = CGAL::object_cast<Point_2>(&o)){
|
} else if(const Point_2 *p = CGAL::object_cast<Point_2>(&o)){
|
||||||
return QLineF(operator()(p), operator()(p));
|
return QLineF(operator()(*p), operator()(*p));
|
||||||
}
|
}
|
||||||
return QLineF();
|
return QLineF();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ void
|
||||||
TriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
TriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
||||||
{
|
{
|
||||||
painterostream = PainterOstream<Geom_traits>(painter);
|
painterostream = PainterOstream<Geom_traits>(painter);
|
||||||
if(drawEdges()) {
|
if(visibleEdges()) {
|
||||||
for(typename T::Finite_edges_iterator eit = t->finite_edges_begin();
|
for(typename T::Finite_edges_iterator eit = t->finite_edges_begin();
|
||||||
eit != t->finite_edges_end();
|
eit != t->finite_edges_end();
|
||||||
++eit){
|
++eit){
|
||||||
|
|
@ -157,7 +157,7 @@ template <typename T>
|
||||||
void
|
void
|
||||||
TriangulationGraphicsItem<T>::paintVertices(QPainter *painter)
|
TriangulationGraphicsItem<T>::paintVertices(QPainter *painter)
|
||||||
{
|
{
|
||||||
if(drawVertices()) {
|
if(visibleVertices()) {
|
||||||
Converter<Geom_traits> convert;
|
Converter<Geom_traits> convert;
|
||||||
|
|
||||||
painter->setPen(verticesPen());
|
painter->setPen(verticesPen());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue