Update basic viewer to use a generic name.

This commit is contained in:
Guillaume Damiand 2017-11-15 12:16:13 +01:00
parent f0a44e2483
commit 2f0f97fa47
6 changed files with 43 additions and 32 deletions

View File

@ -1,9 +1,9 @@
# This file must be included in your CMakeLists.txt to use cgal_map_viewer_qt.h.
# This file must be included in your CMakeLists.txt to use the basic viewer
# You need to link the libraries in your executable by using
# TARGET_LINK_LIBRARIES( myexec ${MAP_VIEWER_LIBRARIES})
# TARGET_LINK_LIBRARIES( myexec ${BASIC_VIEWER_LIBRARIES})
if ( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND)
message(STATUS "NOTICE: Libraries for lcc_viewer not found "
message(STATUS "NOTICE: Libraries for basic viewer not found "
"(CGAL, Qt5, QGLViewer).")
endif( NOT CGAL_FOUND OR NOT CGAL_Qt5_FOUND)
@ -20,14 +20,14 @@ add_definitions(-DQT_NO_KEYWORDS)
include_directories( ${QGLVIEWER_INCLUDE_DIR} )
add_definitions(${QGLVIEWER_DEFINITIONS})
set (MAP_VIEWER_LIBRARIES ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES}
set (BASIC_VIEWER_LIBRARIES ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES}
${OPENGL_gl_LIBRARY}) # ${OPENGL_glu_LIBRARY}
set(MAP_VIEWER_MODULES Xml OpenGL)
set(BASIC_VIEWER_MODULES Xml OpenGL)
ADD_DEFINITIONS("-DCGAL_LCC_USE_VIEWER -DCGAL_LCC_USE_QT")
ADD_DEFINITIONS("-DCGAL_USE_BASIC_VIEWER")
message(STATUS "Libraries for lcc_viewer found. You need to link them "
"in your executable by using "
"TARGET_LINK_LIBRARIES( myexec \${MAP_VIEWER_LIBRARIES})")
"TARGET_LINK_LIBRARIES( myexec \${BASIC_VIEWER_LIBRARIES})")
set(LCC_VIEWER true)
set(USE_BASIC_VIEWER true)

View File

@ -11,14 +11,16 @@ if(POLICY CMP0043)
cmake_policy(SET CMP0043 OLD)
endif()
ADD_DEFINITIONS("-std=c++11")
# If you want to visualize a linear cell complex, you can use the following viewer
# based on qt. Just uncomment the following two lines, plus the lines qt5_use_modules below
# find_package(CGAL COMPONENTS Qt5)
# include("CMakeLCCViewerQt.inc")
find_package(CGAL COMPONENTS Qt5)
include("CMakeBasicViewerQt.inc")
# If you don't want to visualize, use the following line (otherwise comment it)
find_package(CGAL QUIET)
# find_package(CGAL QUIET)
# For Gprof.
# ADD_DEFINITIONS("-pg")
@ -45,21 +47,27 @@ if ( CGAL_FOUND )
add_executable(voronoi_2 voronoi_2.cpp)
target_link_libraries(voronoi_2 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
${MAP_VIEWER_LIBRARIES})
# qt5_use_modules(voronoi_2 ${MAP_VIEWER_MODULES})
${BASIC_VIEWER_LIBRARIES})
if (USE_BASIC_VIEWER)
qt5_use_modules(voronoi_2 ${BASIC_VIEWER_MODULES})
endif(USE_BASIC_VIEWER)
add_executable(voronoi_3 voronoi_3.cpp)
target_link_libraries(voronoi_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
${MAP_VIEWER_LIBRARIES})
# qt5_use_modules(voronoi_3 ${MAP_VIEWER_MODULES})
${BASIC_VIEWER_LIBRARIES})
if (USE_BASIC_VIEWER)
qt5_use_modules(voronoi_3 ${BASIC_VIEWER_MODULES})
endif(USE_BASIC_VIEWER)
create_single_source_cgal_program( "gmap_linear_cell_complex_3.cpp" )
add_executable(linear_cell_complex_3_operations linear_cell_complex_3_operations.cpp)
target_link_libraries(linear_cell_complex_3_operations ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES}
${MAP_VIEWER_LIBRARIES})
# qt5_use_modules(linear_cell_complex_3_operations ${MAP_VIEWER_MODULES})
${BASIC_VIEWER_LIBRARIES})
if (USE_BASIC_VIEWER)
qt5_use_modules(linear_cell_complex_3_operations ${BASIC_VIEWER_MODULES})
endif(USE_BASIC_VIEWER)
else()

