void
MainWindow::on_actionSavePoints_triggered()
{
  QString fileName = QFileDialog::getSaveFileName(this,
						  tr("Save points"),
						  ".");
  if(! fileName.isEmpty()){
    std::ofstream ofs(qPrintable(fileName));
    for(Periodic_DT::Unique_vertex_iterator 
          vit = triang.unique_vertices_begin(),
          end = triang.unique_vertices_end();
        vit!= end; ++vit)
    {
      ofs << vit->point() << std::endl;
    }
  }
}
예제 #2
0
void
MainWindow::on_actionSavePoints_triggered()
{
  QString fileName = QFileDialog::getSaveFileName(this,
						  tr("Save points"),
                                                  ".",
                                                  tr("CGAL files (*.pts.cgal);;"
                                                   #if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
                                                     "WKT files (*.wkt *.WKT);;"
                                                   #endif
                                                     "All files (*)"));
  if(! fileName.isEmpty()){
    std::ofstream ofs(qPrintable(fileName));
    if(fileName.endsWith(".wkt", Qt::CaseInsensitive))
    {
#if BOOST_VERSION >= 105600 && (! defined(BOOST_GCC) || BOOST_GCC >= 40500)
      std::vector<Point_2> points;
      points.reserve(std::distance(triang.unique_vertices_begin(),
                                   triang.unique_vertices_end()));
      for(Periodic_DT::Unique_vertex_iterator 
          vit = triang.unique_vertices_begin(),
          end = triang.unique_vertices_end();
          vit!= end; ++vit)
      {
        points.push_back(vit->point());
      }
      CGAL::write_multi_point_WKT(ofs, points);
#endif
    }
    else
    {
      for(Periodic_DT::Unique_vertex_iterator 
          vit = triang.unique_vertices_begin(),
          end = triang.unique_vertices_end();
          vit!= end; ++vit)
      {
        ofs << vit->point() << std::endl;
      }
    }
  }
}