mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Compare commits
No commits in common. "7bd03b0f2eb124f1ddd573ca043748b161863e16" and "cc20a9cd595c523e3e8a3b9085012c96565ee6c1" have entirely different histories.
7bd03b0f2e
...
cc20a9cd59
@ -241,13 +241,11 @@ void Style::area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
|||||||
reader.skipCurrentElement();
|
reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Style::line(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
void Style::line(QXmlStreamReader &reader, qreal baseStrokeWidth,
|
||||||
qreal baseStrokeWidth, const Rule &rule)
|
const Rule &rule)
|
||||||
{
|
{
|
||||||
PathRender ri(rule, _paths.size() + _circles.size() + _hillShading.isValid());
|
PathRender ri(rule, _paths.size() + _circles.size() + _hillShading.isValid());
|
||||||
const QXmlStreamAttributes &attr = reader.attributes();
|
const QXmlStreamAttributes &attr = reader.attributes();
|
||||||
QString file;
|
|
||||||
int height = 0, width = 0, percent = 100;
|
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
ri._brush = Qt::NoBrush;
|
ri._brush = Qt::NoBrush;
|
||||||
@ -311,32 +309,6 @@ void Style::line(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attr.hasAttribute("src"))
|
|
||||||
file = resourcePath(attr.value("src").toString(), dir);
|
|
||||||
if (attr.hasAttribute("symbol-height")) {
|
|
||||||
height = attr.value("symbol-height").toInt(&ok);
|
|
||||||
if (!ok || height < 0) {
|
|
||||||
reader.raiseError("invalid symbol-height value");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (attr.hasAttribute("symbol-width")) {
|
|
||||||
width = attr.value("symbol-width").toInt(&ok);
|
|
||||||
if (!ok || width < 0) {
|
|
||||||
reader.raiseError("invalid symbol-width value");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (attr.hasAttribute("symbol-percent")) {
|
|
||||||
percent = attr.value("symbol-percent").toInt(&ok);
|
|
||||||
if (!ok || percent < 0) {
|
|
||||||
reader.raiseError("invalid symbol-percent value");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!file.isNull())
|
|
||||||
ri._img = image(file, width, height, percent, ratio);
|
|
||||||
|
|
||||||
if (ri.rule()._type == Rule::AnyType || ri.rule()._type == Rule::WayType)
|
if (ri.rule()._type == Rule::AnyType || ri.rule()._type == Rule::WayType)
|
||||||
_paths.append(ri);
|
_paths.append(ri);
|
||||||
|
|
||||||
@ -577,7 +549,7 @@ void Style::rule(QXmlStreamReader &reader, const QString &dir,
|
|||||||
else if (reader.name() == QLatin1String("area"))
|
else if (reader.name() == QLatin1String("area"))
|
||||||
area(reader, dir, ratio, baseStrokeWidth, r);
|
area(reader, dir, ratio, baseStrokeWidth, r);
|
||||||
else if (reader.name() == QLatin1String("line"))
|
else if (reader.name() == QLatin1String("line"))
|
||||||
line(reader, dir, ratio, baseStrokeWidth, r);
|
line(reader, baseStrokeWidth, r);
|
||||||
else if (reader.name() == QLatin1String("circle"))
|
else if (reader.name() == QLatin1String("circle"))
|
||||||
circle(reader, baseStrokeWidth, r);
|
circle(reader, baseStrokeWidth, r);
|
||||||
else if (reader.name() == QLatin1String("pathText")) {
|
else if (reader.name() == QLatin1String("pathText")) {
|
||||||
@ -880,11 +852,11 @@ QList<const Style::Symbol*> Style::areaSymbols(int zoom) const
|
|||||||
|
|
||||||
QPen Style::PathRender::pen(int zoom) const
|
QPen Style::PathRender::pen(int zoom) const
|
||||||
{
|
{
|
||||||
if (!_img.isNull() || _strokeColor.isValid()) {
|
if (_strokeColor.isValid()) {
|
||||||
qreal width = (_scale > None && zoom >= 12)
|
qreal width = (_scale > None && zoom >= 12)
|
||||||
? pow(1.5, zoom - 12) * _strokeWidth : _strokeWidth;
|
? pow(1.5, zoom - 12) * _strokeWidth : _strokeWidth;
|
||||||
QBrush brush = _img.isNull() ? QBrush(_strokeColor) : QBrush(_img);
|
QPen p(QBrush(_strokeColor), width, Qt::SolidLine, _strokeCap,
|
||||||
QPen p(brush, width, Qt::SolidLine, _strokeCap, _strokeJoin);
|
_strokeJoin);
|
||||||
if (!_strokeDasharray.isEmpty()) {
|
if (!_strokeDasharray.isEmpty()) {
|
||||||
QVector<qreal>pattern(_strokeDasharray);
|
QVector<qreal>pattern(_strokeDasharray);
|
||||||
for (int i = 0; i < _strokeDasharray.size(); i++) {
|
for (int i = 0; i < _strokeDasharray.size(); i++) {
|
||||||
|
@ -173,7 +173,6 @@ public:
|
|||||||
QVector<qreal> _strokeDasharray;
|
QVector<qreal> _strokeDasharray;
|
||||||
Qt::PenCapStyle _strokeCap;
|
Qt::PenCapStyle _strokeCap;
|
||||||
Qt::PenJoinStyle _strokeJoin;
|
Qt::PenJoinStyle _strokeJoin;
|
||||||
QImage _img;
|
|
||||||
QBrush _brush;
|
QBrush _brush;
|
||||||
bool _area, _curve;
|
bool _area, _curve;
|
||||||
Scale _scale;
|
Scale _scale;
|
||||||
@ -321,8 +320,7 @@ private:
|
|||||||
const Rule &parent);
|
const Rule &parent);
|
||||||
void area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
void area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
||||||
qreal baseStrokeWidth, const Rule &rule);
|
qreal baseStrokeWidth, const Rule &rule);
|
||||||
void line(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
void line(QXmlStreamReader &reader, qreal baseStrokeWidth, const Rule &rule);
|
||||||
qreal baseStrokeWidth, const Rule &rule);
|
|
||||||
void circle(QXmlStreamReader &reader, qreal baseStrokeWidth,
|
void circle(QXmlStreamReader &reader, qreal baseStrokeWidth,
|
||||||
const Rule &rule);
|
const Rule &rule);
|
||||||
void hillshading(QXmlStreamReader &reader, const QSet<QString> &cats);
|
void hillshading(QXmlStreamReader &reader, const QSet<QString> &cats);
|
||||||
|
Loading…
Reference in New Issue
Block a user