TBTK
Decoration.h
Go to the documentation of this file.
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 
23 #ifndef COM_DAFER45_TBTK_DECORATION
24 #define COM_DAFER45_TBTK_DECORATION
25 
26 #include <vector>
27 
28 namespace TBTK{
29 namespace Plot{
30 
31 class Decoration{
32 public:
34  enum class LineStyle {Line, Point};
35 
37  Decoration();
38 
40  Decoration(
41  const std::vector<unsigned char> &color,
42  LineStyle lineStyle,
43  unsigned int size = 1
44  );
45 
47  ~Decoration();
48 
50  void setColor(const std::vector<unsigned char> &color);
51 
53  const std::vector<unsigned char>& getColor() const;
54 
56  const LineStyle& getLineStyle() const;
57 
59  unsigned int getSize() const;
60 private:
62  std::vector<unsigned char> color;
63 
65  LineStyle lineStyle;
66 
68  unsigned int size;
69 };
70 
72  color = {0, 0, 0};
73  lineStyle = LineStyle::Point;
74  size = 1;
75 }
76 
78  const std::vector<unsigned char> &color,
79  LineStyle lineStyle,
80  unsigned int size
81 ){
82  this->color = color;
83  this->lineStyle = lineStyle;
84  this->size = size;
85 }
86 
88 }
89 
90 inline void Decoration::setColor(const std::vector<unsigned char> &color){
91  TBTKAssert(
92  color.size() == 3,
93  "Decoration::setColor()",
94  "Color must have three components but '" << color.size() << "'"
95  << " components given.",
96  ""
97  );
98  this->color = color;
99 }
100 
101 inline const std::vector<unsigned char>& Decoration::getColor() const{
102  return color;
103 }
104 
106  return lineStyle;
107 }
108 
109 inline unsigned int Decoration::getSize() const{
110  return size;
111 }
112 
113 }; //End namespace Plot
114 }; //End namespace TBTK
115 
116 #endif
const LineStyle & getLineStyle() const
Definition: Decoration.h:105
Decoration()
Definition: Decoration.h:71
Definition: Decoration.h:31
unsigned int getSize() const
Definition: Decoration.h:109
~Decoration()
Definition: Decoration.h:87
Definition: Point.h:34
Definition: ModelFactory.h:35
LineStyle
Definition: Decoration.h:34
const std::vector< unsigned char > & getColor() const
Definition: Decoration.h:101
void setColor(const std::vector< unsigned char > &color)
Definition: Decoration.h:90