View File

@ -3,7 +3,7 @@
#include <vector>
/* If you want to use a viewer, you can use qglviewer. */
#ifdef CGAL_LCC_USE_QT
#ifdef CGAL_USE_BASIC_VIEWER
#include "linear_cell_complex_3_viewer_qt.h"
#endif
@ -54,9 +54,9 @@ void run_test()
lcc.template sew<3>(lcc.template opposite<2>(lcc.next(dh1)),
lcc.other_orientation(lcc.template opposite<2>(lcc.previous(dh3))));
#ifdef CGAL_LCC_USE_VIEWER
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(lcc);
#endif // CGAL_LCC_USE_VIEWER
#endif // CGAL_USE_BASIC_VIEWER
lcc.insert_cell_1_in_cell_2(lcc.next(dh1),
Alpha1<LCC>::run(lcc, lcc.previous(dh1)));
@ -75,9 +75,9 @@ void run_test()
lcc.display_characteristics(std::cout) << ", valid="
<< lcc.is_valid() << std::endl;
#ifdef CGAL_LCC_USE_VIEWER
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(lcc);
#endif // CGAL_LCC_USE_VIEWER
#endif // CGAL_USE_BASIC_VIEWER
}

View File

@ -138,7 +138,10 @@ protected:
CGAL::Color c=ColorFunctor::run(lcc, dh);
face_begin(c);
if (c.red()<60 || c.green()<60 || c.blue()<60)
mono_face_begin();
else
colored_face_begin(c);
cur=dh;
do
@ -159,14 +162,14 @@ protected:
if ( d2!=NULL )
{
Local_point p2 = geomutils.get_point(lcc, d2);
add_segment(p1, p2);
add_mono_segment(p1, p2);
}
}
void compute_vertex(Dart_const_handle dh, bool& empty)
{
Local_point p = geomutils.get_point(lcc, dh);
add_point(p);
add_mono_point(p);
}
void compute_elements()

View File

@ -7,7 +7,7 @@
#include <fstream>
/* If you want to use a viewer, you can use qglviewer. */
#ifdef CGAL_LCC_USE_QT
#ifdef CGAL_USE_BASIC_VIEWER
#include "linear_cell_complex_3_viewer_qt.h"
#endif
@ -57,9 +57,9 @@ void display_voronoi(LCC_2& alcc, Dart_handle adart)
<< alcc.is_valid()
<< std::endl;
#ifdef CGAL_LCC_USE_VIEWER
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(alcc);
#endif // CGAL_LCC_USE_VIEWER
#endif // CGAL_USE_BASIC_VIEWER
}
template<typename LCC, typename TR>

View File

@ -6,7 +6,7 @@
#include <fstream>
/* If you want to use a viewer, you can use one qglviewer. */
#ifdef CGAL_LCC_USE_QT
#ifdef CGAL_USE_BASIC_VIEWER
#include "linear_cell_complex_3_viewer_qt.h"
#endif
@ -60,9 +60,9 @@ void display_voronoi(LCC_3& alcc, Dart_handle adart)
<< alcc.is_valid()
<< std::endl;
#ifdef CGAL_LCC_USE_VIEWER
#ifdef CGAL_USE_BASIC_VIEWER
display_lcc(alcc);
#endif // CGAL_LCC_USE_VIEWER
#endif // CGAL_USE_BASIC_VIEWER
}
template<typename LCC, typename TR>