1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-21 20:59:11 +02:00

Compare commits

..

No commits in common. "4bcbce671d6b63a78fc93dbd6310d7a8ca098350" and "6ce2a63a1ca6e003aa6736e7a3297bb31f671258" have entirely different histories.

4 changed files with 24 additions and 31 deletions

View File

@ -845,22 +845,22 @@
<message> <message>
<location filename="../src/GUI/gui.cpp" line="882"/> <location filename="../src/GUI/gui.cpp" line="882"/>
<source>Zoom in</source> <source>Zoom in</source>
<translation>Zoom inn</translation> <translation>Forstørr</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/gui.cpp" line="884"/> <location filename="../src/GUI/gui.cpp" line="884"/>
<source>Zoom out</source> <source>Zoom out</source>
<translation>Zoom ut</translation> <translation>Forminsk</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/gui.cpp" line="886"/> <location filename="../src/GUI/gui.cpp" line="886"/>
<source>Digital zoom</source> <source>Digital zoom</source>
<translation>Digital zoom</translation> <translation>Digital forstørrelse</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/gui.cpp" line="887"/> <location filename="../src/GUI/gui.cpp" line="887"/>
<source>Zoom</source> <source>Zoom</source>
<translation>Zoom</translation> <translation>Forstørr</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/gui.cpp" line="888"/> <location filename="../src/GUI/gui.cpp" line="888"/>
@ -1822,12 +1822,12 @@
<message> <message>
<location filename="../src/GUI/optionsdialog.cpp" line="662"/> <location filename="../src/GUI/optionsdialog.cpp" line="662"/>
<source>The printed area is approximately the display area. The map zoom level does not change.</source> <source>The printed area is approximately the display area. The map zoom level does not change.</source>
<translation>Det utskrevne området er omtrent det samme som visningsområdet. Kartets zoomnivå endres ikke.</translation> <translation>Det utskrevne området er omtrent det samme som visningsområdet. Kartforstørrelsesnivået endrer seg ikke.</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/optionsdialog.cpp" line="664"/> <location filename="../src/GUI/optionsdialog.cpp" line="664"/>
<source>The zoom level will be changed so that the whole content (tracks/waypoints) fits to the printed area and the map resolution is as close as possible to the print resolution.</source> <source>The zoom level will be changed so that the whole content (tracks/waypoints) fits to the printed area and the map resolution is as close as possible to the print resolution.</source>
<translation>Zoomnivået vil endres slik at hele innholdet (spor/veipunkter) passer med utskrevet område og kartoppløsningen er lik utskriftsoppløsningen som mulig.</translation> <translation>Forstørrelsesnivået vil endres slik at hele innholdet (spor/veipunkter) passer med utskrevet område, og kartoppløsningen er lik utskriftsoppløsningen som mulig.</translation>
</message> </message>
<message> <message>
<location filename="../src/GUI/optionsdialog.cpp" line="680"/> <location filename="../src/GUI/optionsdialog.cpp" line="680"/>

View File

@ -302,17 +302,17 @@ void RasterTile::processPolygons(const QList<MapData::Poly> &polygons,
} }
void RasterTile::processLines(QList<MapData::Poly> &lines, void RasterTile::processLines(QList<MapData::Poly> &lines,
QList<TextItem*> &textItems, const QImage (&arrows)[2]) QList<TextItem*> &textItems, const QImage &arrow, const QImage &waterArrow)
{ {
std::stable_sort(lines.begin(), lines.end()); std::stable_sort(lines.begin(), lines.end());
if (_zoom >= 22) if (_zoom >= 22)
processStreetNames(lines, textItems, arrows); processStreetNames(lines, textItems, arrow, waterArrow);
processShields(lines, textItems); processShields(lines, textItems);
} }
void RasterTile::processStreetNames(const QList<MapData::Poly> &lines, void RasterTile::processStreetNames(const QList<MapData::Poly> &lines,
QList<TextItem*> &textItems, const QImage (&arrows)[2]) QList<TextItem*> &textItems, const QImage &arrow, const QImage &waterArrow)
{ {
for (int i = 0; i < lines.size(); i++) { for (int i = 0; i < lines.size(); i++) {
const MapData::Poly &poly = lines.at(i); const MapData::Poly &poly = lines.at(i);
@ -320,6 +320,9 @@ void RasterTile::processStreetNames(const QList<MapData::Poly> &lines,
if (style.img().isNull() && style.foreground() == Qt::NoPen) if (style.img().isNull() && style.foreground() == Qt::NoPen)
continue; continue;
if (poly.label.text().isEmpty()
|| style.textFontSize() == Style::None)
continue;
const QFont *fnt = font(style.textFontSize(), Style::Small); const QFont *fnt = font(style.textFontSize(), Style::Small);
const QColor *color = style.textColor().isValid() const QColor *color = style.textColor().isValid()
@ -327,15 +330,10 @@ void RasterTile::processStreetNames(const QList<MapData::Poly> &lines,
const QColor *hColor = Style::isContourLine(poly.type) ? 0 : &haloColor; const QColor *hColor = Style::isContourLine(poly.type) ? 0 : &haloColor;
const QImage *img = poly.oneway const QImage *img = poly.oneway
? Style::isWaterLine(poly.type) ? Style::isWaterLine(poly.type)
? &arrows[1] : &arrows[0] : 0; ? &waterArrow : &arrow : 0;
const QString *label = poly.label.text().isEmpty()
? 0 : &poly.label.text();
if (!img && (!label || !fnt)) TextPathItem *item = new TextPathItem(poly.points,
continue; &poly.label.text(), _rect, fnt, color, hColor, img);
TextPathItem *item = new TextPathItem(poly.points, label, _rect, fnt,
color, hColor, img);
if (item->isValid() && !item->collides(textItems)) if (item->isValid() && !item->collides(textItems))
textItems.append(item); textItems.append(item);
else { else {
@ -477,11 +475,9 @@ void RasterTile::render()
QList<MapData::Poly> lines; QList<MapData::Poly> lines;
QList<MapData::Point> points; QList<MapData::Point> points;
QList<TextItem*> textItems; QList<TextItem*> textItems;
QImage arrows[2]; QImage arrow = (_ratio >= 2)
arrows[0] = (_ratio >= 2)
? QImage(":/map/arrow@2x.png") : QImage(":/map/arrow.png"); ? QImage(":/map/arrow@2x.png") : QImage(":/map/arrow.png");
arrows[1] = (_ratio >= 2) QImage waterArrow = (_ratio >= 2)
? QImage(":/map/water-arrow@2x.png") : QImage(":/map/water-arrow.png"); ? QImage(":/map/water-arrow@2x.png") : QImage(":/map/water-arrow.png");
fetchData(polygons, lines, points); fetchData(polygons, lines, points);
@ -491,7 +487,7 @@ void RasterTile::render()
processPoints(points, textItems); processPoints(points, textItems);
processPolygons(polygons, textItems); processPolygons(polygons, textItems);
processLines(lines, textItems, arrows); processLines(lines, textItems, arrow, waterArrow);
_pixmap.setDevicePixelRatio(_ratio); _pixmap.setDevicePixelRatio(_ratio);
_pixmap.fill(Qt::transparent); _pixmap.fill(Qt::transparent);

View File

@ -44,14 +44,14 @@ private:
void processPolygons(const QList<MapData::Poly> &polygons, void processPolygons(const QList<MapData::Poly> &polygons,
QList<TextItem *> &textItems); QList<TextItem *> &textItems);
void processLines(QList<MapData::Poly> &lines, QList<TextItem*> &textItems, void processLines(QList<MapData::Poly> &lines,
const QImage (&arrows)[2]); QList<TextItem*> &textItems, const QImage &arrow, const QImage &waterArrow);
void processPoints(QList<MapData::Point> &points, void processPoints(QList<MapData::Point> &points,
QList<TextItem*> &textItems); QList<TextItem*> &textItems);
void processShields(const QList<MapData::Poly> &lines, void processShields(const QList<MapData::Poly> &lines,
QList<TextItem*> &textItems); QList<TextItem*> &textItems);
void processStreetNames(const QList<MapData::Poly> &lines, void processStreetNames(const QList<MapData::Poly> &lines,
QList<TextItem*> &textItems, const QImage (&arrows)[2]); QList<TextItem*> &textItems, const QImage &arrow, const QImage &waterArrow);
Projection _proj; Projection _proj;
Transform _transform; Transform _transform;

View File

@ -263,15 +263,12 @@ template<class T>
void TextPathItem::init(const T &line, const QRect &tileRect) void TextPathItem::init(const T &line, const QRect &tileRect)
{ {
qreal cw, mw, textWidth; qreal cw, mw, textWidth;
bool label = _text && _font;
Q_ASSERT(label || _img); if (_text && _img) {
if (label && _img) {
cw = _font->pixelSize() * CHAR_RATIO; cw = _font->pixelSize() * CHAR_RATIO;
mw = _font->pixelSize() / 2.0; mw = _font->pixelSize() / 2.0;
textWidth = _text->size() * cw + _img->width() + PADDING; textWidth = _text->size() * cw + _img->width() + PADDING;
} else if (label) { } else if (_text) {
cw = _font->pixelSize() * CHAR_RATIO; cw = _font->pixelSize() * CHAR_RATIO;
mw = _font->pixelSize() / 2.0; mw = _font->pixelSize() / 2.0;
textWidth = _text->size() * cw; textWidth = _text->size() * cw;
@ -331,7 +328,7 @@ void TextPathItem::paint(QPainter *painter) const
painter->restore(); painter->restore();
} }
if (_text && _font) { if (_text) {
QFontMetrics fm(*_font); QFontMetrics fm(*_font);
int textWidth = fm.boundingRect(*_text).width(); int textWidth = fm.boundingRect(*_text).width();
int imgWidth = _img ? _img->width() + PADDING : 0; int imgWidth = _img ? _img->width() + PADDING : 0;