File: Label.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 (119 lines) | stat: -rw-r--r-- 2,911 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// Copyright (c) 2017 GeometryFactory Sarl (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1/Classification/include/CGAL/Classification/Label.h $
// $Id: include/CGAL/Classification/Label.h b26b07a1242 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s)     : Simon Giraudot

#ifndef CGAL_CLASSIFICATION_LABEL_H
#define CGAL_CLASSIFICATION_LABEL_H

#include <CGAL/license/Classification.h>
#include <CGAL/IO/Color.h>

#include <string>
#include <memory>

namespace CGAL {

namespace Classification {

/// \cond SKIP_IN_MANUAL
class Label_set;
/// \endcond

/*!
\ingroup PkgClassificationLabel

\brief %Classification label (for example: vegetation, ground, etc.).

\note Labels should always be constructed from a `CGAL::Classification::Label_set` object.
*/
class Label
{
private:

  std::string m_name;
  std::size_t m_index;
  std::size_t m_standard_index;
  CGAL::IO::Color m_color;

  friend Label_set;

public:

  /// \cond SKIP_IN_MANUAL
  // Undocumented: Labels should be created by the set
  Label (std::string name, std::size_t index, std::size_t standard_index,
         const CGAL::IO::Color& color)
    : m_name (name), m_index (index), m_standard_index (standard_index)
    , m_color (color)
  { }
  /// \endcond

  /// \name Access
  /// @{

  /*!
    returns the name of the classification label (\a e.g. vegetation).
  */
  const std::string& name() const { return m_name; }

  /*!
    returns the index of the classification label in the label set.

    \note This index cannot be changed by the user and is handled directly by the label set.
  */
  std::size_t index() const { return m_index; }

  /*!
    returns the standard index of the classification label (\a e.g. index in the ASPRS standard).

    \note This index is purely user-oriented and is not used by the classification algorithms.
  */
  std::size_t standard_index() const { return m_standard_index; }

  /*!
    returns the color used to represent the label.

    \note The color is purely user-oriented and is not used by the
    classification algorithms. It is not to be confused with a color
    attribute embedded in a data set which _can_ be used (see
    `Color_channel`).
  */
  const CGAL::IO::Color& color() const { return m_color; }

  /// @}

  /// \name Modification
  /// @{

  void set_name (const std::string& name) { m_name = name; }
  void set_standard_index(std::size_t idx) { m_standard_index = idx; }
  void set_color (const IO::Color& color) { m_color = color; }

  /// @}
};

#ifdef DOXYGEN_RUNNING
/*!
  \ingroup PkgClassificationLabel

  \brief %Handle to a classification `Label`.

  \cgalModels{Handle}
*/
class Label_handle { };
#else
typedef std::shared_ptr<Label> Label_handle;
#endif

} // namespace Classification

} // namespace CGAL

#endif // CGAL_CLASSIFICATION_LABEL_H