mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-12 14:20:48 +01:00
IMG marine lights
This commit is contained in:
parent
610dd0a009
commit
819a67158a
@ -118,6 +118,7 @@ HEADERS += src/common/config.h \
|
|||||||
src/data/gpsdumpparser.h \
|
src/data/gpsdumpparser.h \
|
||||||
src/data/style.h \
|
src/data/style.h \
|
||||||
src/data/twonavparser.h \
|
src/data/twonavparser.h \
|
||||||
|
src/map/IMG/lights.h \
|
||||||
src/map/downloader.h \
|
src/map/downloader.h \
|
||||||
src/map/demloader.h \
|
src/map/demloader.h \
|
||||||
src/map/ENC/attributes.h \
|
src/map/ENC/attributes.h \
|
||||||
|
@ -196,6 +196,7 @@
|
|||||||
<file alias="light-red.png">icons/map/marine/light-red.png</file>
|
<file alias="light-red.png">icons/map/marine/light-red.png</file>
|
||||||
<file alias="light-green.png">icons/map/marine/light-green.png</file>
|
<file alias="light-green.png">icons/map/marine/light-green.png</file>
|
||||||
<file alias="light-yellow.png">icons/map/marine/light-yellow.png</file>
|
<file alias="light-yellow.png">icons/map/marine/light-yellow.png</file>
|
||||||
|
<file alias="light-white.png">icons/map/marine/light-white.png</file>
|
||||||
<file alias="building.png">icons/map/marine/building.png</file>
|
<file alias="building.png">icons/map/marine/building.png</file>
|
||||||
<file alias="fog-signal.png">icons/map/marine/fog-signal.png</file>
|
<file alias="fog-signal.png">icons/map/marine/fog-signal.png</file>
|
||||||
<file alias="construction.png">icons/map/marine/construction.png</file>
|
<file alias="construction.png">icons/map/marine/construction.png</file>
|
||||||
|
BIN
icons/map/marine/light-white.png
Normal file
BIN
icons/map/marine/light-white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 330 B |
Binary file not shown.
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 4.3 KiB |
51
src/map/IMG/lights.h
Normal file
51
src/map/IMG/lights.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#ifndef IMG_LIGHTS_H
|
||||||
|
#define IMG_LIGHTS_H
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
namespace IMG {
|
||||||
|
|
||||||
|
class Lights
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Color {None, Red, Green, White, Blue, Yellow, Violet, Amber};
|
||||||
|
|
||||||
|
struct Sector
|
||||||
|
{
|
||||||
|
Sector() : color(None), angle(0), range(0) {}
|
||||||
|
Sector(Color color, quint32 angle, quint32 range)
|
||||||
|
: color(color), angle(angle), range(range) {}
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
quint32 angle;
|
||||||
|
quint32 range;
|
||||||
|
};
|
||||||
|
|
||||||
|
Lights() : color(None), range(0) {}
|
||||||
|
bool isSectorLight() const {return ((color && range) || !sectors.isEmpty());}
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
quint32 range;
|
||||||
|
QVector<Sector> sectors;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG
|
||||||
|
inline QDebug operator<<(QDebug dbg, const IMG::Lights::Sector §or)
|
||||||
|
{
|
||||||
|
dbg.nospace() << "Sector(" << sector.color << ", " << sector.angle
|
||||||
|
<< ", " << sector.range << ")";
|
||||||
|
return dbg.space();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDebug operator<<(QDebug dbg, const IMG::Lights &lights)
|
||||||
|
{
|
||||||
|
dbg.nospace() << "Lights(" << lights.color << ", " << lights.range << ", "
|
||||||
|
<< lights.sectors << ")";
|
||||||
|
return dbg.space();
|
||||||
|
}
|
||||||
|
#endif // QT_NO_DEBUG
|
||||||
|
|
||||||
|
#endif // IMG_LIGHTS_H
|
@ -14,6 +14,7 @@
|
|||||||
#include "map/matrix.h"
|
#include "map/matrix.h"
|
||||||
#include "label.h"
|
#include "label.h"
|
||||||
#include "raster.h"
|
#include "raster.h"
|
||||||
|
#include "lights.h"
|
||||||
#include "zoom.h"
|
#include "zoom.h"
|
||||||
|
|
||||||
namespace IMG {
|
namespace IMG {
|
||||||
@ -51,11 +52,11 @@ public:
|
|||||||
enum Flags {
|
enum Flags {
|
||||||
NoFlag = 0,
|
NoFlag = 0,
|
||||||
ClassLabel = 1,
|
ClassLabel = 1,
|
||||||
Light = 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Coordinates coordinates;
|
Coordinates coordinates;
|
||||||
Label label;
|
Label label;
|
||||||
|
Lights lights;
|
||||||
quint64 id;
|
quint64 id;
|
||||||
quint32 type;
|
quint32 type;
|
||||||
quint32 flags;
|
quint32 flags;
|
||||||
|
@ -18,13 +18,13 @@ using namespace IMG;
|
|||||||
|
|
||||||
#define TEXT_EXTENT 160
|
#define TEXT_EXTENT 160
|
||||||
#define ICON_PADDING 2
|
#define ICON_PADDING 2
|
||||||
|
#define RANGE_FACTOR 4
|
||||||
|
#define ROAD 0
|
||||||
|
#define WATER 1
|
||||||
|
|
||||||
#define AREA(rect) \
|
#define AREA(rect) \
|
||||||
(rect.size().width() * rect.size().height())
|
(rect.size().width() * rect.size().height())
|
||||||
|
|
||||||
#define ROAD 0
|
|
||||||
#define WATER 1
|
|
||||||
|
|
||||||
static const QColor textColor(Qt::black);
|
static const QColor textColor(Qt::black);
|
||||||
static const QColor haloColor(Qt::white);
|
static const QColor haloColor(Qt::white);
|
||||||
static const QColor shieldColor(Qt::white);
|
static const QColor shieldColor(Qt::white);
|
||||||
@ -226,6 +226,67 @@ void RasterTile::drawTextItems(QPainter *painter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QRect lightRect(const QPoint &pos, quint32 range)
|
||||||
|
{
|
||||||
|
return QRect(pos.x() - range * RANGE_FACTOR, pos.y() - range * RANGE_FACTOR,
|
||||||
|
2*range * RANGE_FACTOR, 2*range * RANGE_FACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RasterTile::drawSectorLights(QPainter *painter,
|
||||||
|
const QList<const MapData::Point *> &lights) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < lights.size(); i++) {
|
||||||
|
const MapData::Point *p = lights.at(i);
|
||||||
|
QPoint pos(p->coordinates.lon(), p->coordinates.lat());
|
||||||
|
|
||||||
|
if (p->lights.sectors.size()) {
|
||||||
|
for (int j = 0; j < p->lights.sectors.size(); j++) {
|
||||||
|
const Lights::Sector &start = p->lights.sectors.at(j);
|
||||||
|
const Lights::Sector &end = (j == p->lights.sectors.size() - 1)
|
||||||
|
? p->lights.sectors.at(0) : p->lights.sectors.at(j+1);
|
||||||
|
|
||||||
|
if (start.color && start.range) {
|
||||||
|
double a1 = -(end.angle / 10.0 + 90.0);
|
||||||
|
double a2 = -(start.angle / 10.0 + 90.0);
|
||||||
|
if (a1 > a2)
|
||||||
|
a2 += 360;
|
||||||
|
double as = (a2 - a1);
|
||||||
|
if (as == 0)
|
||||||
|
as = 360;
|
||||||
|
|
||||||
|
QRect rect(lightRect(pos, start.range));
|
||||||
|
|
||||||
|
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine,
|
||||||
|
Qt::FlatCap));
|
||||||
|
painter->drawArc(rect, a1 * 16, as * 16);
|
||||||
|
painter->setPen(QPen(Style::color(start.color), 4,
|
||||||
|
Qt::SolidLine, Qt::FlatCap));
|
||||||
|
painter->drawArc(rect, a1 * 16, as * 16);
|
||||||
|
|
||||||
|
if (a2 - a1 != 0) {
|
||||||
|
QLineF ln(pos, QPointF(pos.x() + rect.width(), pos.y()));
|
||||||
|
ln.setAngle(a1);
|
||||||
|
painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
|
||||||
|
painter->drawLine(ln);
|
||||||
|
ln.setAngle(a2);
|
||||||
|
painter->drawLine(ln);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (p->lights.color && p->lights.range) {
|
||||||
|
QRect rect(lightRect(pos, p->lights.range));
|
||||||
|
|
||||||
|
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine, Qt::FlatCap));
|
||||||
|
painter->drawArc(rect, 0, 360 * 16);
|
||||||
|
painter->setPen(QPen(Style::color(p->lights.color), 4,
|
||||||
|
Qt::SolidLine, Qt::FlatCap));
|
||||||
|
painter->drawArc(rect, 0, 360 * 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text,
|
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text,
|
||||||
const QRectF &tileRect)
|
const QRectF &tileRect)
|
||||||
{
|
{
|
||||||
@ -398,7 +459,7 @@ void RasterTile::processShields(const QList<MapData::Poly> &lines,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::processPoints(QList<MapData::Point> &points,
|
void RasterTile::processPoints(QList<MapData::Point> &points,
|
||||||
QList<TextItem*> &textItems)
|
QList<TextItem*> &textItems, QList<const MapData::Point*> &lights)
|
||||||
{
|
{
|
||||||
std::sort(points.begin(), points.end());
|
std::sort(points.begin(), points.end());
|
||||||
|
|
||||||
@ -408,6 +469,9 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
|
|||||||
const Style::Point &ps = style->point(point.type);
|
const Style::Point &ps = style->point(point.type);
|
||||||
bool poi = Style::isPOI(point.type);
|
bool poi = Style::isPOI(point.type);
|
||||||
|
|
||||||
|
if (point.lights.isSectorLight())
|
||||||
|
lights.append(&point);
|
||||||
|
|
||||||
const QString *label = point.label.text().isEmpty()
|
const QString *label = point.label.text().isEmpty()
|
||||||
? 0 : &(point.label.text());
|
? 0 : &(point.label.text());
|
||||||
const QImage *img = ps.img().isNull() ? 0 : &ps.img();
|
const QImage *img = ps.img().isNull() ? 0 : &ps.img();
|
||||||
@ -428,11 +492,12 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
|
|||||||
|
|
||||||
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
||||||
color, hcolor, 0, ICON_PADDING);
|
color, hcolor, 0, ICON_PADDING);
|
||||||
if (item->isValid() && !item->collides(textItems)) {
|
if (point.lights.isSectorLight()
|
||||||
|
|| (item->isValid() && !item->collides(textItems))) {
|
||||||
textItems.append(item);
|
textItems.append(item);
|
||||||
if (Style::isLight(point.type) || point.flags & MapData::Point::Light)
|
if (point.lights.color && !point.lights.isSectorLight())
|
||||||
textItems.append(new TextPointItem(pos + style->lightOffset(),
|
textItems.append(new TextPointItem(pos + style->lightOffset(),
|
||||||
0, 0, style->light(), 0, 0, 0, 0));
|
0, 0, style->light(point.lights.color), 0, 0, 0, 0));
|
||||||
} else
|
} else
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
@ -521,6 +586,7 @@ 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;
|
||||||
|
QList<const MapData::Point*> lights;
|
||||||
QImage arrows[2];
|
QImage arrows[2];
|
||||||
|
|
||||||
arrows[ROAD] = Util::svg2img(":/symbols/oneway.svg", _ratio);
|
arrows[ROAD] = Util::svg2img(":/symbols/oneway.svg", _ratio);
|
||||||
@ -531,7 +597,7 @@ void RasterTile::render()
|
|||||||
ll2xy(lines);
|
ll2xy(lines);
|
||||||
ll2xy(points);
|
ll2xy(points);
|
||||||
|
|
||||||
processPoints(points, textItems);
|
processPoints(points, textItems, lights);
|
||||||
processPolygons(polygons, textItems);
|
processPolygons(polygons, textItems);
|
||||||
processLines(lines, textItems, arrows);
|
processLines(lines, textItems, arrows);
|
||||||
|
|
||||||
@ -546,6 +612,7 @@ void RasterTile::render()
|
|||||||
drawPolygons(&painter, polygons);
|
drawPolygons(&painter, polygons);
|
||||||
drawHillShading(&painter);
|
drawHillShading(&painter);
|
||||||
drawLines(&painter, lines);
|
drawLines(&painter, lines);
|
||||||
|
drawSectorLights(&painter, lights);
|
||||||
drawTextItems(&painter, textItems);
|
drawTextItems(&painter, textItems);
|
||||||
|
|
||||||
qDeleteAll(textItems);
|
qDeleteAll(textItems);
|
||||||
|
@ -34,7 +34,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
typedef RTree<const MapData::Elevation*, double, 2> DEMTRee;
|
typedef RTree<const MapData::Elevation*, double, 2> DEMTRee;
|
||||||
|
|
||||||
struct ElevationCTX {
|
struct ElevationCTX
|
||||||
|
{
|
||||||
ElevationCTX(const DEMTRee &tree, const Coordinates &c, double &ele)
|
ElevationCTX(const DEMTRee &tree, const Coordinates &c, double &ele)
|
||||||
: tree(tree), c(c), ele(ele) {}
|
: tree(tree), c(c), ele(ele) {}
|
||||||
|
|
||||||
@ -42,7 +43,8 @@ private:
|
|||||||
const Coordinates &c;
|
const Coordinates &c;
|
||||||
double &ele;
|
double &ele;
|
||||||
};
|
};
|
||||||
struct EdgeCTX {
|
struct EdgeCTX
|
||||||
|
{
|
||||||
EdgeCTX(const Coordinates &c, double &ele) : c(c), ele(ele) {}
|
EdgeCTX(const Coordinates &c, double &ele) : c(c), ele(ele) {}
|
||||||
|
|
||||||
const Coordinates &c;
|
const Coordinates &c;
|
||||||
@ -62,13 +64,14 @@ private:
|
|||||||
void drawLines(QPainter *painter, const QList<MapData::Poly> &lines) const;
|
void drawLines(QPainter *painter, const QList<MapData::Poly> &lines) const;
|
||||||
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems) const;
|
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems) const;
|
||||||
void drawHillShading(QPainter *painter) const;
|
void drawHillShading(QPainter *painter) const;
|
||||||
|
void drawSectorLights(QPainter *painter, const QList<const MapData::Point*> &lights) const;
|
||||||
|
|
||||||
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, QList<TextItem*> &textItems,
|
||||||
const QImage (&arrows)[2]);
|
const QImage (&arrows)[2]);
|
||||||
void processPoints(QList<MapData::Point> &points,
|
void processPoints(QList<MapData::Point> &points, QList<TextItem*> &textItems,
|
||||||
QList<TextItem*> &textItems);
|
QList<const MapData::Point *> &lights);
|
||||||
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,
|
||||||
|
@ -107,7 +107,8 @@ bool RGNFile::readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RGNFile::readBuoyInfo(Handle &hdl, quint8 flags, MapData::Point *point) const
|
bool RGNFile::readBuoyInfo(Handle &hdl, quint8 flags, quint32 size,
|
||||||
|
MapData::Point *point) const
|
||||||
{
|
{
|
||||||
quint16 val;
|
quint16 val;
|
||||||
quint8 lc;
|
quint8 lc;
|
||||||
@ -115,7 +116,7 @@ bool RGNFile::readBuoyInfo(Handle &hdl, quint8 flags, MapData::Point *point) con
|
|||||||
if ((flags & 0xe0) != 0xe0)
|
if ((flags & 0xe0) != 0xe0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!readUInt16(hdl, val))
|
if (!(size >= 2 && readUInt16(hdl, val)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
lc = (val >> 10) & 0x0f;
|
lc = (val >> 10) & 0x0f;
|
||||||
@ -123,7 +124,105 @@ bool RGNFile::readBuoyInfo(Handle &hdl, quint8 flags, MapData::Point *point) con
|
|||||||
lc = (val >> 6) & 7;
|
lc = (val >> 6) & 7;
|
||||||
|
|
||||||
if (lc)
|
if (lc)
|
||||||
point->flags |= MapData::Point::Light;
|
point->lights.color = (Lights::Color)lc;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RGNFile::readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
||||||
|
MapData::Point *point) const
|
||||||
|
{
|
||||||
|
quint16 flags1;
|
||||||
|
quint8 flags2;
|
||||||
|
quint32 unused;
|
||||||
|
|
||||||
|
if (!(size >= 3 && readUInt16(hdl, flags1) && readUInt8(hdl, flags2)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
if (flags2 >> 6) {
|
||||||
|
if (!(size >= (flags2 >> 6) && readVUInt32(hdl, (flags2 >> 6), unused)))
|
||||||
|
return false;
|
||||||
|
size -= (flags2 >> 6);
|
||||||
|
}
|
||||||
|
if (flags2 >> 2 & 3) {
|
||||||
|
if (!(size >= (flags2 >> 2 & 3)
|
||||||
|
&& readVUInt32(hdl, (flags2 >> 2 & 3), unused)))
|
||||||
|
return false;
|
||||||
|
size -= (flags2 >> 2 & 3);
|
||||||
|
}
|
||||||
|
if (flags1 & 0xc0) {
|
||||||
|
if (flags1 & 0x80) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
unused |= ((flags1 & 0x40) << 2);
|
||||||
|
size--;
|
||||||
|
} else {
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flags & 2) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 4) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 8) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags1 & 0x200) {
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
}
|
||||||
|
if (flags1 & 0x400) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
if (flags1 & 0x800) {
|
||||||
|
quint16 la;
|
||||||
|
quint8 cf, range = 0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, la)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
|
||||||
|
cf = la >> 8;
|
||||||
|
Lights::Color c = (Lights::Color)(cf >> 4 & 7);
|
||||||
|
if (c) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, range)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
point->lights.sectors.append(Lights::Sector(c, la & 0xfff, range));
|
||||||
|
} while (!(cf >> 7));
|
||||||
|
} else {
|
||||||
|
quint8 v1, v2, range;
|
||||||
|
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, v1)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
|
||||||
|
range = v1 & 0x1f;
|
||||||
|
if ((v1 & 0x1f) == 0x1f) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, v2)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
range += v2;
|
||||||
|
}
|
||||||
|
|
||||||
|
point->lights.color = (Lights::Color)(v1 >> 5);
|
||||||
|
point->lights.range = range;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -183,7 +282,9 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
|
|||||||
if (point && Style::isObstructionPoint(point->type))
|
if (point && Style::isObstructionPoint(point->type))
|
||||||
readObstructionInfo(hdl, flags, rs, point);
|
readObstructionInfo(hdl, flags, rs, point);
|
||||||
if (point && Style::isBuoy(point->type))
|
if (point && Style::isBuoy(point->type))
|
||||||
readBuoyInfo(hdl, flags, point);
|
readBuoyInfo(hdl, flags, rs, point);
|
||||||
|
if (point && Style::isLight(point->type))
|
||||||
|
readLightInfo(hdl, flags, rs, point);
|
||||||
|
|
||||||
return seek(hdl, off + rs);
|
return seek(hdl, off + rs);
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,10 @@ private:
|
|||||||
MapData::Point *point) const;
|
MapData::Point *point) const;
|
||||||
bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
|
bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
|
||||||
MapData::Point *point) const;
|
MapData::Point *point) const;
|
||||||
bool readBuoyInfo(Handle &hdl, quint8 flags, MapData::Point *point) const;
|
bool readBuoyInfo(Handle &hdl, quint8 flags, quint32 size,
|
||||||
|
MapData::Point *point) const;
|
||||||
|
bool readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
||||||
|
MapData::Point *point) const;
|
||||||
bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
|
bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
|
||||||
quint8 flags, quint32 size, MapData::Point *point) const;
|
quint8 flags, quint32 size, MapData::Point *point) const;
|
||||||
|
|
||||||
|
@ -1319,6 +1319,10 @@ Style::Style(qreal ratio, SubFile *typ)
|
|||||||
_extraSmall = pixelSizeFont(10);
|
_extraSmall = pixelSizeFont(10);
|
||||||
|
|
||||||
_light = QImage(":/marine/light.png");
|
_light = QImage(":/marine/light.png");
|
||||||
|
_lightRed = QImage(":/marine/light-red.png");
|
||||||
|
_lightGreen = QImage(":/marine/light-green.png");
|
||||||
|
_lightYellow = QImage(":/marine/light-yellow.png");
|
||||||
|
_lightWhite = QImage(":/marine/light-white.png");
|
||||||
_lightOffset = QPoint(11, 11);
|
_lightOffset = QPoint(11, 11);
|
||||||
|
|
||||||
defaultLineStyle(ratio);
|
defaultLineStyle(ratio);
|
||||||
@ -1373,6 +1377,40 @@ const QFont *Style::font(Style::FontSize size, Style::FontSize defaultSize) cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QImage *Style::light(Lights::Color color) const
|
||||||
|
{
|
||||||
|
switch (color) {
|
||||||
|
case Lights::Red:
|
||||||
|
return &_lightRed;
|
||||||
|
case Lights::Green:
|
||||||
|
return &_lightGreen;
|
||||||
|
case Lights::White:
|
||||||
|
return &_lightWhite;
|
||||||
|
case Lights::Yellow:
|
||||||
|
case Lights::Amber:
|
||||||
|
return &_lightYellow;
|
||||||
|
default:
|
||||||
|
return &_light;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor Style::color(Lights::Color c)
|
||||||
|
{
|
||||||
|
switch (c) {
|
||||||
|
case Lights::Red:
|
||||||
|
return Qt::red;
|
||||||
|
case Lights::Green:
|
||||||
|
return Qt::green;
|
||||||
|
case Lights::White:
|
||||||
|
return Qt::white;
|
||||||
|
case Lights::Yellow:
|
||||||
|
case Lights::Amber:
|
||||||
|
return Qt::yellow;
|
||||||
|
default:
|
||||||
|
return Qt::magenta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
static QString penColor(const QPen &pen)
|
static QString penColor(const QPen &pen)
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include "lights.h"
|
||||||
#include "subfile.h"
|
#include "subfile.h"
|
||||||
|
|
||||||
#define TYPE(t) ((t)<<8)
|
#define TYPE(t) ((t)<<8)
|
||||||
@ -112,8 +113,7 @@ public:
|
|||||||
const QList<quint32> &drawOrder() const {return _drawOrder;}
|
const QList<quint32> &drawOrder() const {return _drawOrder;}
|
||||||
const QFont *font(Style::FontSize size, Style::FontSize defaultSize
|
const QFont *font(Style::FontSize size, Style::FontSize defaultSize
|
||||||
= Style::Normal) const;
|
= Style::Normal) const;
|
||||||
|
const QImage *light(Lights::Color color) const;
|
||||||
const QImage *light() const {return &_light;}
|
|
||||||
const QPoint &lightOffset() const {return _lightOffset;}
|
const QPoint &lightOffset() const {return _lightOffset;}
|
||||||
|
|
||||||
static bool isPOI(quint32 type)
|
static bool isPOI(quint32 type)
|
||||||
@ -157,6 +157,8 @@ public:
|
|||||||
static bool isMarina(quint32 type)
|
static bool isMarina(quint32 type)
|
||||||
{return type == 0x10703;}
|
{return type == 0x10703;}
|
||||||
|
|
||||||
|
static QColor color(Lights::Color c);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Section {
|
struct Section {
|
||||||
quint32 offset;
|
quint32 offset;
|
||||||
@ -203,7 +205,7 @@ private:
|
|||||||
/* Fonts and images must be initialized after QGuiApplication! */
|
/* Fonts and images must be initialized after QGuiApplication! */
|
||||||
QFont _large, _normal, _small, _extraSmall;
|
QFont _large, _normal, _small, _extraSmall;
|
||||||
|
|
||||||
QImage _light;
|
QImage _light, _lightRed, _lightGreen, _lightYellow, _lightWhite;
|
||||||
QPoint _lightOffset;
|
QPoint _lightOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user