/usr/include/CGAL/Qt/DelaunayMeshTriangulationGraphicsItem.h is in libcgal-qt5-dev 4.9-1+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | // Copyright (c) 2008 GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Laurent Rineau <Laurent.Rineau@geometryfactory.com>
#ifndef CGAL_QT_DELAUNAY_MESH_TRIANGULATION_GRAPHICS_ITEM_H
#define CGAL_QT_DELAUNAY_MESH_TRIANGULATION_GRAPHICS_ITEM_H
#include <CGAL/Qt/ConstrainedTriangulationGraphicsItem.h>
#include <CGAL/Qt/Converter.h>
#include <QBrush>
#include <QPen>
#include <list>
namespace CGAL {
namespace Qt {
template <typename T>
class DelaunayMeshTriangulationGraphicsItem
: public ConstrainedTriangulationGraphicsItem<T>
{
typedef ConstrainedTriangulationGraphicsItem<T> Base;
typedef typename T::Geom_traits Geom_traits;
typedef typename T::Point Point;
public:
DelaunayMeshTriangulationGraphicsItem(T * t_)
: Base(t_)
, visible_in_domain(true)
, visible_blind_faces(false)
, visible_voronoi(false)
, visible_seeds(false)
, visible_inside_edges(false)
, seeds_begin()
, seeds_end()
, in_domain_brush(::Qt::blue)
, blind_brush(::Qt::gray)
{
setSeedsPen(QPen(::Qt::black, 10.));
}
void operator()(typename T::Face_handle fh);
const QBrush& facesInDomainBrush() const
{
return in_domain_brush;
}
void setFacesInDomainBrush(const QBrush& brush)
{
in_domain_brush = brush;
}
const QBrush& blindFacesBrush() const
{
return blind_brush;
}
void setBlindFacesBrush(const QBrush& brush)
{
blind_brush = brush;
}
bool visibleFacesInDomain() const
{
return visible_in_domain;
}
void setVisibleFacesInDomain(const bool b)
{
visible_in_domain = b;
this->update();
}
bool visibleBlindFaces() const
{
return visible_blind_faces;
}
void setVisibleBlindFaces(const bool b)
{
visible_blind_faces = b;
this->update();
}
bool visibleSeeds() const
{
return visible_seeds;
}
void setVisibleSeeds(const bool b,
typename std::list<Point>::iterator begin,
typename std::list<Point>::iterator end)
{
visible_seeds = b;
seeds_begin = begin;
seeds_end = end;
this->update();
}
const QPen& voronoiPen() const
{
return voronoi_pen;
}
void setVoronoiPen(const QPen& pen)
{
voronoi_pen = pen;
}
const QPen& seedsPen() const
{
return seeds_pen;
}
void setSeedsPen(const QPen& pen)
{
seeds_pen = pen;
}
bool visibleVoronoiEdges() const
{
return visible_voronoi;
}
void setVisibleVoronoiEdges(const bool b)
{
visible_voronoi = b;
this->update();
}
bool visibleInsideEdges() const
{
return visible_inside_edges;
}
void setVisibleInsideEdges(const bool b)
{
visible_inside_edges = b;
this->update();
}
protected:
void drawAll(QPainter *painter);
void paintSeeds(QPainter *painter);
bool visible_in_domain;
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;
QBrush blind_brush;
QPen voronoi_pen;
QPen seeds_pen;
};
template <typename T>
void
DelaunayMeshTriangulationGraphicsItem<T>::drawAll(QPainter *painter)
{
if(visibleFacesInDomain())
{
this->painterostream = PainterOstream<typename T::Geom_traits>(painter);
painter->setBrush(facesInDomainBrush());
painter->setPen(::Qt::NoPen);
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(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);
painter->setBrush(blindFacesBrush());
painter->setPen(::Qt::NoPen);
for(typename T::Finite_faces_iterator fit = this->t->finite_faces_begin();
fit != this->t->finite_faces_end();
++fit){
if(fit->is_blind()){
this->painterostream << this->t->triangle(fit);
}
}
painter->setBrush(::Qt::NoBrush);
}
if(this->visibleVoronoiEdges())
{
painter->setBrush(::Qt::NoBrush);
painter->setPen(::Qt::darkGreen);
//painter->setPen(this->voronoiPen());
this->painterostream = PainterOstream<typename T::Geom_traits>(painter);
typedef CGAL::Cvd_cell_2<T> Cvd_cell;
for(typename T::Finite_vertices_iterator
vit = this->t->finite_vertices_begin();
vit != this->t->finite_vertices_end();
++vit)
{
Cvd_cell cell = CGAL::dual(*(this->t), vit);
for(typename Cvd_cell::segment_iterator sit = cell.segments_begin();
sit != cell.segments_end();
++sit)
{
this->painterostream << *sit;
}
for(typename Cvd_cell::ray_iterator rit = cell.rays_begin();
rit != cell.rays_end();
++rit)
{
this->painterostream << *rit;
}
}
}
paintSeeds(painter);
Base::drawAll(painter);
}
template <typename T>
void
DelaunayMeshTriangulationGraphicsItem<T>::paintSeeds(QPainter *painter)
{
if(this->visibleSeeds())
{
Converter<Geom_traits> convert;
painter->setPen(this->seedsPen());
QMatrix matrix = painter->matrix();
painter->resetMatrix();
typename std::list<Point>::iterator sit;
for(sit = seeds_begin; sit != seeds_end; ++sit)
painter->drawPoint(matrix.map(convert(*sit)));
painter->setMatrix(matrix);
}
}
template <typename T>
void
DelaunayMeshTriangulationGraphicsItem<T>::operator()(typename T::Face_handle fh)
{
if(visibleFacesInDomain()) {
if(fh->is_in_domain()){
this->painterostream = PainterOstream<typename T::Geom_traits>(this->m_painter);
this->m_painter->setBrush(facesInDomainBrush());
this->m_painter->setPen(::Qt::NoPen) ;
this->painterostream << this->t->triangle(fh);
}
}
if(visibleBlindFaces()) {
if(fh->is_blind()){
this->painterostream = PainterOstream<typename T::Geom_traits>(this->m_painter);
this->m_painter->setBrush(blindFacesBrush());
this->m_painter->setPen(::Qt::NoPen) ;
this->painterostream << this->t->triangle(fh);
}
}
Base::operator()(fh);
}
} // namespace Qt
} // namespace CGAL
#endif // CGAL_Q_DELAUNAY_MESH_TRIANGULATION_GRAPHICS_ITEM_H
|