mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-20 12:19:11 +02:00
Compare commits
No commits in common. "c96a0fd8f4658c8984526688569a934f8a1dfb18" and "af688314fb94f1298b470fb4aaf5b34e38547747" have entirely different histories.
c96a0fd8f4
...
af688314fb
@ -12,6 +12,5 @@
|
||||
#define OBJNAM 116
|
||||
#define RESTRN 131
|
||||
#define VALDCO 174
|
||||
#define WATLEV 187
|
||||
|
||||
#endif // ENC_ATTRIBUTES_H
|
||||
|
@ -258,7 +258,7 @@ QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
{
|
||||
QVector<Coordinates> path;
|
||||
Coordinates c[2];
|
||||
uint ORNT;
|
||||
uint ORNT, MASK;
|
||||
quint8 type;
|
||||
quint32 id;
|
||||
|
||||
@ -270,6 +270,8 @@ QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
if (!parseNAME(FSPT, &type, &id, i) || type != RCNM_VE)
|
||||
return QVector<Coordinates>();
|
||||
ORNT = FSPT->data().at(i).at(1).toUInt();
|
||||
MASK = FSPT->data().at(i).at(3).toUInt();
|
||||
Q_ASSERT(MASK != 1);
|
||||
|
||||
RecordMapIterator it = ve.find(id);
|
||||
if (it == ve.constEnd())
|
||||
@ -324,7 +326,7 @@ Polygon MapData::polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
Polygon path;
|
||||
QVector<Coordinates> v;
|
||||
Coordinates c[2];
|
||||
uint ORNT, USAG;
|
||||
uint ORNT, USAG, MASK;
|
||||
quint8 type;
|
||||
quint32 id;
|
||||
|
||||
@ -337,6 +339,8 @@ Polygon MapData::polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
return Polygon();
|
||||
ORNT = FSPT->data().at(i).at(1).toUInt();
|
||||
USAG = FSPT->data().at(i).at(2).toUInt();
|
||||
MASK = FSPT->data().at(i).at(3).toUInt();
|
||||
Q_ASSERT(MASK != 1);
|
||||
|
||||
if (USAG == 2 && path.isEmpty()) {
|
||||
path.append(v);
|
||||
@ -416,8 +420,7 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL)
|
||||
if ((OBJL == HRBFAC && key == CATHAF)
|
||||
|| (OBJL == LNDMRK && key == CATLMK)
|
||||
|| (OBJL == WRECKS && key == CATWRK)
|
||||
|| (OBJL == MORFAC && key == CATMOR)
|
||||
|| (OBJL == UWTROC && key == WATLEV))
|
||||
|| (OBJL == MORFAC && key == CATMOR))
|
||||
subtype = av.at(1).toString().toUInt();
|
||||
}
|
||||
|
||||
@ -605,7 +608,7 @@ bool MapData::bounds(const QVector<ISO8211::Record> &gv, Rect &b)
|
||||
return true;
|
||||
}
|
||||
|
||||
MapData::MapData(const QString &path): _fileName(path)
|
||||
bool MapData::fetchBoundsAndName()
|
||||
{
|
||||
QFile file(_fileName);
|
||||
QVector<ISO8211::Record> gv;
|
||||
@ -614,34 +617,42 @@ MapData::MapData(const QString &path): _fileName(path)
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
_errorString = file.errorString();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ddf.readDDR(file)) {
|
||||
_errorString = ddf.errorString();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
while (!file.atEnd()) {
|
||||
ISO8211::Record record;
|
||||
if (!ddf.readRecord(file, record)) {
|
||||
_errorString = ddf.errorString();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (!processRecord(record, gv, COMF, _name))
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
Rect b;
|
||||
if (!bounds(gv, b)) {
|
||||
_errorString = "Error fetching geometries bounds";
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
RectC br(Coordinates(b.minX() / (double)COMF, b.maxY() / (double)COMF),
|
||||
Coordinates(b.maxX() / (double)COMF, b.minY() / (double)COMF));
|
||||
if (!br.isValid())
|
||||
if (!br.isValid()) {
|
||||
_errorString = "Invalid geometries bounds";
|
||||
else
|
||||
return false;
|
||||
} else
|
||||
_bounds = br;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MapData::MapData(const QString &path): _fileName(path)
|
||||
{
|
||||
fetchBoundsAndName();
|
||||
}
|
||||
|
||||
MapData::~MapData()
|
||||
|
@ -147,6 +147,8 @@ private:
|
||||
typedef RTree<Line*, double, 2> LineTree;
|
||||
typedef RTree<Point*, double, 2> PointTree;
|
||||
|
||||
bool fetchBoundsAndName();
|
||||
|
||||
static QVector<Sounding> soundings(const ISO8211::Record &r, uint COMF,
|
||||
uint SOMF);
|
||||
static QVector<Sounding> soundingGeometry(const ISO8211::Record &r,
|
||||
|
@ -50,7 +50,6 @@
|
||||
#define SLCONS 122
|
||||
#define SLOTOP 126
|
||||
#define SOUNDG 129
|
||||
#define TSELNE 145
|
||||
#define TSSBND 146
|
||||
#define TSEZNE 150
|
||||
#define UWTROC 153
|
||||
|
@ -93,7 +93,6 @@ void Style::defaultLineStyle()
|
||||
_lines[TYPE(RAILWY)] = Line(railroad());
|
||||
_lines[TYPE(ROADWY)] = Line(QPen(QColor("#000000"), 2, Qt::SolidLine));
|
||||
_lines[TYPE(GATCON)] = Line(QPen(QColor("#000000"), 2, Qt::SolidLine));
|
||||
_lines[TYPE(TSELNE)] = Line(QPen(QColor("#80fcb4fc"), 4, Qt::SolidLine));
|
||||
}
|
||||
|
||||
void Style::defaultPointStyle()
|
||||
@ -116,22 +115,14 @@ void Style::defaultPointStyle()
|
||||
_points[SUBTYPE(LNDMRK, 17)] = Point(QImage(":/marine/tower.png"));
|
||||
_points[TYPE(LNDELV)] = Point(QImage(":/marine/triangulation-point.png"));
|
||||
_points[TYPE(OBSTRN)] = Point(QImage(":/marine/obstruction.png"), Small);
|
||||
_points[TYPE(WRECKS)] = Point(QImage(":/marine/wreck.png"), Small);
|
||||
_points[SUBTYPE(WRECKS, 1)] = Point(QImage(":/marine/wreck.png"), Small);
|
||||
_points[SUBTYPE(WRECKS, 2)] = Point(QImage(":/marine/wreck-dangerous.png"),
|
||||
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(UWTROC, 1)] = Point(QImage(":/marine/rock-exposed.png"),
|
||||
Small);
|
||||
_points[SUBTYPE(UWTROC, 2)] = Point(QImage(":/marine/rock-exposed.png"),
|
||||
Small);
|
||||
_points[SUBTYPE(UWTROC, 3)] = Point(QImage(":/marine/rock-dangerous.png"),
|
||||
Small);
|
||||
_points[SUBTYPE(UWTROC, 4)] = Point(QImage(":/marine/rock-dangerous.png"),
|
||||
Small);
|
||||
_points[SUBTYPE(UWTROC, 5)] = Point(QImage(":/marine/rock-dangerous.png"),
|
||||
Small);
|
||||
_points[TYPE(UWTROC)] = Point(QImage(":/marine/rock-dangerous.png"), Small);
|
||||
_points[SUBTYPE(HRBFAC, 5)] = Point(QImage(":/marine/yacht-harbor.png"));
|
||||
_points[TYPE(ACHBRT)] = Point(QImage(":/marine/anchorage.png"));
|
||||
_points[TYPE(OFSPLF)] = Point(QImage(":/marine/platform.png"));
|
||||
|
@ -30,7 +30,6 @@ void ENCMap::load()
|
||||
|
||||
void ENCMap::unload()
|
||||
{
|
||||
cancelJobs(true);
|
||||
_data.clear();
|
||||
}
|
||||
|
||||
@ -57,7 +56,7 @@ int ENCMap::zoomFit(const QSize &size, const RectC &rect)
|
||||
|
||||
int ENCMap::zoomIn()
|
||||
{
|
||||
cancelJobs(false);
|
||||
cancelJobs();
|
||||
|
||||
_zoom = qMin(_zoom + 1, ZOOMS.max());
|
||||
updateTransform();
|
||||
@ -66,7 +65,7 @@ int ENCMap::zoomIn()
|
||||
|
||||
int ENCMap::zoomOut()
|
||||
{
|
||||
cancelJobs(false);
|
||||
cancelJobs();
|
||||
|
||||
_zoom = qMax(_zoom - 1, ZOOMS.min());
|
||||
updateTransform();
|
||||
@ -142,10 +141,10 @@ void ENCMap::jobFinished(ENCMapJob *job)
|
||||
emit tilesLoaded();
|
||||
}
|
||||
|
||||
void ENCMap::cancelJobs(bool wait)
|
||||
void ENCMap::cancelJobs()
|
||||
{
|
||||
for (int i = 0; i < _jobs.size(); i++)
|
||||
_jobs.at(i)->cancel(wait);
|
||||
_jobs.at(i)->cancel();
|
||||
}
|
||||
|
||||
QString ENCMap::key(int zoom, const QPoint &xy) const
|
||||
|
@ -23,12 +23,7 @@ public:
|
||||
_future = QtConcurrent::map(_tiles, &ENC::RasterTile::render);
|
||||
_watcher.setFuture(_future);
|
||||
}
|
||||
void cancel(bool wait)
|
||||
{
|
||||
_future.cancel();
|
||||
if (wait)
|
||||
_future.waitForFinished();
|
||||
}
|
||||
void cancel() {_future.cancel();}
|
||||
const QList<ENC::RasterTile> &tiles() const {return _tiles;}
|
||||
|
||||
signals:
|
||||
@ -87,7 +82,7 @@ private:
|
||||
bool isRunning(int zoom, const QPoint &xy) const;
|
||||
void runJob(ENCMapJob *job);
|
||||
void removeJob(ENCMapJob *job);
|
||||
void cancelJobs(bool wait);
|
||||
void cancelJobs();
|
||||
QString key(int zoom, const QPoint &xy) const;
|
||||
|
||||
ENC::MapData _data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user