1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Yet another unnecessary file open remove

This commit is contained in:
Martin Tůma 2021-07-21 02:06:35 +02:00
parent 3f3ccb6856
commit a53fedf838
6 changed files with 26 additions and 17 deletions

View File

@ -411,9 +411,9 @@ void NETFile::clear()
}
bool NETFile::link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
const NODFile *nod, Handle &nodHdl, const LBLFile *lbl, Handle &lblHdl,
const NODFile::BlockInfo &blockInfo, quint8 linkId, quint8 lineId,
QList<MapData::Poly> *lines) const
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, const LBLFile *lbl,
Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId,
quint8 lineId, QList<MapData::Poly> *lines) const
{
MapData::Poly poly;
if (!nod->linkType(nodHdl, blockInfo, linkId, poly.type))
@ -447,7 +447,7 @@ bool NETFile::link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
}
if (!subdiv->level()) {
NODFile::AdjacencyInfo adj(nod, blockInfo, linkId, linkInfo);
NODFile::AdjacencyInfo adj(nodHdl2, blockInfo, linkId, linkInfo);
if (singleTopology) {
if (firstIsShape) {

View File

@ -30,9 +30,10 @@ public:
bool lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset) const;
bool link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
const NODFile *nod, Handle &nodHdl, const LBLFile *lbl, Handle &lblHdl,
const NODFile::BlockInfo &blockInfo, quint8 linkId, quint8 lineId,
QList<MapData::Poly> *lines) const;
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, const LBLFile *lbl,
Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId,
quint8 lineId, QList<MapData::Poly> *lines) const;
bool hasLinks() const {return (_linksSize > 0);}
private:
bool linkLabel(Handle &hdl, quint32 offset, quint32 size,

View File

@ -40,13 +40,13 @@ public:
struct AdjacencyInfo
{
AdjacencyInfo(const SubFile *file, const BlockInfo &blockInfo,
quint32 linkId, const LinkInfo &linkInfo) : extHdl(file),
AdjacencyInfo(Handle &hdl, const BlockInfo &blockInfo,
quint32 linkId, const LinkInfo &linkInfo) : extHdl(hdl),
blockInfo(blockInfo), nodeOffset(linkInfo.nodeOffset),
linkOffset(linkInfo.linkOffset), linkId(linkId)
{}
Handle extHdl;
Handle &extHdl;
BlockInfo blockInfo;
NodeInfo nodeInfo;
quint32 nodeOffset;

View File

@ -456,7 +456,8 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
bool RGNFile::links(Handle &hdl, const SubDiv *subdiv, quint32 shift,
const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl,
const LBLFile *lbl, Handle &lblHdl, QList<MapData::Poly> *lines) const
Handle &nodHdl2, const LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *lines) const
{
quint32 size, blockIndexId;
quint8 flags;
@ -522,7 +523,7 @@ bool RGNFile::links(Handle &hdl, const SubDiv *subdiv, quint32 shift,
lineId = 0;
}
net->link(subdiv, shift, netHdl, nod, nodHdl, lbl, lblHdl,
net->link(subdiv, shift, netHdl, nod, nodHdl, nodHdl2, lbl, lblHdl,
blockInfo, linkId, lineId, lines);
}

View File

@ -51,7 +51,8 @@ public:
Handle &lblHdl, QList<MapData::Point> *points) const;
bool links(Handle &hdl, const SubDiv *subdiv, quint32 shift,
const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl,
const LBLFile *lbl, Handle &lblHdl, QList<MapData::Poly> *lines) const;
Handle &nodHdl2, const LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *lines) const;
bool subdivInit(Handle &hdl, SubDiv *subdiv) const;

View File

@ -104,7 +104,8 @@ void VectorTile::polys(const RectC &rect, int bits, bool baseMap,
QList<MapData::Poly> *polygons, QList<MapData::Poly> *lines,
QCache<const SubDiv *, MapData::Polys> *polyCache)
{
SubFile::Handle *rgnHdl = 0, *lblHdl = 0, *netHdl = 0, *nodHdl = 0;
SubFile::Handle *rgnHdl = 0, *lblHdl = 0, *netHdl = 0, *nodHdl = 0,
*nodHdl2 = 0;
if (_loaded < 0)
return;
@ -147,8 +148,13 @@ void VectorTile::polys(const RectC &rect, int bits, bool baseMap,
*lblHdl, &p);
_rgn->extPolyObjects(*rgnHdl, subdiv, shift, RGNFile::Line, _lbl,
*lblHdl, &l);
_rgn->links(*rgnHdl, subdiv, shift, _net, *netHdl, _nod, *nodHdl,
_lbl, *lblHdl, &l);
if (_net && _net->hasLinks()) {
if (!nodHdl2)
nodHdl2 = new SubFile::Handle(_nod);
_rgn->links(*rgnHdl, subdiv, shift, _net, *netHdl, _nod, *nodHdl,
*nodHdl2, _lbl, *lblHdl, &l);
}
copyPolys(rect, &p, polygons);
copyPolys(rect, &l, lines);
@ -159,7 +165,7 @@ void VectorTile::polys(const RectC &rect, int bits, bool baseMap,
}
}
delete rgnHdl; delete lblHdl; delete netHdl; delete nodHdl;
delete rgnHdl; delete lblHdl; delete netHdl; delete nodHdl; delete nodHdl2;
}
void VectorTile::points(const RectC &rect, int bits, bool baseMap,