Use tight icon bounding boxes for marine icons
Before Width: | Height: | Size: 302 B After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 411 B After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 192 B After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 610 B After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 4.3 KiB |
@ -297,16 +297,18 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
|
||||
if ((!label || !fnt) && !img)
|
||||
continue;
|
||||
|
||||
TextPointItem *item = new TextPointItem(pos, label, fnt, img, color,
|
||||
hColor, 0, 2, rotate);
|
||||
QPoint offset = img ? style.offset() : QPoint(0, 0);
|
||||
|
||||
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
||||
color, hColor, 0, 2, rotate);
|
||||
if (item->isValid() && !item->collides(textItems)) {
|
||||
textItems.append(item);
|
||||
if (lightsSet.contains(point.pos()))
|
||||
lights.append(new TextPointItem(pos, 0, 0, _style->light(), 0,
|
||||
0, 0, 0));
|
||||
lights.append(new TextPointItem(pos + _style->lightOffset(),
|
||||
0, 0, _style->light(), 0, 0, 0, 0));
|
||||
if (signalsSet.contains(point.pos()))
|
||||
lights.append(new TextPointItem(pos, 0, 0, _style->signal(), 0,
|
||||
0, 0, 0));
|
||||
lights.append(new TextPointItem(pos + _style->signalOffset(),
|
||||
0, 0, _style->signal(), 0, 0, 0, 0));
|
||||
} else
|
||||
delete item;
|
||||
}
|
||||
|
@ -202,27 +202,45 @@ void Style::pointStyle(qreal ratio)
|
||||
_points[SUBTYPE(BUAARE, 6)].setTextFontSize(Small);
|
||||
_points[TYPE(SOUNDG)].setTextFontSize(Small);
|
||||
_points[TYPE(SOUNDG)].setHaloColor(QColor());
|
||||
_points[TYPE(BOYCAR)] = Point(QImage(":/marine/buoy.png"), Small);
|
||||
_points[TYPE(BOYINB)] = Point(QImage(":/marine/buoy.png"), Small);
|
||||
_points[TYPE(BOYISD)] = Point(QImage(":/marine/buoy.png"), Small);
|
||||
_points[TYPE(BOYLAT)] = Point(QImage(":/marine/buoy.png"), Small);
|
||||
_points[TYPE(I_BOYLAT)] = Point(QImage(":/marine/buoy.png"), Small);
|
||||
_points[TYPE(BOYSAW)] = Point(QImage(":/marine/buoy.png"), Small);
|
||||
_points[TYPE(BOYSPP)] = Point(QImage(":/marine/buoy.png"), Small);
|
||||
_points[TYPE(BCNCAR)] = Point(QImage(":/marine/beacon.png"), Small);
|
||||
_points[TYPE(BCNISD)] = Point(QImage(":/marine/beacon.png"), Small);
|
||||
_points[TYPE(BCNLAT)] = Point(QImage(":/marine/beacon.png"), Small);
|
||||
_points[TYPE(I_BCNLAT)] = Point(QImage(":/marine/beacon.png"), Small);
|
||||
_points[TYPE(BCNSAW)] = Point(QImage(":/marine/beacon.png"), Small);
|
||||
_points[TYPE(BCNSPP)] = Point(QImage(":/marine/beacon.png"), Small);
|
||||
_points[SUBTYPE(LNDMRK, 3)] = Point(QImage(":/marine/chimney.png"));
|
||||
_points[SUBTYPE(LNDMRK, 5)] = Point(QImage(":/marine/flagstaff.png"));
|
||||
_points[SUBTYPE(LNDMRK, 7)] = Point(QImage(":/marine/pylon.png"));
|
||||
_points[SUBTYPE(LNDMRK, 9)] = Point(QImage(":/marine/monument.png"));
|
||||
_points[SUBTYPE(LNDMRK, 17)] = Point(QImage(":/marine/tower.png"));
|
||||
_points[SUBTYPE(LNDMRK, 18)] = Point(QImage(":/marine/windmill.png"));
|
||||
_points[SUBTYPE(LNDMRK, 19)] = Point(QImage(":/marine/windmotor.png"));
|
||||
_points[SUBTYPE(LNDMRK, 20)] = Point(QImage(":/marine/church.png"));
|
||||
_points[TYPE(BOYCAR)] = Point(QImage(":/marine/buoy.png"), Small,
|
||||
QPoint(6, -6));
|
||||
_points[TYPE(BOYINB)] = Point(QImage(":/marine/buoy.png"), Small,
|
||||
QPoint(6, -6));
|
||||
_points[TYPE(BOYISD)] = Point(QImage(":/marine/buoy.png"), Small,
|
||||
QPoint(6, -6));
|
||||
_points[TYPE(BOYLAT)] = Point(QImage(":/marine/buoy.png"), Small,
|
||||
QPoint(6, -6));
|
||||
_points[TYPE(I_BOYLAT)] = Point(QImage(":/marine/buoy.png"), Small,
|
||||
QPoint(6, -6));
|
||||
_points[TYPE(BOYSAW)] = Point(QImage(":/marine/buoy.png"), Small,
|
||||
QPoint(6, -6));
|
||||
_points[TYPE(BOYSPP)] = Point(QImage(":/marine/buoy.png"), Small,
|
||||
QPoint(6, -6));
|
||||
_points[TYPE(BCNCAR)] = Point(QImage(":/marine/beacon.png"), Small,
|
||||
QPoint(0, -8));
|
||||
_points[TYPE(BCNISD)] = Point(QImage(":/marine/beacon.png"), Small,
|
||||
QPoint(0, -8));
|
||||
_points[TYPE(BCNLAT)] = Point(QImage(":/marine/beacon.png"), Small,
|
||||
QPoint(0, -8));
|
||||
_points[TYPE(I_BCNLAT)] = Point(QImage(":/marine/beacon.png"), Small,
|
||||
QPoint(0, -8));
|
||||
_points[TYPE(BCNSAW)] = Point(QImage(":/marine/beacon.png"), Small,
|
||||
QPoint(0, -8));
|
||||
_points[TYPE(BCNSPP)] = Point(QImage(":/marine/beacon.png"), Small,
|
||||
QPoint(0, -8));
|
||||
_points[SUBTYPE(LNDMRK, 3)] = Point(QImage(":/marine/chimney.png"),
|
||||
Small, QPoint(0, -11));
|
||||
_points[SUBTYPE(LNDMRK, 5)] = Point(QImage(":/marine/flagstaff.png"),
|
||||
Small, QPoint(2, -11));
|
||||
_points[SUBTYPE(LNDMRK, 7)] = Point(QImage(":/marine/pylon.png"), Small);
|
||||
_points[SUBTYPE(LNDMRK, 9)] = Point(QImage(":/marine/monument.png"), Small,
|
||||
QPoint(0, -7));
|
||||
_points[SUBTYPE(LNDMRK, 17)] = Point(QImage(":/marine/tower.png"), Small,
|
||||
QPoint(0, -11));
|
||||
_points[SUBTYPE(LNDMRK, 18)] = Point(QImage(":/marine/windmill.png"), Small);
|
||||
_points[SUBTYPE(LNDMRK, 19)] = Point(QImage(":/marine/windmotor.png"),
|
||||
Small, QPoint(0, -11));
|
||||
_points[SUBTYPE(LNDMRK, 20)] = Point(QImage(":/marine/church.png"), Small);
|
||||
_points[TYPE(LNDELV)] = Point(QImage(":/marine/triangulation-point.png"));
|
||||
_points[TYPE(OBSTRN)] = Point(QImage(":/marine/obstruction.png"), Small);
|
||||
_points[SUBTYPE(WRECKS, 0)] = Point(QImage(":/marine/wreck.png"), Small);
|
||||
@ -231,7 +249,8 @@ void Style::pointStyle(qreal ratio)
|
||||
Small);
|
||||
_points[SUBTYPE(WRECKS, 3)] = Point(QImage(":/marine/wreck.png"), Small);
|
||||
_points[SUBTYPE(WRECKS, 4)] = Point(QImage(":/marine/wreck.png"), Small);
|
||||
_points[SUBTYPE(WRECKS, 5)] = Point(QImage(":/marine/wreck-exposed.png"));
|
||||
_points[SUBTYPE(WRECKS, 5)] = Point(QImage(":/marine/wreck-exposed.png"),
|
||||
Small, QPoint(0, -4));
|
||||
_points[SUBTYPE(UWTROC, 1)] = Point(QImage(":/marine/rock-exposed.png"),
|
||||
Small);
|
||||
_points[SUBTYPE(UWTROC, 2)] = Point(QImage(":/marine/rock-exposed.png"),
|
||||
@ -256,9 +275,11 @@ void Style::pointStyle(qreal ratio)
|
||||
_points[SUBTYPE(MORFAC, 3)] = Point(QImage(":/marine/pile.png"), Small);
|
||||
_points[SUBTYPE(MORFAC, 5)] = Point(QImage(":/marine/pile.png"), Small);
|
||||
_points[SUBTYPE(MORFAC, 7)] = Point(QImage(":/marine/mooring-buoy.png"),
|
||||
Small);
|
||||
_points[TYPE(CRANES)] = Point(QImage(":/marine/crane.png"), Small);
|
||||
_points[TYPE(I_CRANES)] = Point(QImage(":/marine/crane.png"), Small);
|
||||
Small, QPoint(0, -5));
|
||||
_points[TYPE(CRANES)] = Point(QImage(":/marine/crane.png"), Small,
|
||||
QPoint(0, -5));
|
||||
_points[TYPE(I_CRANES)] = Point(QImage(":/marine/crane.png"), Small,
|
||||
QPoint(0, -5));
|
||||
_points[SUBTYPE(I_DISMAR, 1)] = Point(QImage(":/marine/distance-mark.png"),
|
||||
Small);
|
||||
_points[SUBTYPE(I_DISMAR, 1)].setTextColor(QColor(0xff, 0xff, 0xff));
|
||||
@ -352,7 +373,9 @@ void Style::pointStyle(qreal ratio)
|
||||
Style::Style(qreal ratio)
|
||||
{
|
||||
_light = QImage(":/marine/light.png");
|
||||
_lightOffset = QPoint(11, 11);
|
||||
_signal = QImage(":/marine/fog-signal.png");
|
||||
_signalOffset = QPoint(-9, 9);
|
||||
|
||||
_large = pixelSizeFont(16);
|
||||
_normal = pixelSizeFont(12);
|
||||
|
@ -67,9 +67,10 @@ public:
|
||||
public:
|
||||
Point() : _textColor(Qt::black), _haloColor(Qt::white),
|
||||
_textFontSize(Normal) {}
|
||||
Point(const QImage &img, FontSize fontSize = Normal)
|
||||
Point(const QImage &img, FontSize fontSize = Normal,
|
||||
const QPoint &offset = QPoint(0, 0))
|
||||
: _textColor(Qt::black), _haloColor(Qt::white),
|
||||
_textFontSize(fontSize), _img(img) {}
|
||||
_textFontSize(fontSize), _img(img), _offset(offset) {}
|
||||
|
||||
void setTextColor(const QColor &color) {_textColor = color;}
|
||||
void setHaloColor(const QColor &color) {_haloColor = color;}
|
||||
@ -79,11 +80,13 @@ public:
|
||||
const QColor &haloColor() const {return _haloColor;}
|
||||
FontSize textFontSize() const {return _textFontSize;}
|
||||
const QImage &img() const {return _img;}
|
||||
const QPoint &offset() const {return _offset;}
|
||||
|
||||
private:
|
||||
QColor _textColor, _haloColor;
|
||||
FontSize _textFontSize;
|
||||
QImage _img;
|
||||
QPoint _offset;
|
||||
};
|
||||
|
||||
Style(qreal ratio);
|
||||
@ -96,6 +99,8 @@ public:
|
||||
const QFont *font(Style::FontSize size) const;
|
||||
const QImage *light() const {return &_light;}
|
||||
const QImage *signal() const {return &_signal;}
|
||||
const QPoint &lightOffset() const {return _lightOffset;}
|
||||
const QPoint &signalOffset() const {return _signalOffset;}
|
||||
|
||||
private:
|
||||
void polygonStyle();
|
||||
@ -110,6 +115,7 @@ private:
|
||||
/* Fonts and images must be initialized after QGuiApplication! */
|
||||
QFont _small, _normal, _large;
|
||||
QImage _light, _signal;
|
||||
QPoint _lightOffset, _signalOffset;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -422,8 +422,10 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
|
||||
if ((!label || !fnt) && !img)
|
||||
continue;
|
||||
|
||||
QPoint offset = img ? style.offset() : QPoint(0, 0);
|
||||
|
||||
TextPointItem *item = new TextPointItem(QPoint(point.coordinates.lon(),
|
||||
point.coordinates.lat()), label, fnt, img, color, hcolor, 0,
|
||||
point.coordinates.lat()) + offset, label, fnt, img, color, hcolor, 0,
|
||||
ICON_PADDING);
|
||||
if (item->isValid() && !item->collides(textItems))
|
||||
textItems.append(item);
|
||||
|
@ -670,48 +670,49 @@ void Style::defaultPointStyle(qreal ratio)
|
||||
_points[0x11108] = _points[0x3008];
|
||||
|
||||
// Marine stuff
|
||||
_points[0x10100] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10101] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10102] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10103] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10104] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10105] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10106] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10107] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10108] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10109] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x1010a] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10200] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x10201] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x10202] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x10203] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x10204] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x10205] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x10206] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10207] = Point(QImage(":/marine/spar-buoy.png"));
|
||||
_points[0x10209] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x1020a] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x1020b] = Point(QImage(":/marine/buoy.png"));
|
||||
_points[0x1020d] = Point(QImage(":/marine/light-platform.png"));
|
||||
_points[0x1020e] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x1020f] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10210] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10211] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10212] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10213] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10214] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10215] = Point(QImage(":/marine/beacon.png"));
|
||||
_points[0x10216] = Point(QImage(":/marine/mooring-buoy.png"));
|
||||
_points[0x10305] = Point(QImage(":/marine/chimney.png"));
|
||||
_points[0x10100] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10101] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10102] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10103] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10104] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10105] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10106] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10107] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10108] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10109] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x1010a] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10200] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10201] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10202] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10203] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10204] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10205] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10206] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10207] = Point(QImage(":/marine/spar-buoy.png"), QPoint(2, -9));
|
||||
_points[0x10209] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x1020a] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x1020b] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x1020d] = Point(QImage(":/marine/light-platform.png"),
|
||||
QPoint(8, -8));
|
||||
_points[0x1020e] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x1020f] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10210] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10211] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10212] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10213] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10214] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10215] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10216] = Point(QImage(":/marine/mooring-buoy.png"), QPoint(0, -5));
|
||||
_points[0x10305] = Point(QImage(":/marine/chimney.png"), QPoint(0, -11));
|
||||
_points[0x10306] = Point(QImage(":/marine/church.png"));
|
||||
_points[0x10307] = Point(QImage(":/marine/silo.png"));
|
||||
_points[0x10308] = Point(QImage(":/marine/tower.png"));
|
||||
_points[0x10308] = Point(QImage(":/marine/tower.png"), QPoint(0, -11));
|
||||
_points[0x1030a] = Point(QImage(":/marine/triangulation-point.png"));
|
||||
_points[0x1030b] = Point(QImage(":/marine/radio.png"));
|
||||
_points[0x10400] = Point(QImage(":/marine/obstruction.png"));
|
||||
_points[0x10401] = Point(QImage(":/marine/obstruction.png"));
|
||||
_points[0x10402] = Point(QImage(":/marine/wreck.png"));
|
||||
_points[0x10403] = Point(QImage(":/marine/wreck-exposed.png"));
|
||||
_points[0x10403] = Point(QImage(":/marine/wreck-exposed.png"), QPoint(0, -4));
|
||||
_points[0x10408] = Point(QImage(":/marine/obstruction-covers.png"));
|
||||
_points[0x1040a] = Point(QImage(":/marine/rock-dangerous.png"));
|
||||
_points[0x1040c] = Point(QImage(":/marine/rock-exposed.png"));
|
||||
|
@ -85,10 +85,12 @@ public:
|
||||
Point() {}
|
||||
Point(FontSize fontSize, const QColor &textColor = QColor())
|
||||
: _text(textColor, fontSize) {}
|
||||
Point(const QImage &img) : _img(img) {}
|
||||
Point(const QImage &img, const QPoint &offset = QPoint(0, 0))
|
||||
: _img(img), _offset(offset) {}
|
||||
|
||||
const Font &text() const {return _text;}
|
||||
const QImage &img() const {return _img;}
|
||||
const QPoint &offset() const {return _offset;}
|
||||
|
||||
private:
|
||||
friend class Style;
|
||||
@ -98,6 +100,7 @@ public:
|
||||
|
||||
Font _text;
|
||||
QImage _img;
|
||||
QPoint _offset;
|
||||
};
|
||||
|
||||
|
||||
|