Replace draw_buffer by draw_graphic_storage

This commit is contained in:
Guillaume Damiand 2023-04-28 12:26:31 +02:00
parent 48cfa7ad61
commit 4df2edd9c1
17 changed files with 57 additions and 37 deletions

View File

@ -4,7 +4,7 @@ namespace CGAL {
/*!
\ingroup PkgBasicViewerClasses
The class `Graphic_storage` store points, segments and triangles. Elements can be added, possibly with associated colors. Non triangular faces can be directly added, and triangulated internally.
The class `Graphic_storage` store points, segments and triangles. Elements can be added, possibly with associated colors. Non triangular faces can be directly added, and are triangulated internally.
\tparam BufferType the type used for point coordinates: float by default.
@ -12,55 +12,75 @@ The class `Graphic_storage` store points, segments and triangles. Elements can b
template <typename BufferType=float>
class Graphic_storage
{
template <typename KPoint> void add_point(const KPoint &p);
/// Add the given point in this storage.
template <typename KPoint>
void add_point(const KPoint &p);
/// Add the given colored point in this storage.
template <typename KPoint>
void add_point(const KPoint &p, const CGAL::IO::Color &acolor);
/// Add the given segment in this storage.
template <typename KPoint>
void add_segment(const KPoint &p1, const KPoint &p2);
/// Add the given colored segment in this storage.
template <typename KPoint>
void add_segment(const KPoint &p1, const KPoint &p2,
const CGAL::IO::Color &acolor);
/// Add the given ray in the storage: an half line starting from p and having v as direction.
template <typename KPoint, typename KVector>
void add_ray(const KPoint &p, const KVector &v);
/// Add the given colored ray in the storage: an half line starting from p and having v as direction.
template <typename KPoint, typename KVector>
void add_ray(const KPoint &p, const KVector &v,
const CGAL::IO::Color &acolor);
/// Add the given line in the storage, defined by p and v as direction.
template <typename KPoint, typename KVector>
void add_line(const KPoint &p, const KVector &v);
/// Add the given colored line in the storage, defined by p and v as direction.
template <typename KPoint, typename KVector>
void add_line(const KPoint &p, const KVector &v,
const CGAL::IO::Color &acolor);
/// start a new face.
void face_begin();
/// start a new colored face.
void face_begin(const CGAL::IO::Color &acolor);
/// @return true iff a face is started.
bool is_a_face_started() const;
/// add the given point in the current face.
template <typename KPoint> bool add_point_in_face(const KPoint &kp);
/// add the given point in the current face, having the vertex normal.
template <typename KPoint, typename KVector>
bool add_point_in_face(const KPoint &kp, const KVector &p_normal);
bool is_a_face_started() const;
void face_begin();
void face_begin(const CGAL::IO::Color &acolor);
/// end the current face.
void face_end();
/// @return true iff the storage has no element.
bool is_empty() const;
/// clear the storage, i.e. remove all points, segments, triangles and text.
void clear();
/// add the given text at the given position in the storage.
template <typename KPoint>
void add_text(const KPoint &kp, const char *txt);
/// add the given text at the given position in the storage.
template <typename KPoint>
void add_text(const KPoint &kp, const std::string &txt);
/// clear all the texts.
void m_texts_clear();
};

View File

@ -58,7 +58,7 @@ int main(void)
CGAL::Graphic_storage<float> graphic_buffer;
CGAL::add_in_graphic_buffer(point_set, graphic_buffer, Drawing_functor_green_points());
CGAL::add_in_graphic_buffer(output_mesh, graphic_buffer);
CGAL::draw_buffer(graphic_buffer);
CGAL::draw_graphic_storage(graphic_buffer);
}
else
{ return EXIT_FAILURE; }

View File

@ -1667,7 +1667,7 @@ protected:
};
template <typename BufferType=float>
void draw_buffer(Graphic_storage<BufferType>& graphic_buffer,
void draw_graphic_storage(Graphic_storage<BufferType>& graphic_buffer,
const char *title="CGAL Basic Viewer")
{
#if defined(CGAL_TEST_SUITE)
@ -1692,7 +1692,7 @@ void draw_buffer(Graphic_storage<BufferType>& graphic_buffer,
}
// template <typename BufferType = float>
// void draw_buffer(Graphic_storage<BufferType> &graphic_buffer,
// void draw_graphic_storage(Graphic_storage<BufferType> &graphic_buffer,
// const std::function<bool(QKeyEvent *, CGAL::Basic_viewer_qt<float> *)>& onPress,
// const char *title="CGAL Basic Viewer")
// {

View File

@ -290,7 +290,7 @@ void draw(const CGAL_LCC_TYPE& alcc, const DrawingFunctor& drawing_functor,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(alcc, buffer, drawing_functor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
// Specialization of draw function for a LCC, without a drawing functor.
@ -302,7 +302,7 @@ void draw(const CGAL_LCC_TYPE& alcc, const char *title="LCC Basic Viewer")
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(alcc, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -288,7 +288,7 @@ void draw(const CGAL_NEF3_TYPE &anef,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(anef, buffer, drawing_functor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template <typename Kernel_, typename Items_, typename Mark_,
@ -298,7 +298,7 @@ void draw(const CGAL_NEF3_TYPE &anef,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(anef, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -227,7 +227,7 @@ void draw(const CGAL_P2T2_TYPE& ap2t2,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(ap2t2, buffer, drawing_functor);
draw_buffer(buffer);
draw_graphic_storage(buffer);
}
template<class Gt, class Tds, class BufferType=float>

View File

@ -98,7 +98,7 @@ void draw(const Point_set_3<P, V>& apointset,
{
Graphic_storage<float> buffer;
add_in_graphic_buffer(apointset, buffer, drawing_functor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template <class P, class V>
@ -107,7 +107,7 @@ void draw(const Point_set_3<P, V>& apointset,
{
Graphic_storage<float> buffer;
add_in_graphic_buffer(apointset, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -128,7 +128,7 @@ void draw(const CGAL_P2_TYPE &ap2,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(ap2, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template <class T, class C, class DrawingFunctor>
@ -138,7 +138,7 @@ void draw(const CGAL_P2_TYPE &ap2,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(ap2, buffer, drawingfunctor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -156,7 +156,7 @@ void draw(const CGAL_P2_WITH_HOLES_TYPE& ap2, const DrawingFunctor &drawing_func
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(ap2, buffer, drawing_functor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template<class T, class C, typename BufferType=float>
@ -165,7 +165,7 @@ void draw(const CGAL_P2_WITH_HOLES_TYPE& ap2,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(ap2, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -63,7 +63,7 @@ void draw(const CGAL_POLY_TYPE& apoly,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer_for_fg(apoly, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template<class PolyhedronTraits_3,
@ -79,7 +79,7 @@ void draw(const CGAL_POLY_TYPE& apoly,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer_for_fg(apoly, buffer, drawing_functor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -188,7 +188,7 @@ void draw(const CGAL_SS_TYPE &ass2, const DrawingFunctor &drawingfunctor,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(ass2, buffer, drawingfunctor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template <class K>
@ -197,7 +197,7 @@ void draw(const CGAL_SS_TYPE &ass2,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(ass2, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -59,7 +59,7 @@ void draw(const Surface_mesh<K>& amesh,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer_for_fg(amesh, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template<class K, typename BufferType=float, class DrawingFunctor>
@ -69,7 +69,7 @@ void draw(const Surface_mesh<K>& amesh,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer_for_fg(amesh, buffer, drawing_functor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -411,7 +411,7 @@ void draw(const Mesh& mesh,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(mesh, buffer, &paths, amark);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template<typename Mesh, typename DrawingFunctor, typename BufferType=float>
@ -424,7 +424,7 @@ void draw(const Mesh& mesh,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(mesh, buffer, drawing_functor, &paths, amark);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template<class Mesh, typename BufferType=float >
@ -437,7 +437,7 @@ void draw(const Mesh& mesh,
std::vector<Surface_mesh_topology::Path_on_surface<Mesh>> paths=l;
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(mesh, buffer, &paths, amark);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
} // End namespace CGAL

View File

@ -76,7 +76,7 @@ void draw(const CGAL_CT2_TYPE &ct2, const DrawingFunctor &drawingfunctor,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(ct2, buffer, drawingfunctor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -159,7 +159,7 @@ void draw(const CGAL_T2_TYPE &at2, const DrawingFunctor &drawingfunctor,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(at2, buffer, drawingfunctor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template <class Gt, class Tds>
@ -168,7 +168,7 @@ void draw(const CGAL_T2_TYPE& at2,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(at2, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -163,7 +163,7 @@ void draw(const CGAL_T3_TYPE &at3, const DrawingFunctor &drawingfunctor,
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(at3, buffer, drawingfunctor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template <class Gt, class Tds, class Lock_data_structure>
@ -171,7 +171,7 @@ void draw(const CGAL_T3_TYPE &at3, const char *title="T3 Basic Viewer")
{
CGAL::Graphic_storage<float> buffer;
add_in_graphic_buffer(at3, buffer);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
#endif // CGAL_USE_BASIC_VIEWER

View File

@ -369,7 +369,7 @@ void draw(const CGAL_VORONOI_TYPE& av2,
{
CGAL::Graphic_storage<BufferType> buffer;
add_in_graphic_buffer(av2, buffer, drawing_functor);
draw_buffer(buffer, title);
draw_graphic_storage(buffer, title);
}
template<class DG, class AT, class AP, typename BufferType=float>