5 bool AtlasData::pointCb(const QString
*map
, void *context
)
7 PointCTX
*ctx
= (PointCTX
*)context
;
11 MapData
*cached
= ctx
->cache
.object(map
);
14 MapData
*data
= new MapData(*map
);
15 data
->points(ctx
->rect
, ctx
->points
);
16 if (!ctx
->cache
.insert(map
, data
))
19 cached
->points(ctx
->rect
, ctx
->points
);
26 bool AtlasData::polyCb(const QString
*map
, void *context
)
28 PolyCTX
*ctx
= (PolyCTX
*)context
;
32 MapData
*cached
= ctx
->cache
.object(map
);
35 MapData
*data
= new MapData(*map
);
36 data
->polygons(ctx
->rect
, ctx
->polygons
);
37 data
->lines(ctx
->rect
, ctx
->lines
);
38 if (!ctx
->cache
.insert(map
, data
))
41 cached
->polygons(ctx
->rect
, ctx
->polygons
);
42 cached
->lines(ctx
->rect
, ctx
->lines
);
50 AtlasData::~AtlasData()
53 for (_tree
.GetFirst(it
); !_tree
.IsNull(it
); _tree
.GetNext(it
))
54 delete _tree
.GetAt(it
);
57 void AtlasData::addMap(const RectC
&bounds
, const QString
&path
)
59 double min
[2], max
[2];
61 min
[0] = bounds
.left();
62 min
[1] = bounds
.bottom();
63 max
[0] = bounds
.right();
64 max
[1] = bounds
.top();
66 _tree
.Insert(min
, max
, new QString(path
));
69 void AtlasData::polys(const RectC
&rect
, QList
<MapData::Poly
> *polygons
,
70 QList
<MapData::Line
> *lines
)
72 double min
[2], max
[2];
73 PolyCTX
polyCtx(rect
, polygons
, lines
, _cache
, _lock
);
76 min
[1] = rect
.bottom();
77 max
[0] = rect
.right();
80 _tree
.Search(min
, max
, polyCb
, &polyCtx
);
83 void AtlasData::points(const RectC
&rect
, QList
<MapData::Point
> *points
)
85 double min
[2], max
[2];
86 PointCTX
pointCtx(rect
, points
, _cache
, _lock
);
89 min
[1] = rect
.bottom();
90 max
[0] = rect
.right();
93 _tree
.Search(min
, max
, pointCb
, &pointCtx
);