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;
|
||||
public:
|
||||
ConstrainedTriangulationGraphicsItem(T * t_)
|
||||
: TriangulationGraphicsItem<T>(t_)
|
||||
: TriangulationGraphicsItem<T>(t_), visible_constraints(true)
|
||||
{
|
||||
constraints_pen = this->edgesPen();
|
||||
constraints_pen.setColor(::Qt::red);
|
||||
|
|
@ -35,10 +35,25 @@ public:
|
|||
constraints_pen = pen;
|
||||
}
|
||||
|
||||
bool visibleConstraints() const
|
||||
{
|
||||
return visible_constraints;
|
||||
}
|
||||
|
||||
void setvisibleConstraints(const bool b)
|
||||
{
|
||||
visible_constraints = b;
|
||||
update();
|
||||
}
|
||||
|
||||
protected:
|
||||
void drawAll(QPainter *painter);
|
||||
|
||||
QPen constraints_pen;
|
||||
|
||||
private:
|
||||
bool visible_constraints;
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
|
@ -46,18 +61,19 @@ void
|
|||
ConstrainedTriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
||||
{
|
||||
this->painterostream = PainterOstream<Geom_traits>(painter);
|
||||
if(this->drawEdges()) {
|
||||
for(typename T::Finite_edges_iterator eit = this->t->finite_edges_begin();
|
||||
eit != this->t->finite_edges_end();
|
||||
++eit){
|
||||
if(this->t->is_constrained(*eit)){
|
||||
painter->setPen(constraintsPen());
|
||||
} else {
|
||||
painter->setPen(this->edgesPen());
|
||||
}
|
||||
for(typename T::Finite_edges_iterator eit = this->t->finite_edges_begin();
|
||||
eit != this->t->finite_edges_end();
|
||||
++eit){
|
||||
if(this->t->is_constrained(*eit)){
|
||||
painter->setPen(constraintsPen());
|
||||
} else {
|
||||
painter->setPen(this->edgesPen());
|
||||
}
|
||||
if(this->visibleEdges() || this->visibleConstraints()){
|
||||
this->painterostream << this->t->segment(*eit);
|
||||
}
|
||||
}
|
||||
|
||||
this->paintVertices(painter);
|
||||
}
|
||||
|
||||
|
|
@ -66,16 +82,17 @@ void
|
|||
ConstrainedTriangulationGraphicsItem<T>::operator()(typename T::Face_handle fh)
|
||||
{
|
||||
for (int i=0; i<3; i++) {
|
||||
if (this->drawEdges() &&
|
||||
( fh < fh->neighbor(i) || this->t->is_infinite(fh->neighbor(i)) ) ) {
|
||||
if ( fh < fh->neighbor(i) || this->t->is_infinite(fh->neighbor(i)) ) {
|
||||
if(this->t->is_constrained(typename T::Edge(fh,i))){
|
||||
this->m_painter->setPen(constraintsPen());
|
||||
} else {
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public:
|
|||
if(const Segment_2 *s = CGAL::object_cast<Segment_2>(&o)){
|
||||
return this->operator()(*s);
|
||||
} 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ void
|
|||
TriangulationGraphicsItem<T>::drawAll(QPainter *painter)
|
||||
{
|
||||
painterostream = PainterOstream<Geom_traits>(painter);
|
||||
if(drawEdges()) {
|
||||
if(visibleEdges()) {
|
||||
for(typename T::Finite_edges_iterator eit = t->finite_edges_begin();
|
||||
eit != t->finite_edges_end();
|
||||
++eit){
|
||||
|
|
@ -157,7 +157,7 @@ template <typename T>
|
|||
void
|
||||
TriangulationGraphicsItem<T>::paintVertices(QPainter *painter)
|
||||
{
|
||||
if(drawVertices()) {
|
||||
if(visibleVertices()) {
|
||||
Converter<Geom_traits> convert;
|
||||
|
||||
painter->setPen(verticesPen());
|
||||
|
|
|
|||
Loading…
Reference in New Issue