29 #include <QDialogButtonBox> 
   30 #include <QGraphicsPolygonItem> 
   31 #include <QGraphicsScene> 
   43 const double VoronoiGeneratorDialog::g_scene_margin = 2.0;
 
   48         SetupSceneItems(boundaryPolygon);
 
   49         SetupGui(initialScale);
 
   59         std::list<QPolygonF> polygons;
 
   64         return !polygons.empty() ? polygons : std::list<QPolygonF>({m_tesselation->polygon()});
 
   67 void VoronoiGeneratorDialog::SetupSceneItems(
const QPolygonF &boundaryPolygon)
 
   69         m_scene = 
new QGraphicsScene();
 
   71         m_tesselation->setPen(QPen(QBrush(QColor(51, 102, 0, 255)), 0));
 
   72         m_scene->addItem(m_tesselation);
 
   73         m_scene->setSceneRect(m_tesselation->boundingRect().adjusted(
 
   74                 -g_scene_margin, -g_scene_margin, g_scene_margin, g_scene_margin));
 
   77 void VoronoiGeneratorDialog::SetupGui(
double scale)
 
   79         setWindowTitle(
"Voronoi cell pattern generator");
 
   80         setMinimumSize(800, 500);
 
   83         QVBoxLayout *layout = 
new QVBoxLayout();
 
   87         view->setParent(
this);
 
   89         view->setScene(m_scene);
 
   90         view->setRenderHints(QPainter::Antialiasing);
 
   92         layout->addWidget(view);
 
   96         QHBoxLayout *controlsLayout = 
new QHBoxLayout();
 
   97         controlsLayout->addStretch();
 
  100         QDialogButtonBox *buttonBox = 
new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
 
  101         connect(buttonBox, SIGNAL(accepted()), 
this, SLOT(accept()));
 
  102         connect(buttonBox, SIGNAL(rejected()), 
this, SLOT(reject()));
 
  103         controlsLayout->addWidget(buttonBox);
 
  106         layout->addLayout(controlsLayout);
 
QGraphicsView with the ability to pan and zoom. 
 
Namespace for SimPT tissue editor package. 
 
static QPolygonF Counterclockwise(const QPolygonF &polygon)
Checks if the order of the polygon's points is clockwise and if so, reverts it, else the original pol...
 
Interface for VoronoiGeneratorDialog. 
 
Namespace for graphical interface classes. 
 
Interface for PanAndZoomView. 
 
VoronoiGeneratorDialog(const QPolygonF &boundaryPolygon, double initialScale=1.0, QWidget *parent=nullptr)
Constructor. 
 
Interface for VoronoiTesselation. 
 
see the online Qt documentation 
 
std::list< QPolygonF > GetGeneratedPolygons() const 
Retrieves the generated polygons after the dialog has successfully executed. 
 
virtual ~VoronoiGeneratorDialog()
Destructor. 
 
std::list< QPolygonF > GetCellPolygons()
Returns the polygons of cell of the Voronoi tesselation. 
 
void ScaleView(double factor)
Scales the view, bounded by the minimum and maximum zooming factor. 
 
Interface for PolygonUtils. 
 
Namespace for generic graphical shell for simulators. 
 
see the online Qt documentation 
 
Graphics item for Voronoi tesselation of a polygon.