1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Compare commits

..

No commits in common. "7bd03b0f2eb124f1ddd573ca043748b161863e16" and "cc20a9cd595c523e3e8a3b9085012c96565ee6c1" have entirely different histories.

2 changed files with 7 additions and 37 deletions

View File

@ -241,13 +241,11 @@ void Style::area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
reader.skipCurrentElement();
}
void Style::line(QXmlStreamReader &reader, const QString &dir, qreal ratio,
qreal baseStrokeWidth, const Rule &rule)
void Style::line(QXmlStreamReader &reader, qreal baseStrokeWidth,
const Rule &rule)
{
PathRender ri(rule, _paths.size() + _circles.size() + _hillShading.isValid());
const QXmlStreamAttributes &attr = reader.attributes();
QString file;
int height = 0, width = 0, percent = 100;
bool ok;
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)
_paths.append(ri);
@ -577,7 +549,7 @@ void Style::rule(QXmlStreamReader &reader, const QString &dir,
else if (reader.name() == QLatin1String("area"))
area(reader, dir, ratio, baseStrokeWidth, r);
else if (reader.name() == QLatin1String("line"))
line(reader, dir, ratio, baseStrokeWidth, r);
line(reader, baseStrokeWidth, r);
else if (reader.name() == QLatin1String("circle"))
circle(reader, baseStrokeWidth, r);
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
{
if (!_img.isNull() || _strokeColor.isValid()) {
if (_strokeColor.isValid()) {
qreal width = (_scale > None && zoom >= 12)
? pow(1.5, zoom - 12) * _strokeWidth : _strokeWidth;
QBrush brush = _img.isNull() ? QBrush(_strokeColor) : QBrush(_img);
QPen p(brush, width, Qt::SolidLine, _strokeCap, _strokeJoin);
QPen p(QBrush(_strokeColor), width, Qt::SolidLine, _strokeCap,
_strokeJoin);
if (!_strokeDasharray.isEmpty()) {
QVector<qreal>pattern(_strokeDasharray);
for (int i = 0; i < _strokeDasharray.size(); i++) {

View File

@ -173,7 +173,6 @@ public:
QVector<qreal> _strokeDasharray;
Qt::PenCapStyle _strokeCap;
Qt::PenJoinStyle _strokeJoin;
QImage _img;
QBrush _brush;
bool _area, _curve;
Scale _scale;
@ -321,8 +320,7 @@ private:
const Rule &parent);
void area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
qreal baseStrokeWidth, const Rule &rule);
void line(QXmlStreamReader &reader, const QString &dir, qreal ratio,
qreal baseStrokeWidth, const Rule &rule);
void line(QXmlStreamReader &reader, qreal baseStrokeWidth, const Rule &rule);
void circle(QXmlStreamReader &reader, qreal baseStrokeWidth,
const Rule &rule);
void hillshading(QXmlStreamReader &reader, const QSet<QString> &cats);