TBTK
Need a break? Support the development by playing Polarity Puzzles
Decoration.h
1 /* Copyright 2017 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
17 
24 #ifndef COM_DAFER45_TBTK_PLOT_DECORATION
25 #define COM_DAFER45_TBTK_PLOT_DECORATION
26 
27 #include <vector>
28 
29 namespace TBTK{
30 namespace Plot{
31 
32 class Decoration{
33 public:
35  enum class LineStyle {Line, Point};
36 
38  Decoration();
39 
41  Decoration(
42  const std::vector<unsigned char> &color,
43  LineStyle lineStyle,
44  unsigned int size = 1
45  );
46 
48  ~Decoration();
49 
51  void setColor(const std::vector<unsigned char> &color);
52 
54  const std::vector<unsigned char>& getColor() const;
55 
57  const LineStyle& getLineStyle() const;
58 
60  unsigned int getSize() const;
61 private:
63  std::vector<unsigned char> color;
64 
66  LineStyle lineStyle;
67 
69  unsigned int size;
70 };
71 
72 inline Decoration::Decoration(){
73  color = {0, 0, 0};
74  lineStyle = LineStyle::Point;
75  size = 1;
76 }
77 
78 inline Decoration::Decoration(
79  const std::vector<unsigned char> &color,
80  LineStyle lineStyle,
81  unsigned int size
82 ){
83  this->color = color;
84  this->lineStyle = lineStyle;
85  this->size = size;
86 }
87 
88 inline Decoration::~Decoration(){
89 }
90 
91 inline void Decoration::setColor(const std::vector<unsigned char> &color){
92  TBTKAssert(
93  color.size() == 3,
94  "Decoration::setColor()",
95  "Color must have three components but '" << color.size() << "'"
96  << " components given.",
97  ""
98  );
99  this->color = color;
100 }
101 
102 inline const std::vector<unsigned char>& Decoration::getColor() const{
103  return color;
104 }
105 
106 inline const Decoration::LineStyle& Decoration::getLineStyle() const{
107  return lineStyle;
108 }
109 
110 inline unsigned int Decoration::getSize() const{
111  return size;
112 }
113 
114 }; //End namespace Plot
115 }; //End namespace TBTK
116 
117 #endif
118 
Definition: Boolean.h:32