Developer Documentation

ScriptSettingsVector.cc
1 #include "ScriptSettingsVector.hh"
2 #include "ACG/Utils/ColorConversion.hh"
3
4 ScriptSettingsVector::ScriptSettingsVector()
5 : ScriptSettings(nullptr),
6 widget_(nullptr)
7 {
8 assert(false);
9 }
10
11 ScriptSettingsVector::ScriptSettingsVector(
12 VectorWidget *widget)
13 : ScriptSettings(widget),
14 widget_(widget)
15 {}
16
17 ScriptSettingsVector::ScriptSettingsVector(
18 const ScriptSettingsVector &other)
19 : ScriptSettings(other.widget_),
20 widget_(other.widget_)
21 {}
22
23 ScriptSettingsVector::~ScriptSettingsVector()
24 {}
25
26
27 ScriptSettingsVector::Type ScriptSettingsVector::type() const
28 {
29 if (widget_->vectors_edges_rb->isChecked()) {
30 return Type::Edges;
31 }
32 if (widget_->vectors_strokes_rb->isChecked()) {
33 return Type::Strokes;
34 }
35 if (widget_->vectors_length_color_rb->isChecked()) {
36 return Type::LengthColor;
37 }
38 if (widget_->vectors_colors_rb->isChecked()) {
39 return Type::Rgb;
40 }
41 throw std::logic_error("No radiobutton selected?!");
42 }
43
44 void ScriptSettingsVector::setType(ScriptSettingsVector::Type type)
45 {
46 switch(type)
47 {
48 case Type::Edges:
49 widget_->vectors_edges_rb->setChecked(true);
50 break;
51 case Type::Strokes:
52 widget_->vectors_strokes_rb->setChecked(true);
53 break;
54 case Type::LengthColor:
55 widget_->vectors_length_color_rb->setChecked(true);
56 break;
57 case Type::Rgb:
58 widget_->vectors_colors_rb->setChecked(true);
59 break;
60 }
61 }
62
63 bool ScriptSettingsVector::normalize() const
64 {
65 return widget_->normalize->isChecked();
66 }
67 void ScriptSettingsVector::setNormalize(bool normalize)
68 {
69 widget_->normalize->setChecked(normalize);
70 }
71
72 bool ScriptSettingsVector::doScale() const
73 {
74 return widget_->scale ->isChecked();
75 }
76
77 void ScriptSettingsVector::setDoScale(bool doScale)
78 {
79 widget_->scale ->setChecked(doScale);
80 }
81
82 double ScriptSettingsVector::scaleFactor() const
83 {
84 return widget_->scaleBox->value();
85 }
86
87 void ScriptSettingsVector::setScaleFactor(double scaleFactor)
88 {
89 widget_->scaleBox->setValue(scaleFactor);
90 }
91
92 Vector4 ScriptSettingsVector::lineColor() const
93 {
94 return ACG::to_Vec4d(widget_->lineColor->color());
95 }
96
97 void ScriptSettingsVector::setLineColor(const Vector4 &lineColor)
98 {
99 widget_->lineColor->setColor(ACG::to_QColor(lineColor));
100 }
101
102 double ScriptSettingsVector::lineWidth()
103 {
104 return widget_->lineWidth->value();
105 }
106
107 void ScriptSettingsVector::setLineWidth(double width)
108 {
109 widget_->lineWidth->setValue(width);
110 }
VectorWidget
Definition: VectorWidget.hh:46
ScriptSettings
Definition: ScriptSettings.hh:10
OpenMesh::VectorT
Definition: Vector11T.hh:83
ScriptSettingsVector
Definition: ScriptSettingsVector.hh:11