mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-22 02:20:47 +01:00
Read the marine lights info from the local navaid data if present
This commit is contained in:
parent
9295f8f4a9
commit
bdf75169c5
@ -118,7 +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/IMG/light.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 \
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
#ifndef IMG_LIGHTS_H
|
#ifndef IMG_LIGHT_H
|
||||||
#define IMG_LIGHTS_H
|
#define IMG_LIGHT_H
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
namespace IMG {
|
namespace IMG {
|
||||||
|
|
||||||
class Lights
|
struct Light
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
enum Color {None, Red, Green, White, Blue, Yellow, Violet, Amber};
|
enum Color {None, Red, Green, White, Blue, Yellow, Violet, Amber};
|
||||||
|
|
||||||
struct Sector
|
struct Sector
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
Sector() : color(None), angle(0), range(0) {}
|
Sector() : color(None), angle(0), range(0) {}
|
||||||
Sector(Color color, quint32 angle, quint32 range)
|
Sector(Color color, quint32 angle, quint32 range)
|
||||||
: color(color), angle(angle), range(range) {}
|
: color(color), angle(angle), range(range) {}
|
||||||
@ -22,9 +22,10 @@ public:
|
|||||||
quint32 range;
|
quint32 range;
|
||||||
};
|
};
|
||||||
|
|
||||||
Lights() : color(None), range(0) {}
|
Light() : color(None), range(0) {}
|
||||||
bool isSectorLight() const
|
Light(Color color, quint32 range) : color(color), range(range) {}
|
||||||
{return ((color && range > 6) || !sectors.isEmpty());}
|
Light(const QVector<Sector> §ors)
|
||||||
|
: color(None), range(0), sectors(sectors) {}
|
||||||
|
|
||||||
Color color;
|
Color color;
|
||||||
quint32 range;
|
quint32 range;
|
||||||
@ -34,19 +35,19 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
inline QDebug operator<<(QDebug dbg, const IMG::Lights::Sector §or)
|
inline QDebug operator<<(QDebug dbg, const IMG::Light::Sector §or)
|
||||||
{
|
{
|
||||||
dbg.nospace() << "Sector(" << sector.color << ", " << sector.angle
|
dbg.nospace() << "Sector(" << sector.color << ", " << sector.angle
|
||||||
<< ", " << sector.range << ")";
|
<< ", " << sector.range << ")";
|
||||||
return dbg.space();
|
return dbg.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QDebug operator<<(QDebug dbg, const IMG::Lights &lights)
|
inline QDebug operator<<(QDebug dbg, const IMG::Light &light)
|
||||||
{
|
{
|
||||||
dbg.nospace() << "Lights(" << lights.color << ", " << lights.range << ", "
|
dbg.nospace() << "Light(" << light.color << ", " << light.range << ", "
|
||||||
<< lights.sectors << ")";
|
<< light.sectors << ")";
|
||||||
return dbg.space();
|
return dbg.space();
|
||||||
}
|
}
|
||||||
#endif // QT_NO_DEBUG
|
#endif // QT_NO_DEBUG
|
||||||
|
|
||||||
#endif // IMG_LIGHTS_H
|
#endif // IMG_LIGHT_H
|
@ -14,7 +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 "light.h"
|
||||||
#include "zoom.h"
|
#include "zoom.h"
|
||||||
|
|
||||||
namespace IMG {
|
namespace IMG {
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
Coordinates coordinates;
|
Coordinates coordinates;
|
||||||
Label label;
|
Label label;
|
||||||
Lights lights;
|
QVector<Light> lights;
|
||||||
quint64 id;
|
quint64 id;
|
||||||
quint32 type;
|
quint32 type;
|
||||||
quint32 flags;
|
quint32 flags;
|
||||||
|
@ -19,6 +19,7 @@ using namespace IMG;
|
|||||||
#define TEXT_EXTENT 160
|
#define TEXT_EXTENT 160
|
||||||
#define ICON_PADDING 2
|
#define ICON_PADDING 2
|
||||||
#define RANGE_FACTOR 4
|
#define RANGE_FACTOR 4
|
||||||
|
#define RANGE_MIN 6
|
||||||
#define ROAD 0
|
#define ROAD 0
|
||||||
#define WATER 1
|
#define WATER 1
|
||||||
|
|
||||||
@ -228,8 +229,8 @@ void RasterTile::drawTextItems(QPainter *painter,
|
|||||||
|
|
||||||
static QRect lightRect(const QPoint &pos, quint32 range)
|
static QRect lightRect(const QPoint &pos, quint32 range)
|
||||||
{
|
{
|
||||||
return QRect(pos.x() - range * RANGE_FACTOR, pos.y() - range * RANGE_FACTOR,
|
quint32 r = qMin(range * RANGE_FACTOR, (quint32)TEXT_EXTENT);
|
||||||
2*range * RANGE_FACTOR, 2*range * RANGE_FACTOR);
|
return QRect(pos.x() - r, pos.y() - r, 2 * r, 2 * r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::drawSectorLights(QPainter *painter,
|
void RasterTile::drawSectorLights(QPainter *painter,
|
||||||
@ -239,11 +240,14 @@ void RasterTile::drawSectorLights(QPainter *painter,
|
|||||||
const MapData::Point *p = lights.at(i);
|
const MapData::Point *p = lights.at(i);
|
||||||
QPoint pos(p->coordinates.lon(), p->coordinates.lat());
|
QPoint pos(p->coordinates.lon(), p->coordinates.lat());
|
||||||
|
|
||||||
if (p->lights.sectors.size()) {
|
for (int j = 0; j < p->lights.size(); j++) {
|
||||||
for (int j = 0; j < p->lights.sectors.size(); j++) {
|
const Light &l = p->lights.at(j);
|
||||||
const Lights::Sector &start = p->lights.sectors.at(j);
|
|
||||||
const Lights::Sector &end = (j == p->lights.sectors.size() - 1)
|
if (l.sectors.size()) {
|
||||||
? p->lights.sectors.at(0) : p->lights.sectors.at(j+1);
|
for (int k = 0; k < l.sectors.size(); k++) {
|
||||||
|
const Light::Sector &start = l.sectors.at(k);
|
||||||
|
const Light::Sector &end = (k == l.sectors.size() - 1)
|
||||||
|
? l.sectors.at(0) : l.sectors.at(k+1);
|
||||||
|
|
||||||
if (start.color) {
|
if (start.color) {
|
||||||
double a1 = -(end.angle / 10.0 + 90.0);
|
double a1 = -(end.angle / 10.0 + 90.0);
|
||||||
@ -254,7 +258,8 @@ void RasterTile::drawSectorLights(QPainter *painter,
|
|||||||
if (as == 0)
|
if (as == 0)
|
||||||
as = 360;
|
as = 360;
|
||||||
|
|
||||||
QRect rect(lightRect(pos, start.range ? start.range : 6));
|
QRect rect(lightRect(pos, start.range
|
||||||
|
? start.range : RANGE_MIN));
|
||||||
|
|
||||||
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine,
|
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine,
|
||||||
Qt::FlatCap));
|
Qt::FlatCap));
|
||||||
@ -264,7 +269,8 @@ void RasterTile::drawSectorLights(QPainter *painter,
|
|||||||
painter->drawArc(rect, a1 * 16, as * 16);
|
painter->drawArc(rect, a1 * 16, as * 16);
|
||||||
|
|
||||||
if (a2 - a1 != 0) {
|
if (a2 - a1 != 0) {
|
||||||
QLineF ln(pos, QPointF(pos.x() + rect.width(), pos.y()));
|
QLineF ln(pos, QPointF(pos.x() + rect.width(),
|
||||||
|
pos.y()));
|
||||||
ln.setAngle(a1);
|
ln.setAngle(a1);
|
||||||
painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
|
painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
|
||||||
painter->drawLine(ln);
|
painter->drawLine(ln);
|
||||||
@ -273,16 +279,17 @@ void RasterTile::drawSectorLights(QPainter *painter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (l.range > RANGE_MIN) {
|
||||||
QRect rect(lightRect(pos, p->lights.range));
|
QRect rect(lightRect(pos, l.range));
|
||||||
|
|
||||||
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine, Qt::FlatCap));
|
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine, Qt::FlatCap));
|
||||||
painter->drawArc(rect, 0, 360 * 16);
|
painter->drawArc(rect, 0, 360 * 16);
|
||||||
painter->setPen(QPen(Style::color(p->lights.color), 4,
|
painter->setPen(QPen(Style::color(l.color), 4, Qt::SolidLine,
|
||||||
Qt::SolidLine, Qt::FlatCap));
|
Qt::FlatCap));
|
||||||
painter->drawArc(rect, 0, 360 * 16);
|
painter->drawArc(rect, 0, 360 * 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text,
|
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text,
|
||||||
@ -456,6 +463,17 @@ void RasterTile::processShields(const QList<MapData::Poly> &lines,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool showAsSector(const QVector<Light> &lights)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < lights.size(); i++) {
|
||||||
|
const Light &l = lights.at(i);
|
||||||
|
if ((l.color && l.range > RANGE_MIN) || !l.sectors.isEmpty())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void RasterTile::processPoints(QList<MapData::Point> &points,
|
void RasterTile::processPoints(QList<MapData::Point> &points,
|
||||||
QList<TextItem*> &textItems, QList<const MapData::Point*> &lights)
|
QList<TextItem*> &textItems, QList<const MapData::Point*> &lights)
|
||||||
{
|
{
|
||||||
@ -466,8 +484,9 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
|
|||||||
const Style *style = _data->style();
|
const Style *style = _data->style();
|
||||||
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);
|
||||||
|
bool sl = showAsSector(point.lights);
|
||||||
|
|
||||||
if (point.lights.isSectorLight())
|
if (sl)
|
||||||
lights.append(&point);
|
lights.append(&point);
|
||||||
|
|
||||||
const QString *label = point.label.text().isEmpty()
|
const QString *label = point.label.text().isEmpty()
|
||||||
@ -490,12 +509,16 @@ 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() && (point.lights.isSectorLight()
|
if (item->isValid() && (sl || !item->collides(textItems))) {
|
||||||
|| !item->collides(textItems))) {
|
|
||||||
textItems.append(item);
|
textItems.append(item);
|
||||||
if (point.lights.color && !point.lights.isSectorLight())
|
for (int j = 0; j < point.lights.size(); j++) {
|
||||||
|
const Light &l = point.lights.at(j);
|
||||||
|
if (l.color && l.range <= RANGE_MIN) {
|
||||||
textItems.append(new TextPointItem(pos + style->lightOffset(),
|
textItems.append(new TextPointItem(pos + style->lightOffset(),
|
||||||
0, 0, style->light(point.lights.color), 0, 0, 0, 0));
|
0, 0, style->light(l.color), 0, 0, 0, 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ bool RGNFile::readBuoyInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
lc = (val >> 6) & 7;
|
lc = (val >> 6) & 7;
|
||||||
|
|
||||||
if (lc)
|
if (lc)
|
||||||
point->lights.color = (Lights::Color)lc;
|
point->lights.append(Light((Light::Color)lc, 0));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -190,6 +190,7 @@ bool RGNFile::readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
if (flags1 & 0x800) {
|
if (flags1 & 0x800) {
|
||||||
quint16 la;
|
quint16 la;
|
||||||
quint8 cf, range = 0;
|
quint8 cf, range = 0;
|
||||||
|
QVector<Light::Sector> sectors;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!(size >= 2 && readUInt16(hdl, la)))
|
if (!(size >= 2 && readUInt16(hdl, la)))
|
||||||
@ -197,14 +198,16 @@ bool RGNFile::readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
size -= 2;
|
size -= 2;
|
||||||
|
|
||||||
cf = la >> 8;
|
cf = la >> 8;
|
||||||
Lights::Color c = (Lights::Color)(cf >> 4 & 7);
|
Light::Color c = (Light::Color)(cf >> 4 & 7);
|
||||||
if (c) {
|
if (c) {
|
||||||
if (!(size >= 1 && readUInt8(hdl, range)))
|
if (!(size >= 1 && readUInt8(hdl, range)))
|
||||||
return false;
|
return false;
|
||||||
size--;
|
size--;
|
||||||
}
|
}
|
||||||
point->lights.sectors.append(Lights::Sector(c, la & 0xfff, range));
|
sectors.append(Light::Sector(c, la & 0xfff, range));
|
||||||
} while (!(cf >> 7));
|
} while (!(cf >> 7));
|
||||||
|
|
||||||
|
point->lights.append(Light(sectors));
|
||||||
} else {
|
} else {
|
||||||
quint8 v1, v2, range;
|
quint8 v1, v2, range;
|
||||||
|
|
||||||
@ -220,8 +223,7 @@ bool RGNFile::readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
range += v2;
|
range += v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
point->lights.color = (Lights::Color)(v1 >> 5);
|
point->lights.append(Light((Light::Color)(v1 >> 5), range));
|
||||||
point->lights.range = range;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -289,8 +291,153 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
|
|||||||
return seek(hdl, off + rs);
|
return seek(hdl, off + rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RGNFile::skipLclFields(Handle &hdl, const quint32 flags[3]) const
|
bool RGNFile::readLclNavaid(Handle &hdl, quint32 size,
|
||||||
|
MapData::Point *point) const
|
||||||
{
|
{
|
||||||
|
quint32 unused, flags;
|
||||||
|
|
||||||
|
if (!(size >= 4 && readUInt32(hdl, flags)))
|
||||||
|
return false;
|
||||||
|
size -= 4;
|
||||||
|
if (flags & 1) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
if (flags & 2) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
if (flags & 4) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
if (flags & 8) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 0x10) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 0x20) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 0x200) {
|
||||||
|
quint8 b;
|
||||||
|
do {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, b)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
} while (b & 0x80);
|
||||||
|
}
|
||||||
|
|
||||||
|
quint8 lights = (flags >> 6) & 7;
|
||||||
|
|
||||||
|
for (quint32 i = 0; i < lights; i ++) {
|
||||||
|
quint32 fs, vs, lflags;
|
||||||
|
Light light;
|
||||||
|
|
||||||
|
if (!(readVUInt32(hdl, fs, &vs) && size >= vs))
|
||||||
|
return false;
|
||||||
|
size -= vs;
|
||||||
|
if (!(size >= 4 && readUInt32(hdl, lflags)))
|
||||||
|
return false;
|
||||||
|
size -= 4;
|
||||||
|
if (lflags >> 0x11 & 3) {
|
||||||
|
if (!(size >= (lflags >> 0x11 & 3)
|
||||||
|
&& readVUInt32(hdl, lflags >> 0x11 & 3, unused)))
|
||||||
|
return false;
|
||||||
|
size -= (lflags >> 0x11 & 3);
|
||||||
|
}
|
||||||
|
if (lflags & 0x3000) {
|
||||||
|
if (lflags & 0x2000) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
unused |= (lflags >> 4) & 0x100;
|
||||||
|
} else {
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lflags & 0x100000) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
if (unused & 0x80) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
quint8 sectors = lflags & 0x1f;
|
||||||
|
|
||||||
|
for (quint32 j = 0; j < sectors; j++) {
|
||||||
|
quint32 cf, range = 0;
|
||||||
|
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, cf)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
if (cf >> 6) {
|
||||||
|
if (!(size >= (cf >> 6) && readVUInt32(hdl, cf >> 6, range)))
|
||||||
|
return false;
|
||||||
|
size -= (cf >> 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sectors > 1) {
|
||||||
|
quint32 angle;
|
||||||
|
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, angle)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
if ((lflags >> 0x13) & 1) {
|
||||||
|
quint32 sflags;
|
||||||
|
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, sflags)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
if (0x3f < sflags) {
|
||||||
|
if (sflags & 0x80) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
unused |= (sflags & 0x40) << 2;
|
||||||
|
} else {
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
light.sectors.append(Light::Sector((Light::Color)(cf & 0x7),
|
||||||
|
angle, range));
|
||||||
|
} else {
|
||||||
|
light.color = (Light::Color)(cf & 0x7);
|
||||||
|
light.range = range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
point->lights.append(light);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (size == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RGNFile::readLclFields(Handle &hdl, const quint32 flags[3],
|
||||||
|
SegmentType segmentType, void *object) const
|
||||||
|
{
|
||||||
|
MapData::Point *point = (segmentType == Point)
|
||||||
|
? (MapData::Point *) object : 0;
|
||||||
quint32 bitfield = 0xFFFFFFFF;
|
quint32 bitfield = 0xFFFFFFFF;
|
||||||
|
|
||||||
if (flags[0] & 0x20000000)
|
if (flags[0] & 0x20000000)
|
||||||
@ -302,14 +449,21 @@ bool RGNFile::skipLclFields(Handle &hdl, const quint32 flags[3]) const
|
|||||||
if (bitfield & 1) {
|
if (bitfield & 1) {
|
||||||
quint32 m = flags[(j >> 4) + 1] >> ((j * 2) & 0x1e) & 3;
|
quint32 m = flags[(j >> 4) + 1] >> ((j * 2) & 0x1e) & 3;
|
||||||
|
|
||||||
quint32 skip = 0;
|
quint32 size = 0;
|
||||||
if (m == 3) {
|
if (m == 3) {
|
||||||
if (!readVUInt32(hdl, skip))
|
if (!readVUInt32(hdl, size))
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
skip = m + 1;
|
size = m + 1;
|
||||||
if (!seek(hdl, pos(hdl) + skip))
|
|
||||||
|
if (i == 2 && point) {
|
||||||
|
point->lights.clear();
|
||||||
|
if (!readLclNavaid(hdl, size, point))
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
if (!seek(hdl, pos(hdl) + size))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bitfield >>= 1;
|
bitfield >>= 1;
|
||||||
j++;
|
j++;
|
||||||
@ -563,8 +717,8 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
|
|||||||
if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl,
|
if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl,
|
||||||
lblHdl))
|
lblHdl))
|
||||||
return false;
|
return false;
|
||||||
if (subtype & 0x40 && !skipLclFields(hdl, segmentType == Line
|
if (subtype & 0x40 && !readLclFields(hdl, segmentType == Line
|
||||||
? _linesLclFlags : _polygonsLclFlags))
|
? _linesLclFlags : _polygonsLclFlags, segmentType, &poly))
|
||||||
return false;
|
return false;
|
||||||
quint32 gblFlags = (segmentType == Line)
|
quint32 gblFlags = (segmentType == Line)
|
||||||
? _linesGblFlags : _polygonsGblFlags;
|
? _linesGblFlags : _polygonsGblFlags;
|
||||||
@ -654,7 +808,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
|
|||||||
return false;
|
return false;
|
||||||
if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl, lblHdl))
|
if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl, lblHdl))
|
||||||
return false;
|
return false;
|
||||||
if (subtype & 0x40 && !skipLclFields(hdl, _pointsLclFlags))
|
if (subtype & 0x40 && !readLclFields(hdl, _pointsLclFlags, Point, &point))
|
||||||
return false;
|
return false;
|
||||||
if (_pointsGblFlags && !skipGblFields(hdl, _pointsGblFlags))
|
if (_pointsGblFlags && !skipGblFields(hdl, _pointsGblFlags))
|
||||||
return false;
|
return false;
|
||||||
|
@ -56,7 +56,8 @@ private:
|
|||||||
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
|
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
|
||||||
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
|
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
|
||||||
LBLFile *lbl, Handle &lblHdl) const;
|
LBLFile *lbl, Handle &lblHdl) const;
|
||||||
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
|
bool readLclFields(Handle &hdl, const quint32 flags[3],
|
||||||
|
SegmentType segmentType, void *object) const;
|
||||||
bool skipGblFields(Handle &hdl, quint32 flags) const;
|
bool skipGblFields(Handle &hdl, quint32 flags) const;
|
||||||
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
|
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
|
||||||
MapData::Poly *poly) const;
|
MapData::Poly *poly) const;
|
||||||
@ -70,6 +71,8 @@ private:
|
|||||||
MapData::Point *point) const;
|
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;
|
||||||
|
bool readLclNavaid(Handle &hdl, quint32 size,
|
||||||
|
MapData::Point *point) const;
|
||||||
|
|
||||||
HuffmanTable *_huffmanTable;
|
HuffmanTable *_huffmanTable;
|
||||||
Section _base, _dict, _polygons, _lines, _points;
|
Section _base, _dict, _polygons, _lines, _points;
|
||||||
|
@ -1377,34 +1377,34 @@ const QFont *Style::font(Style::FontSize size, Style::FontSize defaultSize) cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QImage *Style::light(Lights::Color color) const
|
const QImage *Style::light(Light::Color color) const
|
||||||
{
|
{
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case Lights::Red:
|
case Light::Red:
|
||||||
return &_lightRed;
|
return &_lightRed;
|
||||||
case Lights::Green:
|
case Light::Green:
|
||||||
return &_lightGreen;
|
return &_lightGreen;
|
||||||
case Lights::White:
|
case Light::White:
|
||||||
return &_lightWhite;
|
return &_lightWhite;
|
||||||
case Lights::Yellow:
|
case Light::Yellow:
|
||||||
case Lights::Amber:
|
case Light::Amber:
|
||||||
return &_lightYellow;
|
return &_lightYellow;
|
||||||
default:
|
default:
|
||||||
return &_light;
|
return &_light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor Style::color(Lights::Color c)
|
QColor Style::color(Light::Color c)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case Lights::Red:
|
case Light::Red:
|
||||||
return Qt::red;
|
return Qt::red;
|
||||||
case Lights::Green:
|
case Light::Green:
|
||||||
return Qt::green;
|
return Qt::green;
|
||||||
case Lights::White:
|
case Light::White:
|
||||||
return Qt::white;
|
return Qt::white;
|
||||||
case Lights::Yellow:
|
case Light::Yellow:
|
||||||
case Lights::Amber:
|
case Light::Amber:
|
||||||
return Qt::yellow;
|
return Qt::yellow;
|
||||||
default:
|
default:
|
||||||
return Qt::magenta;
|
return Qt::magenta;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "lights.h"
|
#include "light.h"
|
||||||
#include "subfile.h"
|
#include "subfile.h"
|
||||||
|
|
||||||
#define TYPE(t) ((t)<<8)
|
#define TYPE(t) ((t)<<8)
|
||||||
@ -113,7 +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(Light::Color color) const;
|
||||||
const QPoint &lightOffset() const {return _lightOffset;}
|
const QPoint &lightOffset() const {return _lightOffset;}
|
||||||
|
|
||||||
static bool isPOI(quint32 type)
|
static bool isPOI(quint32 type)
|
||||||
@ -157,7 +157,7 @@ public:
|
|||||||
static bool isMarina(quint32 type)
|
static bool isMarina(quint32 type)
|
||||||
{return type == 0x10703;}
|
{return type == 0x10703;}
|
||||||
|
|
||||||
static QColor color(Lights::Color c);
|
static QColor color(Light::Color c);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Section {
|
struct Section {
|
||||||
|
@ -41,7 +41,7 @@ bool SubFile::seek(Handle &handle, quint32 pos) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubFile::readVUInt32(Handle &hdl, quint32 &val) const
|
bool SubFile::readVUInt32(Handle &hdl, quint32 &val, quint32 *size) const
|
||||||
{
|
{
|
||||||
quint8 bytes, shift, b;
|
quint8 bytes, shift, b;
|
||||||
|
|
||||||
@ -69,6 +69,9 @@ bool SubFile::readVUInt32(Handle &hdl, quint32 &val) const
|
|||||||
val |= (((quint32)b) << (i * 8)) >> (8 - shift);
|
val |= (((quint32)b) << (i * 8)) >> (8 - shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size)
|
||||||
|
*size = 1 + bytes;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readVUInt32(Handle &hdl, quint32 &val) const;
|
bool readVUInt32(Handle &hdl, quint32 &val, quint32 *size = 0) const;
|
||||||
bool readVUInt32(Handle &hdl, quint32 bytes, quint32 &val) const;
|
bool readVUInt32(Handle &hdl, quint32 bytes, quint32 &val) const;
|
||||||
bool readVBitfield32(Handle &hdl, quint32 &bitfield) const;
|
bool readVBitfield32(Handle &hdl, quint32 &bitfield) const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user