diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index aedf3fa1..cc8f9b69 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -522,7 +522,8 @@ void RasterTile::processPoints(QList &points, for (int i = 0; i < points.size(); i++) { const MapData::Point &point = points.at(i); const Style *style = _data->style(); - const Style::Point &ps = style->point(point.type); + const Style::Point &ps = style->point(Style::hasColorset(point.type) + ? point.type | (point.flags & 0xFF000000) : point.type); bool poi = Style::isPOI(point.type); bool sl = sectorLight(point.lights); diff --git a/src/map/IMG/rgnfile.cpp b/src/map/IMG/rgnfile.cpp index 28f4cb5b..dcd7a031 100644 --- a/src/map/IMG/rgnfile.cpp +++ b/src/map/IMG/rgnfile.cpp @@ -402,18 +402,20 @@ bool RGNFile::readLclLights(Handle &hdl, quint32 &size, quint32 lights, bool RGNFile::readLclNavaid(Handle &hdl, quint32 size, MapData::Point *point) const { - quint32 unused, flags; + quint32 unused, color, flags; // Discard the class lights info if any (marine points may have both!) point->lights.clear(); + point->flags &= 0xffffff; if (!(size >= 4 && readUInt32(hdl, flags))) return false; size -= 4; if (flags & 1) { - if (!(size >= 1 && readUInt8(hdl, unused))) + if (!(size >= 1 && readUInt8(hdl, color))) return false; size--; + point->flags |= color<<24; } if (flags & 2) { if (!(size >= 1 && readUInt8(hdl, unused))) diff --git a/src/map/IMG/style.cpp b/src/map/IMG/style.cpp index 85d7e6a2..3026b157 100644 --- a/src/map/IMG/style.cpp +++ b/src/map/IMG/style.cpp @@ -7,6 +7,37 @@ using namespace IMG; using namespace Util; +#define PNT(type, color, img, dx, dy) \ + _points[(type) | (color)<<24] = Point(QImage(img), QPoint(dx, dy)); + +#define COLORSET(type, name, dx, dy) \ + PNT(type, 0, ":/marine/" name ".png", dx, dy); \ + PNT(type, 1, ":/marine/" name "-red.png", dx, dy); \ + PNT(type, 2, ":/marine/" name "-green.png", dx, dy); \ + PNT(type, 3, ":/marine/" name "-yellow.png", dx, dy); \ + PNT(type, 4, ":/marine/" name "-white.png", dx, dy); \ + PNT(type, 5, ":/marine/" name ".png", dx, dy); \ + PNT(type, 6, ":/marine/" name "-black-yellow.png", dx, dy); \ + PNT(type, 7, ":/marine/" name "-white-red.png", dx, dy); \ + PNT(type, 8, ":/marine/" name "-black-red.png", dx, dy); \ + PNT(type, 9, ":/marine/" name "-white-green.png", dx, dy); \ + PNT(type, 10, ":/marine/" name "-red-yellow.png", dx, dy); \ + PNT(type, 11, ":/marine/" name "-red-green.png", dx, dy); \ + PNT(type, 12, ":/marine/" name "yellow.png", dx, dy); \ + PNT(type, 13, ":/marine/" name "-black-yellow-black.png", dx, dy); \ + PNT(type, 14, ":/marine/" name "-yellow-black.png", dx, dy); \ + PNT(type, 15, ":/marine/" name "-yellow-black-yellow.png", dx, dy); \ + PNT(type, 16, ":/marine/" name "-red-white.png", dx, dy); \ + PNT(type, 17, ":/marine/" name "-green-red-green.png", dx, dy); \ + PNT(type, 18, ":/marine/" name "-red-green-red.png", dx, dy); \ + PNT(type, 19, ":/marine/" name "-black-red-black.png", dx, dy); \ + PNT(type, 20, ":/marine/" name "-yellow-red-yellow.png", dx, dy); \ + PNT(type, 21, ":/marine/" name "-green-red.png", dx, dy); \ + PNT(type, 22, ":/marine/" name "-black-white.png", dx, dy); \ + PNT(type, 23, ":/marine/" name "-white-yellow.png", dx, dy); \ + PNT(type, 24, ":/marine/" name "-yellow-white.png", dx, dy); \ + PNT(type, 25, ":/marine/" name "-green-white.png", dx, dy); + static QFont pixelSizeFont(int pixelSize) { QFont f; @@ -731,29 +762,32 @@ void Style::defaultPointStyle(qreal ratio) _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"), 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)); + + COLORSET(0x10200, "buoy", 6, -6); + COLORSET(0x10201, "buoy", 6, -6); + COLORSET(0x10202, "buoy", 6, -6); + COLORSET(0x10203, "buoy", 6, -6); + COLORSET(0x10204, "buoy", 6, -6); + COLORSET(0x10205, "buoy", 6, -6); + COLORSET(0x10206, "beacon", 0, -8); _points[0x10207] = Point(QImage(":/marine/spar-buoy.png"), QPoint(2, -9)); - _points[0x10208] = Point(QImage(":/marine/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[0x1020c] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6)); + COLORSET(0x10208, "buoy", 6, -6); + COLORSET(0x10209, "buoy", 6, -6); + COLORSET(0x1020a, "buoy", 6, -6); + COLORSET(0x1020b, "buoy", 6, -6); + COLORSET(0x1020c, "buoy", 6, -6); _points[0x1020d] = Point(QImage(":/marine/platform.png")); - _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)); + COLORSET(0x1020e, "beacon", 0, -8); + COLORSET(0x1020f, "beacon", 0, -8); + COLORSET(0x10210, "beacon", 0, -8); + COLORSET(0x10210, "beacon", 0, -8); + COLORSET(0x10211, "beacon", 0, -8); + COLORSET(0x10212, "beacon", 0, -8); + COLORSET(0x10213, "beacon", 0, -8); + COLORSET(0x10214, "beacon", 0, -8); + COLORSET(0x10215, "beacon", 0, -8); _points[0x10216] = Point(QImage(":/marine/mooring-buoy.png"), QPoint(0, -5)); + _points[0x10304] = Point(QImage(":/marine/building.png")); _points[0x10305] = Point(QImage(":/marine/chimney.png"), QPoint(0, -11)); _points[0x10306] = Point(QImage(":/marine/church.png")); @@ -761,6 +795,7 @@ void Style::defaultPointStyle(qreal ratio) _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")); @@ -768,6 +803,7 @@ void Style::defaultPointStyle(qreal ratio) _points[0x10408] = Point(QImage(":/marine/obstruction-covers.png")); _points[0x1040a] = Point(QImage(":/marine/rock-dangerous.png")); _points[0x1040c] = Point(QImage(":/marine/rock-exposed.png")); + _points[0x10701] = Point(QImage(":/marine/anchorage.png")); _points[0x10702] = Point(QImage(":/marine/boarding-place.png")); _points[0x10703] = Point(QImage(":/marine/yacht-harbor.png")); diff --git a/src/map/IMG/style.h b/src/map/IMG/style.h index 944f5468..0324792c 100644 --- a/src/map/IMG/style.h +++ b/src/map/IMG/style.h @@ -118,16 +118,16 @@ public: static bool isPOI(quint32 type) {return !((type >= TYPE(0x01) && type <= TYPE(0x1f)) - || (type >= 0x11400 && type < 0x11500));} + || (type >= 0x11400 && type < 0x11500));} static bool isContourLine(quint32 type) {return ((type >= TYPE(0x20) && type <= TYPE(0x25)) - || (type & 0xffff00) == TYPE(0x109));} + || (type & 0xffff00) == TYPE(0x109));} static bool isWaterArea(quint32 type) {return ((type >= TYPE(0x3c) && type <= TYPE(0x44)) - || (type & 0xffff00) == TYPE(0x10b));} + || (type & 0xffff00) == TYPE(0x10b));} static bool isWaterLine(quint32 type) {return (type == TYPE(0x26) || type == TYPE(0x18) - || type == TYPE(0x1f));} + || type == TYPE(0x1f));} static bool isMilitaryArea(quint32 type) {return (type == TYPE(0x04) || type == 0x10901);} static bool isNatureReserve(quint32 type) @@ -156,6 +156,9 @@ public: {return type >= 0x10100 && type < 0x10a00;} static bool isMarina(quint32 type) {return type == 0x10703;} + static bool hasColorset(quint32 type) + {return (isBuoy(type) + && !(type == 0x10207 || type == 0x1020d || type == 0x10216));} static QColor color(Light::Color c);