File: Scene_draw_interface.h

package info (click to toggle)
cgal 6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,912 kB
  • sloc: cpp: 810,858; ansic: 208,477; sh: 493; python: 411; makefile: 286; javascript: 174
file content (84 lines) | stat: -rw-r--r-- 3,021 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright (c) 2009,2010,2012,2015  GeometryFactory Sarl (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1/Three/include/CGAL/Three/Scene_draw_interface.h $
// $Id: include/CGAL/Three/Scene_draw_interface.h b26b07a1242 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s)     : Laurent RINEAU

#ifndef SCENE_DRAW_INTERFACE_H
#define SCENE_DRAW_INTERFACE_H

#include <CGAL/license/Three.h>

#include <QPoint>
#include <QVector3D>
class QKeyEvent;
class QPoint;
namespace CGAL
{
namespace Three {
  class Viewer_interface;
  class Scene_item;


//! Base class to interact with the scene from the viewer.
class Scene_draw_interface {
public:
  virtual ~Scene_draw_interface(){}

  /*! Is called by Viewer::initializeGL(). Allows all the initialization
   * of OpenGL code that needs a context.
   */
  virtual void initializeGL(CGAL::Three::Viewer_interface*) = 0;

  //! \brief draws the items.
  //! It is called by Viewer::draw().
  virtual void draw(CGAL::Three::Viewer_interface*) = 0;
  //!\brief draws the scene in a hidden frame to perform picking.
  //! Is called by Viewer::drawWithNames().
  virtual void drawWithNames(CGAL::Three::Viewer_interface*) = 0;
  //!Pick the point `e` on the screen.
  virtual void setPickedPixel(const QPoint &e) = 0;
  //! \brief manages the key events.
  //! Override this function to perform actions when keys are pressed.
  //! @returns true if the keyEvent executed well.
  //!
  virtual bool keyPressEvent(QKeyEvent* e) = 0;
  //!\brief print theTextItems.
  virtual void printPrimitiveId(QPoint point, CGAL::Three::Viewer_interface*) = 0;
  //!\brief update theTextItems.
  virtual void updatePrimitiveIds(CGAL::Three::Scene_item*) = 0;

  /*!
   * \brief checks if the text at position (x,y,z) is visible or not.
   * \param x the X coordinate of theTextItem's position.
   * \param y the Y coordinate of theTextItem's position.
   * \param z the Z coordinate of theTextItem's position.
   * \param viewer the viewer used to display the Scene.
   * \return true if the TextItem is visible. */
  virtual bool  testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer) = 0;

  ///\brief displays all the vertices ids if there are fewer than max_textItems.
  virtual void printVertexIds() = 0;
  ///\brief displays all the edges ids if there are fewer than max_textItems.
  virtual void printEdgeIds() = 0;
  ///\brief displays all the faces ids if there are fewer than max_textItems.
  virtual void printFaceIds() = 0;
  ///\brief displays all the primitive ids if there are fewer than max_textItems.
  virtual void printAllIds() = 0;

  //!\brief moves the camera orthogonally to the picked face.
  //!
  //! \param point the picked point
  //! \param viewer the active viewer
  virtual void zoomToPosition(QPoint point,
                        CGAL::Three::Viewer_interface* viewer) = 0;
};
}
}
#endif // SCENE_DRAW_INTERFACE_H;