mirror of https://github.com/CGAL/cgal
Fix Polyhedron example
This commit is contained in:
parent
6e878c4f66
commit
fd15c8e040
|
|
@ -9,10 +9,7 @@ cmake_minimum_required(VERSION 2.8.10)
|
||||||
find_package(CGAL COMPONENTS Qt5)
|
find_package(CGAL COMPONENTS Qt5)
|
||||||
|
|
||||||
if(CGAL_Qt5_FOUND)
|
if(CGAL_Qt5_FOUND)
|
||||||
find_package(QGLViewer)
|
add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
|
||||||
if (TARGET QGLViewer::QGLViewer)
|
|
||||||
add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( CGAL_FOUND )
|
if ( CGAL_FOUND )
|
||||||
|
|
@ -30,8 +27,8 @@ if ( CGAL_FOUND )
|
||||||
create_single_source_cgal_program( "${cppfile}" )
|
create_single_source_cgal_program( "${cppfile}" )
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(CGAL_Qt5_FOUND AND TARGET QGLViewer::QGLViewer)
|
if(CGAL_Qt5_FOUND )
|
||||||
target_link_libraries(draw_polyhedron CGAL::CGAL_Qt5 QGLViewer::QGLViewer)
|
target_link_libraries(draw_polyhedron CGAL::CGAL_Qt5)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||||
#include <CGAL/draw_polyhedron.h>
|
#include <CGAL/draw_polyhedron.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||||
|
|
||||||
|
|
@ -10,7 +13,11 @@ int main()
|
||||||
{
|
{
|
||||||
std::cerr<<"Loading OFF file ... "<<std::endl;
|
std::cerr<<"Loading OFF file ... "<<std::endl;
|
||||||
Polyhedron P;
|
Polyhedron P;
|
||||||
std::cin>>P;
|
std::string filename;
|
||||||
|
std::cin>>filename;
|
||||||
|
std::cout<<filename<<std::endl;
|
||||||
|
std::ifstream in(filename);
|
||||||
|
in >> P;
|
||||||
|
|
||||||
CGAL::draw(P);
|
CGAL::draw(P);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,11 @@ public:
|
||||||
/// @param title the title of the window
|
/// @param title the title of the window
|
||||||
/// @param anofaces if true, do not draw faces (faces are not computed; this can be
|
/// @param anofaces if true, do not draw faces (faces are not computed; this can be
|
||||||
/// usefull for very big object where this time could be long)
|
/// usefull for very big object where this time could be long)
|
||||||
SimplePolyhedronViewerQt(const Polyhedron& apoly, const char* title="",
|
SimplePolyhedronViewerQt(QWidget* parent,const Polyhedron& apoly, const char* title="",
|
||||||
bool anofaces=false,
|
bool anofaces=false,
|
||||||
const ColorFunctor& fcolor=ColorFunctor()) :
|
const ColorFunctor& fcolor=ColorFunctor()) :
|
||||||
// First draw: no vertex; edges, faces; mono-color; inverse normal
|
// First draw: no vertex; edges, faces; mono-color; inverse normal
|
||||||
Base(title, false, true, true, true, false),
|
Base(parent, title, false, true, true, true, false),
|
||||||
poly(apoly),
|
poly(apoly),
|
||||||
m_nofaces(anofaces),
|
m_nofaces(anofaces),
|
||||||
m_fcolor(fcolor)
|
m_fcolor(fcolor)
|
||||||
|
|
@ -205,7 +205,7 @@ void draw(const Polyhedron& apoly,
|
||||||
QApplication app(argc,const_cast<char**>(argv));
|
QApplication app(argc,const_cast<char**>(argv));
|
||||||
|
|
||||||
SimplePolyhedronViewerQt<Polyhedron, ColorFunctor>
|
SimplePolyhedronViewerQt<Polyhedron, ColorFunctor>
|
||||||
mainwindow(apoly, title, nofill, fcolor);
|
mainwindow(app.activeWindow(), apoly, title, nofill, fcolor);
|
||||||
|
|
||||||
#if !defined(CGAL_TEST_SUITE)
|
#if !defined(CGAL_TEST_SUITE)
|
||||||
mainwindow.show();
|
mainwindow.show();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue