void Scene_c3t3_item::export_facets_in_complex() { std::stringstream off_sstream; c3t3().output_facets_in_complex_to_off(off_sstream); std::string backup = off_sstream.str(); // Try to read .off in a polyhedron Scene_polyhedron_item* item = new Scene_polyhedron_item; if (!item->load(off_sstream)) { delete item; off_sstream.str(backup); // Try to read .off in a polygon soup Scene_polygon_soup_item* soup_item = new Scene_polygon_soup_item; if (!soup_item->load(off_sstream)) { delete soup_item; return; } soup_item->setName(QString("%1_%2").arg(this->name()).arg("facets")); last_known_scene->addItem(soup_item); } else{ item->setName(QString("%1_%2").arg(this->name()).arg("facets")); last_known_scene->addItem(item); } }
CGAL::Three::Scene_item* Polyhedron_demo_off_plugin::load_obj(QFileInfo fileinfo) { // Open file std::ifstream in(fileinfo.filePath().toUtf8()); if(!in) { std::cerr << "Error! Cannot open file " << (const char*)fileinfo.filePath().toUtf8() << std::endl; return NULL; } // Try to read .obj in a polyhedron Scene_polyhedron_item* item = new Scene_polyhedron_item(); item->setName(fileinfo.completeBaseName()); if(!item->load_obj(in)) { delete item; return 0; } return item; }