mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-21 12:49:10 +02:00
Compare commits
No commits in common. "8b24aa17e261b8bb462218393aed3f861f3659fe" and "20aaf68405f0ee92466866c4ad1f5e805f75cf47" have entirely different histories.
8b24aa17e2
...
20aaf68405
@ -109,9 +109,6 @@ void MapData::computeZooms()
|
|||||||
zooms.insert(z.at(i));
|
zooms.insert(z.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zooms.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
_zooms = zooms.values();
|
_zooms = zooms.values();
|
||||||
std::sort(_zooms.begin(), _zooms.end());
|
std::sort(_zooms.begin(), _zooms.end());
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ void RasterTile::processAreaLabels(QList<TextItem*> &textItems)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!path.path.elementCount())
|
if (!path.path.elementCount())
|
||||||
path.path = painterPath(path.poly, false);
|
path.path = painterPath(path.poly);
|
||||||
|
|
||||||
const QImage *img = si ? &si->img() : 0;
|
const QImage *img = si ? &si->img() : 0;
|
||||||
const QFont *font = ti ? &ti->font() : 0;
|
const QFont *font = ti ? &ti->font() : 0;
|
||||||
@ -232,31 +232,16 @@ void RasterTile::drawTextItems(QPainter *painter,
|
|||||||
textItems.at(i)->paint(painter);
|
textItems.at(i)->paint(painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath RasterTile::painterPath(const Polygon &polygon, bool curve) const
|
QPainterPath RasterTile::painterPath(const Polygon &polygon) const
|
||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
for (int i = 0; i < polygon.size(); i++) {
|
for (int i = 0; i < polygon.size(); i++) {
|
||||||
const QVector<Coordinates> &subpath = polygon.at(i);
|
const QVector<Coordinates> &subpath = polygon.at(i);
|
||||||
|
|
||||||
if (curve) {
|
path.moveTo(ll2xy(subpath.first()));
|
||||||
QPointF p1(ll2xy(subpath.first()));
|
for (int j = 1; j < subpath.size(); j++)
|
||||||
QPointF p2(0, 0);
|
path.lineTo(ll2xy(subpath.at(j)));
|
||||||
QPointF p3(0, 0);
|
|
||||||
|
|
||||||
path.moveTo(p1);
|
|
||||||
for (int j = 1; j < subpath.size(); j++) {
|
|
||||||
p3 = ll2xy(subpath.at(j));
|
|
||||||
p2 = QPointF((p1.x() + p3.x()) / 2.0, (p1.y() + p3.y()) / 2.0);
|
|
||||||
path.quadTo(p1, p2);
|
|
||||||
p1 = p3;
|
|
||||||
}
|
|
||||||
path.quadTo(p2, p3);
|
|
||||||
} else {
|
|
||||||
path.moveTo(ll2xy(subpath.first()));
|
|
||||||
for (int j = 1; j < subpath.size(); j++)
|
|
||||||
path.lineTo(ll2xy(subpath.at(j)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
@ -264,7 +249,7 @@ QPainterPath RasterTile::painterPath(const Polygon &polygon, bool curve) const
|
|||||||
|
|
||||||
QVector<RasterTile::PathInstruction> RasterTile::pathInstructions()
|
QVector<RasterTile::PathInstruction> RasterTile::pathInstructions()
|
||||||
{
|
{
|
||||||
QCache<Key, QVector<const Style::PathRender *> > cache(8192);
|
QCache<Key, QVector<const Style::PathRender *> > cache(1024);
|
||||||
QVector<PathInstruction> instructions;
|
QVector<PathInstruction> instructions;
|
||||||
const Style &s = style(_ratio);
|
const Style &s = style(_ratio);
|
||||||
QVector<const Style::PathRender*> *ri;
|
QVector<const Style::PathRender*> *ri;
|
||||||
@ -315,7 +300,7 @@ void RasterTile::drawPaths(QPainter *painter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is.path()->path.elementCount())
|
if (!is.path()->path.elementCount())
|
||||||
is.path()->path = painterPath(is.path()->poly, ri->curve());
|
is.path()->path = painterPath(is.path()->poly);
|
||||||
|
|
||||||
if (ri->area()) {
|
if (ri->area()) {
|
||||||
lp.setPen(ri->pen(_zoom));
|
lp.setPen(ri->pen(_zoom));
|
||||||
|
@ -76,7 +76,7 @@ private:
|
|||||||
void processPointLabels(QList<TextItem*> &textItems);
|
void processPointLabels(QList<TextItem*> &textItems);
|
||||||
void processAreaLabels(QList<TextItem*> &textItems);
|
void processAreaLabels(QList<TextItem*> &textItems);
|
||||||
void processLineLabels(QList<TextItem*> &textItems);
|
void processLineLabels(QList<TextItem*> &textItems);
|
||||||
QPainterPath painterPath(const Polygon &polygon, bool curve) const;
|
QPainterPath painterPath(const Polygon &polygon) const;
|
||||||
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
|
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
|
||||||
void drawPaths(QPainter *painter);
|
void drawPaths(QPainter *painter);
|
||||||
|
|
||||||
|
@ -169,11 +169,6 @@ void Style::line(QXmlStreamReader &reader, const Rule &rule)
|
|||||||
else if (join == "bevel")
|
else if (join == "bevel")
|
||||||
ri._strokeJoin = Qt::BevelJoin;
|
ri._strokeJoin = Qt::BevelJoin;
|
||||||
}
|
}
|
||||||
if (attr.hasAttribute("curve")) {
|
|
||||||
QString curve(attr.value("curve").toString());
|
|
||||||
if (curve == "cubic")
|
|
||||||
ri._curve = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
_paths.append(ri);
|
_paths.append(ri);
|
||||||
|
|
||||||
@ -188,7 +183,6 @@ void Style::text(QXmlStreamReader &reader, const Rule &rule,
|
|||||||
int fontSize = 9;
|
int fontSize = 9;
|
||||||
bool bold = false, italic = false;
|
bool bold = false, italic = false;
|
||||||
QString fontFamily("Helvetica");
|
QString fontFamily("Helvetica");
|
||||||
QFont::Capitalization capitalization = QFont::MixedCase;
|
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
if (attr.hasAttribute("k"))
|
if (attr.hasAttribute("k"))
|
||||||
@ -229,21 +223,11 @@ void Style::text(QXmlStreamReader &reader, const Rule &rule,
|
|||||||
else if (family == "serif")
|
else if (family == "serif")
|
||||||
fontFamily = "Times New Roman";
|
fontFamily = "Times New Roman";
|
||||||
}
|
}
|
||||||
if (attr.hasAttribute("text-transform")) {
|
|
||||||
QString transform(attr.value("text-transform").toString());
|
|
||||||
if (transform == "uppercase")
|
|
||||||
capitalization = QFont::AllUppercase;
|
|
||||||
else if (transform == "lowercase")
|
|
||||||
capitalization = QFont::AllLowercase;
|
|
||||||
else if (transform == "capitalize")
|
|
||||||
capitalization = QFont::Capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
ri._font.setFamily(fontFamily);
|
ri._font.setFamily(fontFamily);
|
||||||
ri._font.setPixelSize(fontSize);
|
ri._font.setPixelSize(fontSize);
|
||||||
ri._font.setBold(bold);
|
ri._font.setBold(bold);
|
||||||
ri._font.setItalic(italic);
|
ri._font.setItalic(italic);
|
||||||
ri._font.setCapitalization(capitalization);
|
|
||||||
|
|
||||||
if (fontSize)
|
if (fontSize)
|
||||||
for (int i = 0; i < lists.size(); i++)
|
for (int i = 0; i < lists.size(); i++)
|
||||||
|
@ -163,13 +163,12 @@ public:
|
|||||||
public:
|
public:
|
||||||
PathRender(const Rule &rule, int zOrder) : Render(rule),
|
PathRender(const Rule &rule, int zOrder) : Render(rule),
|
||||||
_zOrder(zOrder), _strokeWidth(0), _strokeCap(Qt::RoundCap),
|
_zOrder(zOrder), _strokeWidth(0), _strokeCap(Qt::RoundCap),
|
||||||
_strokeJoin(Qt::RoundJoin), _area(false), _curve(false) {}
|
_strokeJoin(Qt::RoundJoin), _area(false) {}
|
||||||
|
|
||||||
int zOrder() const {return _zOrder;}
|
int zOrder() const {return _zOrder;}
|
||||||
QPen pen(int zoom) const;
|
QPen pen(int zoom) const;
|
||||||
QBrush brush() const;
|
QBrush brush() const;
|
||||||
bool area() const {return _area;}
|
bool area() const {return _area;}
|
||||||
bool curve() const {return _curve;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Style;
|
friend class Style;
|
||||||
@ -181,7 +180,7 @@ public:
|
|||||||
Qt::PenCapStyle _strokeCap;
|
Qt::PenCapStyle _strokeCap;
|
||||||
Qt::PenJoinStyle _strokeJoin;
|
Qt::PenJoinStyle _strokeJoin;
|
||||||
QImage _fillImage;
|
QImage _fillImage;
|
||||||
bool _area, _curve;
|
bool _area;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextRender : public Render
|
class TextRender : public Render
|
||||||
|
Loading…
x
Reference in New Issue
Block a user