mirror of https://github.com/CGAL/cgal
Update all draw_XXX functions to use specialized version, allowing to use different draw in a same program.
This commit is contained in:
parent
6a6ea48789
commit
2c8af2ebcc
|
|
@ -1039,43 +1039,16 @@ private:
|
||||||
QOpenGLShaderProgram rendering_program_p_l;
|
QOpenGLShaderProgram rendering_program_p_l;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace CGAL
|
|
||||||
|
|
||||||
#else // CGAL_USE_BASIC_VIEWER
|
#else // CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
namespace CGAL
|
template<class T>
|
||||||
{
|
void draw(const T& t, const char* ="", bool=false)
|
||||||
|
{
|
||||||
template<class T, class ColorFunctor>
|
std::cerr<<"Impossible to draw, CGAL_USE_BASIC_VIEWER is not defined."<<std::endl;
|
||||||
void draw(const T&, const char*, bool, const ColorFunctor&)
|
}
|
||||||
{
|
|
||||||
std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined."
|
|
||||||
<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void draw(const T&, const char*, bool)
|
|
||||||
{
|
|
||||||
std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined."
|
|
||||||
<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void draw(const T&, const char*)
|
|
||||||
{
|
|
||||||
std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined."
|
|
||||||
<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
void draw(const T&)
|
|
||||||
{
|
|
||||||
std::cerr<<"Impossible to draw because CGAL_USE_BASIC_VIEWER is not defined."
|
|
||||||
<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
|
||||||
|
|
||||||
#endif // CGAL_USE_BASIC_VIEWER
|
#endif // CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
|
} // End namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_BASIC_VIEWER_QT_H
|
#endif // CGAL_BASIC_VIEWER_QT_H
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#ifdef CGAL_USE_BASIC_VIEWER
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
|
#include <CGAL/Linear_cell_complex_base.h>
|
||||||
#include <CGAL/Random.h>
|
#include <CGAL/Random.h>
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
|
|
@ -198,48 +199,43 @@ protected:
|
||||||
const ColorFunctor& m_fcolor;
|
const ColorFunctor& m_fcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class LCC, class ColorFunctor>
|
// Specialization of draw function.
|
||||||
void draw(const LCC& alcc,
|
#define CGAL_LCC_TYPE CGAL::Linear_cell_complex_base \
|
||||||
const char* title,
|
<d_, ambient_dim, Traits_, Items_, Alloc_, Map, Refs, Storage_>
|
||||||
bool nofill,
|
|
||||||
const ColorFunctor& fcolor)
|
template < unsigned int d_, unsigned int ambient_dim,
|
||||||
|
class Traits_,
|
||||||
|
class Items_,
|
||||||
|
class Alloc_,
|
||||||
|
template<unsigned int,class,class,class,class>
|
||||||
|
class Map,
|
||||||
|
class Refs,
|
||||||
|
class Storage_>
|
||||||
|
void draw(const CGAL_LCC_TYPE& alcc,
|
||||||
|
const char* title="LCC for CMap Basic Viewer",
|
||||||
|
bool nofill=false)
|
||||||
{
|
{
|
||||||
#if defined(CGAL_TEST_SUITE)
|
#if defined(CGAL_TEST_SUITE)
|
||||||
bool cgal_test_suite=true;
|
bool cgal_test_suite=true;
|
||||||
#else
|
#else
|
||||||
bool cgal_test_suite=false;
|
bool cgal_test_suite=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!cgal_test_suite)
|
if (!cgal_test_suite)
|
||||||
{
|
{
|
||||||
int argc=1;
|
int argc=1;
|
||||||
const char* argv[2]={"lccviewer","\0"};
|
const char* argv[2]={"lccviewer","\0"};
|
||||||
QApplication app(argc,const_cast<char**>(argv));
|
QApplication app(argc,const_cast<char**>(argv));
|
||||||
SimpleLCCViewerQt<LCC, ColorFunctor> mainwindow(app.activeWindow(),
|
DefaultColorFunctorLCC fcolor;
|
||||||
alcc,
|
SimpleLCCViewerQt<CGAL_LCC_TYPE, DefaultColorFunctorLCC>
|
||||||
title,
|
mainwindow(app.activeWindow(), alcc, title, nofill, fcolor);
|
||||||
nofill,
|
|
||||||
fcolor);
|
|
||||||
mainwindow.show();
|
mainwindow.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class LCC>
|
#undef CGAL_LCC_TYPE
|
||||||
void draw(const LCC& alcc, const char* title, bool nofill)
|
|
||||||
{
|
|
||||||
DefaultColorFunctorLCC c;
|
|
||||||
draw(alcc, title, nofill, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class LCC>
|
|
||||||
void draw(const LCC& alcc, const char* title)
|
|
||||||
{ draw(alcc, title, false); }
|
|
||||||
|
|
||||||
template<class LCC>
|
|
||||||
void draw(const LCC& alcc)
|
|
||||||
{ draw(alcc, "Basic LCC Viewer"); }
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
} // End namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_USE_BASIC_VIEWER
|
#endif // CGAL_USE_BASIC_VIEWER
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#ifdef CGAL_USE_BASIC_VIEWER
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
|
#include <CGAL/Point_set_3.h>
|
||||||
#include <CGAL/Random.h>
|
#include <CGAL/Random.h>
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
|
|
@ -76,33 +77,31 @@ protected:
|
||||||
protected:
|
protected:
|
||||||
const PointSet& pointset;
|
const PointSet& pointset;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class PointSet>
|
// Specialization of draw function.
|
||||||
void draw(const PointSet& apointset, const char* title)
|
template<class P, class V>
|
||||||
|
void draw(const Point_set_3<P, V>& apointset,
|
||||||
|
const char* title="Point_set_3 Basic Viewer")
|
||||||
{
|
{
|
||||||
#if defined(CGAL_TEST_SUITE)
|
#if defined(CGAL_TEST_SUITE)
|
||||||
bool cgal_test_suite=true;
|
bool cgal_test_suite=true;
|
||||||
#else
|
#else
|
||||||
bool cgal_test_suite=false;
|
bool cgal_test_suite=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!cgal_test_suite)
|
if (!cgal_test_suite)
|
||||||
{
|
{
|
||||||
int argc=1;
|
int argc=1;
|
||||||
const char* argv[2]={"point_set_viewer","\0"};
|
const char* argv[2]={"point_set_viewer","\0"};
|
||||||
QApplication app(argc,const_cast<char**>(argv));
|
QApplication app(argc,const_cast<char**>(argv));
|
||||||
SimplePointSetViewerQt<PointSet> mainwindow(app.activeWindow(),
|
SimplePointSetViewerQt<Point_set_3<P, V> > mainwindow(app.activeWindow(),
|
||||||
apointset,
|
apointset,
|
||||||
title);
|
title);
|
||||||
mainwindow.show();
|
mainwindow.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class PointSet>
|
|
||||||
void draw(const PointSet& apointset)
|
|
||||||
{ draw(apointset, "Basic Point_set Viewer"); }
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
} // End namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_USE_BASIC_VIEWER
|
#endif // CGAL_USE_BASIC_VIEWER
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#ifdef CGAL_USE_BASIC_VIEWER
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
|
#include <CGAL/Polyhedron_3.h>
|
||||||
#include <CGAL/Random.h>
|
#include <CGAL/Random.h>
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
|
|
@ -193,45 +194,40 @@ protected:
|
||||||
bool m_nofaces;
|
bool m_nofaces;
|
||||||
const ColorFunctor& m_fcolor;
|
const ColorFunctor& m_fcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class Polyhedron, class ColorFunctor>
|
// Specialization of draw function.
|
||||||
void draw(const Polyhedron& apoly,
|
#define CGAL_POLY_TYPE CGAL::Polyhedron_3 \
|
||||||
const char* title,
|
<PolyhedronTraits_3, PolyhedronItems_3, T_HDS, Alloc>
|
||||||
bool nofill,
|
|
||||||
const ColorFunctor& fcolor)
|
template<class PolyhedronTraits_3,
|
||||||
{
|
class PolyhedronItems_3,
|
||||||
|
template < class T, class I, class A>
|
||||||
|
class T_HDS,
|
||||||
|
class Alloc>
|
||||||
|
void draw(const CGAL_POLY_TYPE& apoly,
|
||||||
|
const char* title="Polyhedron Basic Viewer",
|
||||||
|
bool nofill=false)
|
||||||
|
{
|
||||||
#if defined(CGAL_TEST_SUITE)
|
#if defined(CGAL_TEST_SUITE)
|
||||||
bool cgal_test_suite=true;
|
bool cgal_test_suite=true;
|
||||||
#else
|
#else
|
||||||
bool cgal_test_suite=false;
|
bool cgal_test_suite=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!cgal_test_suite)
|
if (!cgal_test_suite)
|
||||||
{
|
{
|
||||||
int argc=1;
|
int argc=1;
|
||||||
const char* argv[2]={"polyhedron_viewer","\0"};
|
const char* argv[2]={"polyhedron_viewer","\0"};
|
||||||
QApplication app(argc,const_cast<char**>(argv));
|
QApplication app(argc,const_cast<char**>(argv));
|
||||||
SimplePolyhedronViewerQt<Polyhedron, ColorFunctor>
|
DefaultColorFunctorPolyhedron fcolor;
|
||||||
|
SimplePolyhedronViewerQt<CGAL_POLY_TYPE, DefaultColorFunctorPolyhedron>
|
||||||
mainwindow(app.activeWindow(), apoly, title, nofill, fcolor);
|
mainwindow(app.activeWindow(), apoly, title, nofill, fcolor);
|
||||||
mainwindow.show();
|
mainwindow.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Polyhedron>
|
#undef CGAL_POLY_TYPE
|
||||||
void draw(const Polyhedron& apoly, const char* title, bool nofill)
|
|
||||||
{
|
|
||||||
DefaultColorFunctorPolyhedron c;
|
|
||||||
draw(apoly, title, nofill, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Polyhedron>
|
|
||||||
void draw(const Polyhedron& apoly, const char* title)
|
|
||||||
{ draw(apoly, title, false); }
|
|
||||||
|
|
||||||
template<class Polyhedron>
|
|
||||||
void draw(const Polyhedron& apoly)
|
|
||||||
{ draw(apoly, "Basic Polyhedron Viewer"); }
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
} // End namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ void draw(const SM& asm);
|
||||||
|
|
||||||
#ifdef CGAL_USE_BASIC_VIEWER
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
|
#include <CGAL/Surface_mesh.h>
|
||||||
#include <CGAL/Random.h>
|
#include <CGAL/Random.h>
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
|
|
@ -201,48 +202,31 @@ protected:
|
||||||
const ColorFunctor& m_fcolor;
|
const ColorFunctor& m_fcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class SM, class ColorFunctor>
|
// Specialization of draw function.
|
||||||
void draw(const SM& amesh,
|
template<class K>
|
||||||
const char* title,
|
void draw(const Surface_mesh<K>& amesh,
|
||||||
bool nofill,
|
const char* title="Surface_mesh Basic Viewer",
|
||||||
const ColorFunctor& fcolor)
|
bool nofill=false)
|
||||||
{
|
{
|
||||||
#if defined(CGAL_TEST_SUITE)
|
#if defined(CGAL_TEST_SUITE)
|
||||||
bool cgal_test_suite=true;
|
bool cgal_test_suite=true;
|
||||||
#else
|
#else
|
||||||
bool cgal_test_suite=false;
|
bool cgal_test_suite=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!cgal_test_suite)
|
if (!cgal_test_suite)
|
||||||
{
|
{
|
||||||
int argc=1;
|
int argc=1;
|
||||||
const char* argv[2]={"surface_mesh_viewer","\0"};
|
const char* argv[2]={"surface_mesh_viewer","\0"};
|
||||||
QApplication app(argc,const_cast<char**>(argv));
|
QApplication app(argc,const_cast<char**>(argv));
|
||||||
SimpleSurfaceMeshViewerQt<SM, ColorFunctor> mainwindow(app.activeWindow(),
|
DefaultColorFunctorSM fcolor;
|
||||||
amesh,
|
SimpleSurfaceMeshViewerQt<Surface_mesh<K>, DefaultColorFunctorSM>
|
||||||
title,
|
mainwindow(app.activeWindow(), amesh, title, nofill, fcolor);
|
||||||
nofill,
|
|
||||||
fcolor);
|
|
||||||
mainwindow.show();
|
mainwindow.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SM>
|
|
||||||
void draw(const SM& amesh, const char* title, bool nofill)
|
|
||||||
{
|
|
||||||
DefaultColorFunctorSM c;
|
|
||||||
draw(amesh, title, nofill, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class SM>
|
|
||||||
void draw(const SM& amesh, const char* title)
|
|
||||||
{ draw(amesh, title, false); }
|
|
||||||
|
|
||||||
template<class SM>
|
|
||||||
void draw(const SM& amesh)
|
|
||||||
{ draw(amesh, "Basic Surface_mesh Viewer"); }
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
} // End namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_USE_BASIC_VIEWER
|
#endif // CGAL_USE_BASIC_VIEWER
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#ifdef CGAL_USE_BASIC_VIEWER
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
|
#include <CGAL/Triangulation_2.h>
|
||||||
#include <CGAL/Random.h>
|
#include <CGAL/Random.h>
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
|
|
@ -135,48 +136,35 @@ protected:
|
||||||
bool m_nofaces;
|
bool m_nofaces;
|
||||||
const ColorFunctor& m_fcolor;
|
const ColorFunctor& m_fcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Specialization of draw function.
|
||||||
|
#define CGAL_T2_TYPE CGAL::Triangulation_2<Gt, Tds>
|
||||||
|
|
||||||
template<class T2, class ColorFunctor>
|
template<class Gt, class Tds>
|
||||||
void draw(const T2& at2,
|
void draw(const CGAL_T2_TYPE& at2,
|
||||||
const char* title,
|
const char* title="Triangulation_2 Basic Viewer",
|
||||||
bool nofill,
|
bool nofill=false)
|
||||||
const ColorFunctor& fcolor)
|
|
||||||
{
|
{
|
||||||
#if defined(CGAL_TEST_SUITE)
|
#if defined(CGAL_TEST_SUITE)
|
||||||
bool cgal_test_suite=true;
|
bool cgal_test_suite=true;
|
||||||
#else
|
#else
|
||||||
bool cgal_test_suite=false;
|
bool cgal_test_suite=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!cgal_test_suite)
|
if (!cgal_test_suite)
|
||||||
{
|
{
|
||||||
int argc=1;
|
int argc=1;
|
||||||
const char* argv[2]={"t2_viewer","\0"};
|
const char* argv[2]={"t2_viewer","\0"};
|
||||||
QApplication app(argc,const_cast<char**>(argv));
|
QApplication app(argc,const_cast<char**>(argv));
|
||||||
SimpleTriangulation2ViewerQt<T2, ColorFunctor> mainwindow(app.activeWindow(),
|
DefaultColorFunctorT2 fcolor;
|
||||||
at2,
|
SimpleTriangulation2ViewerQt<CGAL_T2_TYPE, DefaultColorFunctorT2>
|
||||||
title,
|
mainwindow(app.activeWindow(), at2, title, nofill, fcolor);
|
||||||
nofill,
|
|
||||||
fcolor);
|
|
||||||
mainwindow.show();
|
mainwindow.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T2>
|
#undef CGAL_T2_TYPE
|
||||||
void draw(const T2& at2, const char* title, bool nofill)
|
|
||||||
{
|
|
||||||
DefaultColorFunctorT2 c;
|
|
||||||
draw(at2, title, nofill, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T2>
|
|
||||||
void draw(const T2& at2, const char* title)
|
|
||||||
{ draw(at2, title, false); }
|
|
||||||
|
|
||||||
template<class T2>
|
|
||||||
void draw(const T2& at2)
|
|
||||||
{ draw(at2, "Basic T2 Viewer"); }
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
} // End namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#ifdef CGAL_USE_BASIC_VIEWER
|
#ifdef CGAL_USE_BASIC_VIEWER
|
||||||
|
|
||||||
|
#include <CGAL/Triangulation_3.h>
|
||||||
#include <CGAL/Random.h>
|
#include <CGAL/Random.h>
|
||||||
|
|
||||||
namespace CGAL
|
namespace CGAL
|
||||||
|
|
@ -141,49 +142,35 @@ protected:
|
||||||
bool m_nofaces;
|
bool m_nofaces;
|
||||||
const ColorFunctor& m_fcolor;
|
const ColorFunctor& m_fcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T3, class ColorFunctor>
|
|
||||||
void draw(const T3& at3,
|
|
||||||
const char* title,
|
|
||||||
bool nofill,
|
|
||||||
const ColorFunctor& fcolor)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
// Specialization of draw function.
|
||||||
|
#define CGAL_T3_TYPE CGAL::Triangulation_3<Gt, Tds, Lock_data_structure>
|
||||||
|
|
||||||
|
template<class Gt, class Tds, class Lock_data_structure>
|
||||||
|
void draw(const CGAL_T3_TYPE& at3,
|
||||||
|
const char* title="T3 Basic Viewer",
|
||||||
|
bool nofill=false)
|
||||||
|
{
|
||||||
#if defined(CGAL_TEST_SUITE)
|
#if defined(CGAL_TEST_SUITE)
|
||||||
bool cgal_test_suite=true;
|
bool cgal_test_suite=true;
|
||||||
#else
|
#else
|
||||||
bool cgal_test_suite=false;
|
bool cgal_test_suite=false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!cgal_test_suite)
|
if (!cgal_test_suite)
|
||||||
{
|
{
|
||||||
int argc=1;
|
int argc=1;
|
||||||
const char* argv[2]={"t3_viewer","\0"};
|
const char* argv[2]={"t3_viewer","\0"};
|
||||||
QApplication app(argc,const_cast<char**>(argv));
|
QApplication app(argc,const_cast<char**>(argv));
|
||||||
SimpleTriangulation3ViewerQt<T3, ColorFunctor> mainwindow(app.activeWindow(),
|
DefaultColorFunctorT3 fcolor;
|
||||||
at3,
|
SimpleTriangulation3ViewerQt<CGAL_T3_TYPE, DefaultColorFunctorT3>
|
||||||
title,
|
mainwindow(app.activeWindow(), at3, title, nofill, fcolor);
|
||||||
nofill,
|
|
||||||
fcolor);
|
|
||||||
mainwindow.show();
|
mainwindow.show();
|
||||||
app.exec();
|
app.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T3>
|
#undef CGAL_T3_TYPE
|
||||||
void draw(const T3& at3, const char* title, bool nofill)
|
|
||||||
{
|
|
||||||
DefaultColorFunctorT3 c;
|
|
||||||
draw(at3, title, nofill, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T3>
|
|
||||||
void draw(const T3& at3, const char* title)
|
|
||||||
{ draw(at3, title, false); }
|
|
||||||
|
|
||||||
template<class T3>
|
|
||||||
void draw(const T3& at3)
|
|
||||||
{ draw(at3, "Basic T3 Viewer"); }
|
|
||||||
|
|
||||||
} // End namespace CGAL
|
} // End namespace CGAL
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue