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>
<location filename="../src/GUI/gui.cpp" line="882"/>
<source>Zoom in</source>
<translation>Zoom inn</translation>
<translation>Forstørr</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="884"/>
<source>Zoom out</source>
<translation>Zoom ut</translation>
<translation>Forminsk</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="886"/>
<source>Digital zoom</source>
<translation>Digital zoom</translation>
<translation>Digital forstørrelse</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="887"/>
<source>Zoom</source>
<translation>Zoom</translation>
<translation>Forstørr</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="888"/>
@ -1822,12 +1822,12 @@
<message>
<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>
<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>
<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>
<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>
<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,
QList<TextItem*> &textItems, const QImage (&arrows)[2])
QList<TextItem*> &textItems, const QImage &arrow, const QImage &waterArrow)
{
std::stable_sort(lines.begin(), lines.end());
if (_zoom >= 22)
processStreetNames(lines, textItems, arrows);
processStreetNames(lines, textItems, arrow, waterArrow);
processShields(lines, textItems);
}
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++) {
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)
continue;
if (poly.label.text().isEmpty()
|| style.textFontSize() == Style::None)
continue;
const QFont *fnt = font(style.textFontSize(), Style::Small);
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 QImage *img = poly.oneway
? Style::isWaterLine(poly.type)
? &arrows[1] : &arrows[0] : 0;
const QString *label = poly.label.text().isEmpty()
? 0 : &poly.label.text();
? &waterArrow : &arrow : 0;
if (!img && (!label || !fnt))
continue;
TextPathItem *item = new TextPathItem(poly.points, label, _rect, fnt,
color, hColor, img);
TextPathItem *item = new TextPathItem(poly.points,
&poly.label.text(), _rect, fnt, color, hColor, img);
if (item->isValid() && !item->collides(textItems))
textItems.append(item);
else {
@ -477,11 +475,9 @@ void RasterTile::render()
QList<MapData::Poly> lines;
QList<MapData::Point> points;
QList<TextItem*> textItems;
QImage arrows[2];
arrows[0] = (_ratio >= 2)
QImage arrow = (_ratio >= 2)
? 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");
fetchData(polygons, lines, points);
@ -491,7 +487,7 @@ void RasterTile::render()
processPoints(points, textItems);
processPolygons(polygons, textItems);
processLines(lines, textItems, arrows);
processLines(lines, textItems, arrow, waterArrow);
_pixmap.setDevicePixelRatio(_ratio);
_pixmap.fill(Qt::transparent);

View File

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

View File

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