27 #include "../../../maptools/Utils.h" 28 #include "../../../maptools/Enums.h" 29 #include "../../../se/Stroke.h" 30 #include "../../../se/SvgParameter.h" 31 #include "../../../se/Utils.h" 32 #include "../utils/ColorPickerToolButton.h" 34 #include "ui_BasicStrokeWidgetForm.h" 44 m_ui(new
Ui::BasicStrokeWidgetForm),
45 m_stroke(new
te::se::Stroke)
54 QGridLayout* layout =
new QGridLayout(
m_ui->m_colorPickerFrame);
55 layout->setContentsMargins(0, 0, 0, 0);
56 layout->setSizeConstraint(QLayout::SetFixedSize);
121 m_ui->m_miterJoinPushButton->setIcon(QIcon::fromTheme(
"stroke-join-miter"));
122 m_ui->m_roundJoinPushButton->setIcon(QIcon::fromTheme(
"stroke-join-round"));
123 m_ui->m_bevelJoinPushButton->setIcon(QIcon::fromTheme(
"stroke-join-bevel"));
125 m_ui->m_buttCapPushButton->setIcon(QIcon::fromTheme(
"stroke-cap-butt"));
126 m_ui->m_roundCapPushButton->setIcon(QIcon::fromTheme(
"stroke-cap-round"));
127 m_ui->m_squareCapPushButton->setIcon(QIcon::fromTheme(
"stroke-cap-square"));
140 m_ui->m_strokeOpacitySlider->setValue(
m_color.alphaF() * 100);
171 std::vector<std::string>::iterator it;
176 m_ui->m_strokeDashComboBox->setCurrentIndex(i);
186 m_ui->m_strokeDashComboBox->setCurrentIndex(i);
194 m_ui->m_roundJoinPushButton->setChecked(
true);
196 m_ui->m_bevelJoinPushButton->setChecked(
true);
203 m_ui->m_roundCapPushButton->setChecked(
true);
205 m_ui->m_squareCapPushButton->setChecked(
true);
211 m_ui->m_strokeDashComboBox->clear();
217 m_ui->m_strokeDashComboBox->setIconSize(size);
220 QLine
line(0, size.height() * 0.5, size.width(), size.height() * 0.5);
227 std::vector<std::string>::iterator it =
m_dashes.begin();
230 QPixmap pixmap(size);
231 pixmap.fill(Qt::transparent);
233 QPainter painter(&pixmap);
235 std::string pattern = *it;
236 std::vector<double> dasharray;
239 QVector<qreal> qdasharray = QVector<qreal>::fromStdVector(dasharray);
241 pen.setDashPattern(qdasharray);
243 painter.drawLine(line);
245 m_ui->m_strokeDashComboBox->addItem(pixmap,
"");
252 m_color.setRgb(color.red(), color.green(), color.blue(),
m_color.alpha());
263 double opacity = value / 100.0;
265 m_color.setAlpha(opacity * 255);
284 std::string pattern =
m_dashes[index];
Stroke * clone() const
It creates a new copy of this object.
void getRgba(int *r, int *g, int *b, int *a=0) const
It gets the color value.
const SvgParameter * getLineCap() const
TESEEXPORT void GetColor(const te::se::Stroke *stroke, te::color::RGBAColor &color)
It gets the RGBA color from the Stroke element.
void setWidth(const std::string &width)
const SvgParameter * getLineJoin() const
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
TESEEXPORT double GetDouble(const te::se::ParameterValue *param)
It gets the parameter value as a double.
void setDashArray(const std::string &dasharray)
void setColor(const std::string &color)
#define TE_SE_BEVEL_JOIN
It specifies the value "bevel" for stroke-linejoin parameter.
void setOpacity(const std::string &opacity)
TEMAPEXPORT void GetDashStyle(const std::string &dasharray, std::vector< double > &style)
Converts a dasharray pattern coded by a string to a vector of double.
#define TE_SE_BUTT_CAP
It specifies the value "butt" for stroke-linecap parameter.
int getAlpha() const
It returns the alpha component color value (a value from 0 to 255).
void setLineCap(const std::string &cap)
#define TE_SE_SQUARE_CAP
It specifies the value "square" for stroke-linecap parameter.
#define TE_SE_ROUND_JOIN
It specifies the value "round" for stroke-linejoin parameter.
#define TE_SE_ROUND_CAP
It specifies the value "round" for stroke-linecap parameter.
void setLineJoin(const std::string &join)
const SvgParameter * getDashArray() const
A Stroke specifies the appearance of a linear geometry.
#define TE_SE_MITRE_JOIN
It specifies the value "mitre" for stroke-linejoin parameter.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
#define TE_SE_DEFAULT_STROKE_BASIC_COLOR
It specifies the default color used by stroke basic (solid colors).
A SvgParameter refers to an SVG/CSS graphical-formatting parameter.
TESEEXPORT std::string GetString(const te::se::ParameterValue *param)
It gets the parameter value as a string.
const SvgParameter * getWidth() const