mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Cosmetics
This commit is contained in:
parent
0e9720f68b
commit
297177ad41
@ -4,6 +4,9 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#define FIRST_SHIELD Label::Shield::USInterstate
|
||||||
|
#define LAST_SHIELD Label::Shield::Oval
|
||||||
|
|
||||||
class Label {
|
class Label {
|
||||||
public:
|
public:
|
||||||
class Shield
|
class Shield
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#define TILE_SIZE 256
|
#define TILE_SIZE 256
|
||||||
#define TEXT_EXTENT 256
|
#define TEXT_EXTENT 256
|
||||||
#define LINE_TEXT_MIN_ZOOM 22
|
|
||||||
|
|
||||||
#define AREA(rect) \
|
#define AREA(rect) \
|
||||||
(rect.size().width() * rect.size().height())
|
(rect.size().width() * rect.size().height())
|
||||||
@ -181,7 +180,7 @@ static int minShieldZoom(Label::Shield::Type type)
|
|||||||
case Label::Shield::Oval:
|
case Label::Shield::Oval:
|
||||||
return 20;
|
return 20;
|
||||||
default:
|
default:
|
||||||
return INT_MAX;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,46 +356,44 @@ void IMGMap::processLines(QList<IMG::Poly> &lines, const QRect &tileRect,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processStreetNames(lines, tileRect, textItems);
|
if (_zoom >= 22)
|
||||||
|
processStreetNames(lines, tileRect, textItems);
|
||||||
processShields(lines, tileRect, textItems);
|
processShields(lines, tileRect, textItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMGMap::processStreetNames(QList<IMG::Poly> &lines, const QRect &tileRect,
|
void IMGMap::processStreetNames(QList<IMG::Poly> &lines, const QRect &tileRect,
|
||||||
QList<TextItem*> &textItems)
|
QList<TextItem*> &textItems)
|
||||||
{
|
{
|
||||||
if (_zoom >= LINE_TEXT_MIN_ZOOM) {
|
for (int i = 0; i < lines.size(); i++) {
|
||||||
for (int i = 0; i < lines.size(); i++) {
|
IMG::Poly &poly = lines[i];
|
||||||
IMG::Poly &poly = lines[i];
|
const Style::Line &style = _img.style()->line(poly.type);
|
||||||
const Style::Line &style = _img.style()->line(poly.type);
|
|
||||||
|
|
||||||
if (style.img().isNull() && style.foreground() == Qt::NoPen)
|
if (style.img().isNull() && style.foreground() == Qt::NoPen)
|
||||||
continue;
|
continue;
|
||||||
if (poly.label.text().isEmpty()
|
if (poly.label.text().isEmpty()
|
||||||
|| style.textFontSize() == Style::None)
|
|| style.textFontSize() == Style::None)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Style::isContourLine(poly.type))
|
if (Style::isContourLine(poly.type))
|
||||||
poly.label.setText(convertUnits(poly.label.text()));
|
poly.label.setText(convertUnits(poly.label.text()));
|
||||||
|
|
||||||
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()
|
||||||
? &style.textColor() : 0;
|
? &style.textColor() : 0;
|
||||||
|
|
||||||
TextPathItem *item = new TextPathItem(poly.points,
|
TextPathItem *item = new TextPathItem(poly.points,
|
||||||
&poly.label.text(), tileRect, fnt, color);
|
&poly.label.text(), tileRect, fnt, color);
|
||||||
if (item->isValid() && !item->collides(textItems))
|
if (item->isValid() && !item->collides(textItems))
|
||||||
textItems.append(item);
|
textItems.append(item);
|
||||||
else
|
else
|
||||||
delete item;
|
delete item;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMGMap::processShields(QList<IMG::Poly> &lines, const QRect &tileRect,
|
void IMGMap::processShields(QList<IMG::Poly> &lines, const QRect &tileRect,
|
||||||
QList<TextItem*> &textItems)
|
QList<TextItem*> &textItems)
|
||||||
{
|
{
|
||||||
for (int type = Label::Shield::USInterstate; type <= Label::Shield::Oval;
|
for (int type = FIRST_SHIELD; type <= LAST_SHIELD; type++) {
|
||||||
type++) {
|
|
||||||
if (minShieldZoom(static_cast<Label::Shield::Type>(type)) > _zoom)
|
if (minShieldZoom(static_cast<Label::Shield::Type>(type)) > _zoom)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user