mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/6.1.x-branch' into 'cgal/main'
This commit is contained in:
commit
26a5fc70e4
|
|
@ -5,6 +5,7 @@
|
|||
#include <CGAL/make_conforming_constrained_Delaunay_triangulation_3.h>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
|
||||
|
||||
|
|
@ -29,6 +30,18 @@ int main(int argc, char* argv[])
|
|||
<< "Number of constrained facets in the CDT: "
|
||||
<< ccdt.number_of_constrained_facets() << '\n';
|
||||
|
||||
// Collect constrained facets per polygon
|
||||
std::vector<std::size_t> constrained_facets(polygons.size());
|
||||
for(auto facet : ccdt.constrained_facets())
|
||||
{
|
||||
int i = ccdt.face_constraint_index(facet);
|
||||
++constrained_facets[i];
|
||||
}
|
||||
auto it = std::max_element(constrained_facets.begin(), constrained_facets.end());
|
||||
|
||||
std::cout << "The polygon with the most constrained facets has index "
|
||||
<< (it - constrained_facets.begin()) << " and " << *it << " facets.\n";
|
||||
|
||||
std::ofstream ofs(argc > 2 ? argv[2] : "out.mesh");
|
||||
ofs.precision(17);
|
||||
CGAL::IO::write_MEDIT(ofs, ccdt);
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ public:
|
|||
*/
|
||||
CDT_3_signed_index face_constraint_index(typename Triangulation::Cell_handle ch, int i) const
|
||||
{
|
||||
return ch->face_id[static_cast<unsigned>(i)];
|
||||
return ch->ccdt_3_data().face_constraint_index(i);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public:
|
|||
CGAL::read(is, i);
|
||||
}
|
||||
if(!is) return is;
|
||||
c.face_id[li] = i;
|
||||
c->ccdt_3_data().set_face_constraint_index(li, i);
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1795,8 +1795,8 @@ bool MainWindow::loadScript(QFileInfo info)
|
|||
QString program;
|
||||
QString filename = info.absoluteFilePath();
|
||||
QFile script_file(filename);
|
||||
script_file.open(QIODevice::ReadOnly);
|
||||
if(!script_file.isReadable()) {
|
||||
bool success = script_file.open(QIODevice::ReadOnly);
|
||||
if((! success) || (!script_file.isReadable())) {
|
||||
throw std::ios_base::failure(script_file.errorString().toStdString());
|
||||
}
|
||||
program = script_file.readAll();
|
||||
|
|
@ -2747,9 +2747,9 @@ void MainWindow::exportStatistics()
|
|||
if(filename.isEmpty())
|
||||
return;
|
||||
QFile output(filename);
|
||||
output.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
bool success = output.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
|
||||
if(!output.isOpen()){
|
||||
if((! success) || (!output.isOpen())){
|
||||
qDebug() << "- Error, unable to open" << "outputFilename" << "for output";
|
||||
}
|
||||
QTextStream outStream(&output);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ bool Camera_positions_list::save(QString filename) {
|
|||
if(m_model->rowCount() <1)
|
||||
return false;
|
||||
QFile file(filename);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
if(file.open(QIODevice::WriteOnly)){
|
||||
QTextStream out(&file);
|
||||
for(int i = 0; i < m_model->rowCount(); ++i)
|
||||
{
|
||||
|
|
@ -105,6 +105,8 @@ bool Camera_positions_list::save(QString filename) {
|
|||
}
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Camera_positions_list::on_saveButton_pressed()
|
||||
|
|
@ -129,8 +131,10 @@ void Camera_positions_list::on_openButton_pressed()
|
|||
|
||||
void Camera_positions_list::load(QString filename) {
|
||||
QFile file(filename);
|
||||
|
||||
if(file.open(QIODevice::ReadOnly)){
|
||||
std::clog << "Loading camera positions " << qPrintable(filename) << std::endl;
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
||||
QTextStream input(&file);
|
||||
while(!input.atEnd()) {
|
||||
QString text = input.readLine(1000);
|
||||
|
|
@ -143,6 +147,9 @@ void Camera_positions_list::load(QString filename) {
|
|||
Three::activeViewer()->dumpFrame(frame));
|
||||
}
|
||||
}
|
||||
}else {
|
||||
std::clog << "Loading camera positions " << qPrintable(filename) << " failed" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Camera_positions_list::on_frontButton_pressed()
|
||||
|
|
|
|||
|
|
@ -138,7 +138,12 @@ public Q_SLOTS:
|
|||
private:
|
||||
void showFileBox(QString title, QString fileName) {
|
||||
QFile textFile(fileName);
|
||||
textFile.open(QIODevice::ReadOnly);
|
||||
bool b = textFile.open(QIODevice::ReadOnly);
|
||||
if(!b){
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Could not open file %1.").arg(fileName));
|
||||
return;
|
||||
}
|
||||
QMessageBox mb(QMessageBox::NoIcon,
|
||||
title,
|
||||
QTextStream(&textFile).readAll(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue