mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-20 12:19:11 +02:00
Compare commits
No commits in common. "59523f46ef462abe0e28a964f1c76b6154202758" and "f277a0368a153eade2844eda7f0bab912237fbb8" have entirely different histories.
59523f46ef
...
f277a0368a
@ -115,12 +115,22 @@ static uint depthLevel(const QString &str)
|
||||
return 6;
|
||||
}
|
||||
|
||||
static Coordinates coordinates(int x, int y, uint COMF)
|
||||
RectC MapData::Line::bounds() const
|
||||
{
|
||||
return Coordinates(x / (double)COMF, y / (double)COMF);
|
||||
RectC b;
|
||||
|
||||
for (int i = 0; i < _path.size(); i++)
|
||||
b = b.united(_path.at(i));
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static Coordinates point(const ISO8211::Record &r, uint COMF)
|
||||
Coordinates MapData::coordinates(int x, int y) const
|
||||
{
|
||||
return Coordinates(x / (double)_COMF, y / (double)_COMF);
|
||||
}
|
||||
|
||||
Coordinates MapData::point(const ISO8211::Record &r)
|
||||
{
|
||||
const ISO8211::Field *f = SGXD(r);
|
||||
if (!f)
|
||||
@ -129,11 +139,10 @@ static Coordinates point(const ISO8211::Record &r, uint COMF)
|
||||
int y = f->data().at(0).at(0).toInt();
|
||||
int x = f->data().at(0).at(1).toInt();
|
||||
|
||||
return coordinates(x, y, COMF);
|
||||
return coordinates(x, y);
|
||||
}
|
||||
|
||||
QVector<MapData::Sounding> MapData::soundings(const ISO8211::Record &r,
|
||||
uint COMF, uint SOMF)
|
||||
QVector<MapData::Sounding> MapData::soundings(const ISO8211::Record &r)
|
||||
{
|
||||
QVector<Sounding> s;
|
||||
const ISO8211::Field *f = r.field("SG3D");
|
||||
@ -145,14 +154,13 @@ QVector<MapData::Sounding> MapData::soundings(const ISO8211::Record &r,
|
||||
int y = f->data().at(i).at(0).toInt();
|
||||
int x = f->data().at(i).at(1).toInt();
|
||||
int z = f->data().at(i).at(2).toInt();
|
||||
s.append(Sounding(coordinates(x, y, COMF), z / (double)SOMF));
|
||||
s.append(Sounding(coordinates(x, y), z / (double)_SOMF));
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
QVector<MapData::Sounding> MapData::soundingGeometry(const ISO8211::Record &r,
|
||||
const RecordMap &vi, const RecordMap &vc, uint COMF, uint SOMF)
|
||||
QVector<MapData::Sounding> MapData::soundingGeometry(const ISO8211::Record &r)
|
||||
{
|
||||
quint8 type;
|
||||
quint32 id;
|
||||
@ -165,22 +173,21 @@ QVector<MapData::Sounding> MapData::soundingGeometry(const ISO8211::Record &r,
|
||||
if (!parseNAME(FSPT, &type, &id))
|
||||
return QVector<Sounding>();
|
||||
|
||||
if (type == RCNM_VI) {
|
||||
it = vi.find(id);
|
||||
if (it == vi.constEnd())
|
||||
return QVector<Sounding>();
|
||||
} else if (type == RCNM_VC) {
|
||||
it = vc.find(id);
|
||||
if (it == vc.constEnd())
|
||||
return QVector<Sounding>();
|
||||
} else
|
||||
if (type == RCNM_VI)
|
||||
it = _vi.find(id);
|
||||
else if (type == RCNM_VC)
|
||||
it = _vc.find(id);
|
||||
else
|
||||
return QVector<Sounding>();
|
||||
if (it == _ve.constEnd())
|
||||
return QVector<Sounding>();
|
||||
|
||||
return soundings(it.value(), COMF, SOMF);
|
||||
const ISO8211::Record &FRID = it.value();
|
||||
|
||||
return soundings(FRID);
|
||||
}
|
||||
|
||||
Coordinates MapData::pointGeometry(const ISO8211::Record &r,
|
||||
const RecordMap &vi, const RecordMap &vc, uint COMF)
|
||||
Coordinates MapData::pointGeometry(const ISO8211::Record &r)
|
||||
{
|
||||
quint8 type;
|
||||
quint32 id;
|
||||
@ -193,22 +200,21 @@ Coordinates MapData::pointGeometry(const ISO8211::Record &r,
|
||||
if (!parseNAME(FSPT, &type, &id))
|
||||
return Coordinates();
|
||||
|
||||
if (type == RCNM_VI) {
|
||||
it = vi.find(id);
|
||||
if (it == vi.constEnd())
|
||||
return Coordinates();
|
||||
} else if (type == RCNM_VC) {
|
||||
it = vc.find(id);
|
||||
if (it == vc.constEnd())
|
||||
return Coordinates();
|
||||
} else
|
||||
if (type == RCNM_VI)
|
||||
it = _vi.find(id);
|
||||
else if (type == RCNM_VC)
|
||||
it = _vc.find(id);
|
||||
else
|
||||
return Coordinates();
|
||||
if (it == _ve.constEnd())
|
||||
return Coordinates();
|
||||
|
||||
return point(it.value(), COMF);
|
||||
const ISO8211::Record &FRID = it.value();
|
||||
|
||||
return point(FRID);
|
||||
}
|
||||
|
||||
QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
const RecordMap &vc, const RecordMap &ve, uint COMF)
|
||||
QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r)
|
||||
{
|
||||
QVector<Coordinates> path;
|
||||
Coordinates c[2];
|
||||
@ -227,8 +233,8 @@ QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
MASK = FSPT->data().at(i).at(3).toUInt();
|
||||
Q_ASSERT(MASK != 1);
|
||||
|
||||
RecordMapIterator it = ve.find(id);
|
||||
if (it == ve.constEnd())
|
||||
RecordMapIterator it = _ve.find(id);
|
||||
if (it == _ve.constEnd())
|
||||
return QVector<Coordinates>();
|
||||
const ISO8211::Record &FRID = it.value();
|
||||
const ISO8211::Field *VRPT = FRID.field("VRPT");
|
||||
@ -239,10 +245,10 @@ QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
if (!parseNAME(VRPT, &type, &id, j) || type != RCNM_VC)
|
||||
return QVector<Coordinates>();
|
||||
|
||||
RecordMapIterator jt = vc.find(id);
|
||||
if (jt == vc.constEnd())
|
||||
RecordMapIterator jt = _vc.find(id);
|
||||
if (jt == _vc.constEnd())
|
||||
return QVector<Coordinates>();
|
||||
c[j] = point(jt.value(), COMF);
|
||||
c[j] = point(jt.value());
|
||||
if (c[j].isNull())
|
||||
return QVector<Coordinates>();
|
||||
}
|
||||
@ -253,8 +259,7 @@ QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
if (vertexes) {
|
||||
for (int j = vertexes->data().size() - 1; j >= 0; j--) {
|
||||
const QVector<QVariant> &cv = vertexes->data().at(j);
|
||||
path.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt(),
|
||||
COMF));
|
||||
path.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt()));
|
||||
}
|
||||
}
|
||||
path.append(c[0]);
|
||||
@ -263,8 +268,7 @@ QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
if (vertexes) {
|
||||
for (int j = 0; j < vertexes->data().size(); j++) {
|
||||
const QVector<QVariant> &cv = vertexes->data().at(j);
|
||||
path.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt(),
|
||||
COMF));
|
||||
path.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt()));
|
||||
}
|
||||
}
|
||||
path.append(c[1]);
|
||||
@ -274,8 +278,7 @@ QVector<Coordinates> MapData::lineGeometry(const ISO8211::Record &r,
|
||||
return path;
|
||||
}
|
||||
|
||||
Polygon MapData::polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
const RecordMap &ve, uint COMF)
|
||||
Polygon MapData::polyGeometry(const ISO8211::Record &r)
|
||||
{
|
||||
Polygon path;
|
||||
QVector<Coordinates> v;
|
||||
@ -301,8 +304,8 @@ Polygon MapData::polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
v.clear();
|
||||
}
|
||||
|
||||
RecordMapIterator it = ve.find(id);
|
||||
if (it == ve.constEnd())
|
||||
RecordMapIterator it = _ve.find(id);
|
||||
if (it == _ve.constEnd())
|
||||
return Polygon();
|
||||
const ISO8211::Record &FRID = it.value();
|
||||
const ISO8211::Field *VRPT = FRID.field("VRPT");
|
||||
@ -313,10 +316,10 @@ Polygon MapData::polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
if (!parseNAME(VRPT, &type, &id, j) || type != RCNM_VC)
|
||||
return Polygon();
|
||||
|
||||
RecordMapIterator jt = vc.find(id);
|
||||
if (jt == vc.constEnd())
|
||||
RecordMapIterator jt = _vc.find(id);
|
||||
if (jt == _vc.constEnd())
|
||||
return Polygon();
|
||||
c[j] = point(jt.value(), COMF);
|
||||
c[j] = point(jt.value());
|
||||
if (c[j].isNull())
|
||||
return Polygon();
|
||||
}
|
||||
@ -327,8 +330,7 @@ Polygon MapData::polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
if (vertexes) {
|
||||
for (int j = vertexes->data().size() - 1; j >= 0; j--) {
|
||||
const QVector<QVariant> &cv = vertexes->data().at(j);
|
||||
v.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt(),
|
||||
COMF));
|
||||
v.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt()));
|
||||
}
|
||||
}
|
||||
v.append(c[0]);
|
||||
@ -337,8 +339,7 @@ Polygon MapData::polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
if (vertexes) {
|
||||
for (int j = 0; j < vertexes->data().size(); j++) {
|
||||
const QVector<QVariant> &cv = vertexes->data().at(j);
|
||||
v.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt(),
|
||||
COMF));
|
||||
v.append(coordinates(cv.at(1).toInt(), cv.at(0).toInt()));
|
||||
}
|
||||
}
|
||||
v.append(c[1]);
|
||||
@ -431,59 +432,33 @@ MapData::Point *MapData::pointObject(const Sounding &s)
|
||||
return new Point(SOUNDG<<16, s.c, QString::number(s.depth));
|
||||
}
|
||||
|
||||
MapData::Point *MapData::pointObject(const ISO8211::Record &r,
|
||||
const RecordMap &vi, const RecordMap &vc, uint COMF, uint OBJL)
|
||||
MapData::Point *MapData::pointObject(const ISO8211::Record &r, uint OBJL)
|
||||
{
|
||||
Coordinates c(pointGeometry(r, vi, vc, COMF));
|
||||
Coordinates c(pointGeometry(r));
|
||||
Attr attr(pointAttr(r, OBJL));
|
||||
|
||||
return (c.isNull() ? 0 : new Point(OBJL<<16|attr.subtype(), c,
|
||||
attr.label()));
|
||||
}
|
||||
|
||||
MapData::Line *MapData::lineObject(const ISO8211::Record &r,
|
||||
const RecordMap &vc, const RecordMap &ve, uint COMF, uint OBJL)
|
||||
MapData::Line *MapData::lineObject(const ISO8211::Record &r, uint OBJL)
|
||||
{
|
||||
QVector<Coordinates> path(lineGeometry(r, vc, ve, COMF));
|
||||
QVector<Coordinates> path(lineGeometry(r));
|
||||
Attr attr(lineAttr(r, OBJL));
|
||||
|
||||
return (path.isEmpty() ? 0 : new Line(OBJL<<16|attr.subtype(), path,
|
||||
attr.label()));
|
||||
}
|
||||
|
||||
MapData::Poly *MapData::polyObject(const ISO8211::Record &r,
|
||||
const RecordMap &vc, const RecordMap &ve, uint COMF, uint OBJL)
|
||||
MapData::Poly *MapData::polyObject(const ISO8211::Record &r, uint OBJL)
|
||||
{
|
||||
Polygon path(polyGeometry(r, vc, ve, COMF));
|
||||
Polygon path(polyGeometry(r));
|
||||
Attr attr(polyAttr(r, OBJL));
|
||||
|
||||
return (path.isEmpty() ? 0 : new Poly(OBJL<<16|attr.subtype(), path));
|
||||
}
|
||||
|
||||
bool MapData::processRecord(const ISO8211::Record &record,
|
||||
QVector<ISO8211::Record> &rv, uint &COMF, QString &name)
|
||||
{
|
||||
const ISO8211::Field &f = record.at(1);
|
||||
const QByteArray &ba = f.tag();
|
||||
|
||||
if (ba == "VRID") {
|
||||
rv.append(record);
|
||||
} else if (ba == "DSID") {
|
||||
QByteArray DSNM;
|
||||
if (!f.subfield("DSNM", &DSNM))
|
||||
return false;
|
||||
name = DSNM;
|
||||
} else if (ba == "DSPM") {
|
||||
if (!f.subfield("COMF", &COMF))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapData::processRecord(const ISO8211::Record &record,
|
||||
QVector<ISO8211::Record> &fe, RecordMap &vi, RecordMap &vc, RecordMap &ve,
|
||||
RecordMap &vf, uint &COMF, uint &SOMF)
|
||||
bool MapData::processRecord(const ISO8211::Record &record)
|
||||
{
|
||||
const ISO8211::Field &f = record.at(1);
|
||||
const QByteArray &ba = f.tag();
|
||||
@ -496,24 +471,31 @@ bool MapData::processRecord(const ISO8211::Record &record,
|
||||
|
||||
switch (RCNM) {
|
||||
case RCNM_VI:
|
||||
vi.insert(RCID, record);
|
||||
_vi.insert(RCID, record);
|
||||
break;
|
||||
case RCNM_VC:
|
||||
vc.insert(RCID, record);
|
||||
_vc.insert(RCID, record);
|
||||
break;
|
||||
case RCNM_VE:
|
||||
ve.insert(RCID, record);
|
||||
_ve.insert(RCID, record);
|
||||
break;
|
||||
case RCNM_VF:
|
||||
vf.insert(RCID, record);
|
||||
_vf.insert(RCID, record);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else if (ba == "FRID") {
|
||||
fe.append(record);
|
||||
_fe.append(record);
|
||||
} else if (ba == "DSID") {
|
||||
QByteArray DSNM;
|
||||
|
||||
if (!f.subfield("DSNM", &DSNM))
|
||||
return false;
|
||||
|
||||
_name = DSNM;
|
||||
} else if (ba == "DSPM") {
|
||||
if (!(f.subfield("COMF", &COMF) && f.subfield("SOMF", &SOMF)))
|
||||
if (!(f.subfield("COMF", &_COMF) && f.subfield("SOMF", &_SOMF)))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -523,10 +505,9 @@ bool MapData::processRecord(const ISO8211::Record &record,
|
||||
bool MapData::bounds(const ISO8211::Record &record, Rect &rect)
|
||||
{
|
||||
bool xok, yok;
|
||||
// edge geometries can be empty!
|
||||
const ISO8211::Field *f = SGXD(record);
|
||||
if (!f)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < f->data().size(); i++) {
|
||||
const QVector<QVariant> &c = f->data().at(i);
|
||||
@ -538,64 +519,54 @@ bool MapData::bounds(const ISO8211::Record &record, Rect &rect)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MapData::bounds(const QVector<ISO8211::Record> &gv, Rect &b)
|
||||
MapData::Rect MapData::bounds(const RecordMap &map)
|
||||
{
|
||||
Rect r;
|
||||
Rect b, r;
|
||||
|
||||
for (int i = 0; i < gv.size(); i++) {
|
||||
if (!bounds(gv.at(i), r))
|
||||
return false;
|
||||
b |= r;
|
||||
}
|
||||
for (RecordMapIterator it = map.constBegin(); it != map.constEnd(); ++it)
|
||||
if (bounds(it.value(), r))
|
||||
b |= r;
|
||||
|
||||
return true;
|
||||
return b;
|
||||
}
|
||||
|
||||
bool MapData::fetchBoundsAndName()
|
||||
RectC MapData::bounds() const
|
||||
{
|
||||
QFile file(_fileName);
|
||||
QVector<ISO8211::Record> gv;
|
||||
ISO8211 ddf;
|
||||
uint COMF = 1;
|
||||
const RecordMap *maps[] = {&_vi, &_vc, &_ve, &_vf};
|
||||
Rect b;
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(maps); i++)
|
||||
b |= bounds(*maps[i]);
|
||||
|
||||
return RectC(
|
||||
Coordinates(b.minX() / (double)_COMF, b.maxY() / (double)_COMF),
|
||||
Coordinates(b.maxX() / (double)_COMF, b.minY() / (double)_COMF));
|
||||
}
|
||||
|
||||
MapData::MapData(const QString &path): _valid(false)
|
||||
{
|
||||
QFile file(path);
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
_errorString = file.errorString();
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ddf.readDDR(file)) {
|
||||
_errorString = ddf.errorString();
|
||||
return false;
|
||||
if (!_ddf.readDDR(file)) {
|
||||
_errorString = _ddf.errorString();
|
||||
return;
|
||||
}
|
||||
while (!file.atEnd()) {
|
||||
ISO8211::Record record;
|
||||
if (!ddf.readRecord(file, record)) {
|
||||
_errorString = ddf.errorString();
|
||||
return false;
|
||||
if (!_ddf.readRecord(file, record)) {
|
||||
_errorString = _ddf.errorString();
|
||||
return;
|
||||
}
|
||||
if (!processRecord(record, gv, COMF, _name))
|
||||
return false;
|
||||
if (!processRecord(record))
|
||||
return;
|
||||
}
|
||||
|
||||
Rect b;
|
||||
if (!bounds(gv, b)) {
|
||||
_errorString = "Error fetching geometries bounds";
|
||||
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()) {
|
||||
_errorString = "Invalid geometries bounds";
|
||||
return false;
|
||||
} else
|
||||
_bounds = br;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MapData::MapData(const QString &path): _fileName(path)
|
||||
{
|
||||
fetchBoundsAndName();
|
||||
_valid = true;
|
||||
}
|
||||
|
||||
MapData::~MapData()
|
||||
@ -615,33 +586,14 @@ MapData::~MapData()
|
||||
|
||||
void MapData::load()
|
||||
{
|
||||
QFile file(_fileName);
|
||||
RecordMap vi, vc, ve, vf;
|
||||
QVector<ISO8211::Record> fe;
|
||||
uint COMF = 1, SOMF = 1;
|
||||
ISO8211 ddf;
|
||||
uint PRIM, OBJL;
|
||||
Poly *poly;
|
||||
Line *line;
|
||||
Point *point;
|
||||
double min[2], max[2];
|
||||
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
return;
|
||||
|
||||
if (!ddf.readDDR(file))
|
||||
return;
|
||||
while (!file.atEnd()) {
|
||||
ISO8211::Record record;
|
||||
if (!ddf.readRecord(file, record))
|
||||
return;
|
||||
if (!processRecord(record, fe, vi, vc, ve, vf, COMF, SOMF))
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < fe.size(); i++) {
|
||||
const ISO8211::Record &r = fe.at(i);
|
||||
for (int i = 0; i < _fe.size(); i++) {
|
||||
const ISO8211::Record &r = _fe.at(i);
|
||||
const ISO8211::Field &f = r.at(1);
|
||||
|
||||
if (f.data().at(0).size() < 5)
|
||||
@ -652,14 +604,14 @@ void MapData::load()
|
||||
switch (PRIM) {
|
||||
case PRIM_P:
|
||||
if (OBJL == SOUNDG) {
|
||||
QVector<Sounding> s(soundingGeometry(r, vi, vc, COMF, SOMF));
|
||||
QVector<Sounding> s(soundingGeometry(r));
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
point = pointObject(s.at(i));
|
||||
pointBounds(point->pos(), min, max);
|
||||
_points.Insert(min, max, point);
|
||||
}
|
||||
} else {
|
||||
if ((point = pointObject(r, vi, vc, COMF, OBJL))) {
|
||||
if ((point = pointObject(r, OBJL))) {
|
||||
pointBounds(point->pos(), min, max);
|
||||
_points.Insert(min, max, point);
|
||||
} else
|
||||
@ -667,14 +619,14 @@ void MapData::load()
|
||||
}
|
||||
break;
|
||||
case PRIM_L:
|
||||
if ((line = lineObject(r, vc, ve, COMF, OBJL))) {
|
||||
if ((line = lineObject(r, OBJL))) {
|
||||
rectcBounds(line->bounds(), min, max);
|
||||
_lines.Insert(min, max, line);
|
||||
} else
|
||||
warning(f, PRIM);
|
||||
break;
|
||||
case PRIM_A:
|
||||
if ((poly = polyObject(r, vc, ve, COMF, OBJL))) {
|
||||
if ((poly = polyObject(r, OBJL))) {
|
||||
rectcBounds(poly->bounds(), min, max);
|
||||
_areas.Insert(min, max, poly);
|
||||
} else
|
||||
|
@ -32,15 +32,7 @@ public:
|
||||
Line(uint type, const QVector<Coordinates> &path, const QString &label)
|
||||
: _type(type), _path(path), _label(label) {}
|
||||
|
||||
RectC bounds() const
|
||||
{
|
||||
RectC b;
|
||||
|
||||
for (int i = 0; i < _path.size(); i++)
|
||||
b = b.united(_path.at(i));
|
||||
|
||||
return b;
|
||||
}
|
||||
RectC bounds() const;
|
||||
const QVector<Coordinates> &path() const {return _path;}
|
||||
uint type() const {return _type;}
|
||||
const QString &label() const {return _label;}
|
||||
@ -78,7 +70,7 @@ public:
|
||||
~MapData();
|
||||
|
||||
const QString &name() const {return _name;}
|
||||
RectC bounds() const {return _bounds;}
|
||||
RectC bounds() const;
|
||||
|
||||
void polygons(const RectC &rect, QList<Poly*> *polygons);
|
||||
void lines(const RectC &rect, QList<Line*> *lines);
|
||||
@ -87,7 +79,7 @@ public:
|
||||
void load();
|
||||
void clear();
|
||||
|
||||
bool isValid() const {return _bounds.isValid();}
|
||||
bool isValid() const {return _valid;}
|
||||
QString errorString() const {return _errorString;}
|
||||
|
||||
private:
|
||||
@ -129,7 +121,7 @@ private:
|
||||
public:
|
||||
Attr() : _subtype(0) {}
|
||||
Attr(uint subtype, const QString &label = QString())
|
||||
: _subtype(subtype), _label(label) {}
|
||||
: _subtype(subtype), _label(label) {}
|
||||
|
||||
unsigned subtype() const {return _subtype;}
|
||||
const QString &label() const {return _label;}
|
||||
@ -153,42 +145,36 @@ private:
|
||||
typedef RTree<Line*, double, 2> LineTree;
|
||||
typedef RTree<Point*, double, 2> PointTree;
|
||||
|
||||
bool fetchBoundsAndName();
|
||||
bool processRecord(const ISO8211::Record &record);
|
||||
Attr pointAttr(const ISO8211::Record &r, uint OBJL);
|
||||
Attr lineAttr(const ISO8211::Record &r, uint OBJL);
|
||||
Attr polyAttr(const ISO8211::Record &r, uint OBJL);
|
||||
QVector<Sounding> soundingGeometry(const ISO8211::Record &r);
|
||||
Coordinates pointGeometry(const ISO8211::Record &r);
|
||||
QVector<Coordinates> lineGeometry(const ISO8211::Record &r);
|
||||
Polygon polyGeometry(const ISO8211::Record &r);
|
||||
Point *pointObject(const Sounding &s);
|
||||
Point *pointObject(const ISO8211::Record &r, uint OBJL);
|
||||
Line *lineObject(const ISO8211::Record &r, uint OBJL);
|
||||
Poly *polyObject(const ISO8211::Record &r, uint OBJL);
|
||||
Coordinates coordinates(int x, int y) const;
|
||||
Coordinates point(const ISO8211::Record &r);
|
||||
QVector<Sounding> soundings(const ISO8211::Record &r);
|
||||
|
||||
static QVector<Sounding> soundings(const ISO8211::Record &r, uint COMF,
|
||||
uint SOMF);
|
||||
static QVector<Sounding> soundingGeometry(const ISO8211::Record &r,
|
||||
const RecordMap &vi, const RecordMap &vc, uint COMF, uint SOMF);
|
||||
static Coordinates pointGeometry(const ISO8211::Record &r,
|
||||
const RecordMap &vi, const RecordMap &vc, uint COMF);
|
||||
static QVector<Coordinates> lineGeometry(const ISO8211::Record &r,
|
||||
const RecordMap &vc, const RecordMap &ve, uint COMF);
|
||||
static Polygon polyGeometry(const ISO8211::Record &r, const RecordMap &vc,
|
||||
const RecordMap &ve, uint COMF);
|
||||
static Attr pointAttr(const ISO8211::Record &r, uint OBJL);
|
||||
static Attr lineAttr(const ISO8211::Record &r, uint OBJL);
|
||||
static Attr polyAttr(const ISO8211::Record &r, uint OBJL);
|
||||
static Point *pointObject(const Sounding &s);
|
||||
static Point *pointObject(const ISO8211::Record &r, const RecordMap &vi,
|
||||
const RecordMap &vc, uint COMF, uint OBJL);
|
||||
static Line *lineObject(const ISO8211::Record &r, const RecordMap &vc,
|
||||
const RecordMap &ve, uint COMF, uint OBJL);
|
||||
static Poly *polyObject(const ISO8211::Record &r, const RecordMap &vc,
|
||||
const RecordMap &ve, uint COMF,uint OBJL);
|
||||
static bool bounds(const ISO8211::Record &record, Rect &rect);
|
||||
static bool bounds(const QVector<ISO8211::Record> &gv, Rect &b);
|
||||
static bool processRecord(const ISO8211::Record &record,
|
||||
QVector<ISO8211::Record> &fe, RecordMap &vi, RecordMap &vc, RecordMap &ve,
|
||||
RecordMap &vf, uint &COMF, uint &SOMF);
|
||||
static bool processRecord(const ISO8211::Record &record,
|
||||
QVector<ISO8211::Record> &rv, uint &COMF, QString &name);
|
||||
static Rect bounds(const RecordMap &map);
|
||||
|
||||
QString _fileName;
|
||||
QString _name;
|
||||
RectC _bounds;
|
||||
RecordMap _vi, _vc, _ve, _vf;
|
||||
QVector<ISO8211::Record> _fe;
|
||||
uint _COMF, _SOMF;
|
||||
ISO8211 _ddf;
|
||||
|
||||
PolygonTree _areas;
|
||||
LineTree _lines;
|
||||
PointTree _points;
|
||||
|
||||
bool _valid;
|
||||
QString _errorString;
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
||||
#define TSSBND 146
|
||||
#define TSEZNE 150
|
||||
#define UWTROC 153
|
||||
#define UNSARE 154
|
||||
#define WRECKS 159
|
||||
#define M_COVR 302
|
||||
|
||||
|
@ -53,17 +53,16 @@ void Style::defaultPolygonStyle()
|
||||
_polygons[TYPE(TSEZNE)] = Polygon(QBrush("#80fcb4fc"));
|
||||
_polygons[TYPE(DRGARE)] = Polygon(QBrush(QColor("#a0a0ff"),
|
||||
Qt::Dense4Pattern));
|
||||
_polygons[TYPE(UNSARE)] = Polygon(QBrush("#999999"));
|
||||
|
||||
_drawOrder
|
||||
<< TYPE(M_COVR) << TYPE(LNDARE) << SUBTYPE(DEPARE, 0)
|
||||
<< SUBTYPE(DEPARE, 1) << SUBTYPE(DEPARE, 2) << SUBTYPE(DEPARE, 3)
|
||||
<< TYPE(UNSARE) << SUBTYPE(DEPARE, 4) << SUBTYPE(DEPARE, 5)
|
||||
<< SUBTYPE(DEPARE, 6) << TYPE(LAKARE) << TYPE(CANALS) << TYPE(DYKCON)
|
||||
<< TYPE(RIVERS) << TYPE(DRGARE) << TYPE(FAIRWY) << TYPE(BUAARE)
|
||||
<< TYPE(BUISGL) << TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(SLCONS)
|
||||
<< TYPE(PONTON) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN)
|
||||
<< TYPE(ACHARE) << SUBTYPE(RESARE, 9) << TYPE(154);
|
||||
<< SUBTYPE(DEPARE, 4) << SUBTYPE(DEPARE, 5) << SUBTYPE(DEPARE, 6)
|
||||
<< TYPE(LAKARE) << TYPE(CANALS) << TYPE(DYKCON) << TYPE(RIVERS)
|
||||
<< TYPE(DRGARE) << TYPE(FAIRWY) << TYPE(BUAARE) << TYPE(BUISGL)
|
||||
<< TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(SLCONS) << TYPE(PONTON)
|
||||
<< TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(ACHARE)
|
||||
<< SUBTYPE(RESARE, 9);
|
||||
}
|
||||
|
||||
void Style::defaultLineStyle()
|
||||
|
Loading…
x
Reference in New Issue
Block a user