File: Scene_polylines_item.h

package info (click to toggle)
cgal 6.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 144,952 kB
  • sloc: cpp: 811,597; ansic: 208,576; sh: 493; python: 411; makefile: 286; javascript: 174
file content (89 lines) | stat: -rw-r--r-- 2,609 bytes parent folder | download | duplicates (2)
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
85
86
87
88
89
#ifndef SCENE_POLYLINES_ITEM_H
#define SCENE_POLYLINES_ITEM_H
#include "Scene_polylines_item_config.h"
#include <CGAL/Three/Viewer_interface.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Three/Scene_group_item.h>

#include <QString>
#include <QMenu>

#include <list>
#include <vector>

struct Scene_polylines_item_private;
class Scene_spheres_item;

class SCENE_POLYLINES_ITEM_EXPORT Scene_polylines_item
    : public CGAL::Three::Scene_group_item
{
    Q_OBJECT
public:
    typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
    typedef K::Point_3 Point_3;
    typedef std::vector<Point_3> Polyline;
    typedef std::list<Polyline> Polylines_container;

    Scene_polylines_item();
    virtual ~Scene_polylines_item();
    enum STATS {
      NB_VERTICES = 0,
      NB_EDGES,
      MIN_LENGTH,
      MAX_LENGTH,
      MEAN_LENGTH
    };
    bool has_stats()const override {return true;}
    QString computeStats(int type)override ;
    CGAL::Three::Scene_item::Header_data header() const override ;

    bool isFinite() const override { return true; }
    bool isEmpty() const override ;
    void compute_bbox() const override ;
    Bbox bbox() const override ;

    Scene_polylines_item* clone() const override ;

    QString toolTip() const override ;

    // Indicate if rendering mode is supported
    bool supportsRenderingMode(RenderingMode m) const override ;

    QMenu* contextMenu() override ;

    void draw(CGAL::Three::Viewer_interface*) const override ;
    void drawEdges(CGAL::Three::Viewer_interface*) const override ;
    void drawPoints(CGAL::Three::Viewer_interface*) const override ;


    void smooth(std::vector<Point_3>& polyline);
    //When selecting a polylineitem, we don't want to select its children, so
    //we can still apply Operations to it
    QList<Scene_interface::Item_id> getChildrenForSelection() const override {
      return QList<Scene_interface::Item_id>();
    }
    void setWidth(int i);
    void computeElements() const override;
    void initializeBuffers(Viewer_interface *) const override;

public Q_SLOTS:
    void invalidateOpenGLBuffers() override;
    void change_corner_radii(double);
    void change_corner_radii();
    void split_at_sharp_angles();
    void reset_spheres();

    void merge(Scene_polylines_item*);

    void smooth();
    void point_set_from_polyline();
public:
    Polylines_container polylines;
protected:
    // https://en.wikipedia.org/wiki/D-pointer
    friend struct Scene_polylines_item_private;
    Scene_polylines_item_private* d;

}; // end class Scene_polylines_item

#endif