blob: 78307c28d47a1faa8412f975ede85fe3ef30dc31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
/*
* MaplySimpleTileFetcher.h
* WhirlyGlobe-MaplyComponent
*
* Created by Steve Gifford on 5/31/19.
* Copyright 2011-2022 mousebird consulting
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import <WhirlyGlobe/MaplyTileSourceNew.h>
/** Simple Tile Fetcher is meant for sub classing.
Some data sources aren't all that complex. You read from a local source,
you return the data. Something else turns it into visible objects. Simple.
To implement one of those, subclass the Simple Tile Fetcher and let it do the
tricky bits.
*/
@interface MaplySimpleTileFetcher : NSObject<MaplyTileFetcher>
/// Your Subclass must call this init method
- (nullable instancetype)initWithName:(NSString * __nonnull)name minZoom:(int)minZoom maxZoom:(int)maxZoom;
/// The quad paging loader variants need a TileInfo object, even if it's very simple
- (nullable NSObject<MaplyTileInfoNew> *)tileInfo;
/// Dispatch queue the data fetcher is doing its work on
@property (nonnull) dispatch_queue_t queue;
/// Set by default. We won't every return an error on failing to load. Useful for sparse data sets
@property bool neverFail;
/// Name used for debugging
@property NSString * __nonnull name;
/// Min zoom level
- (int)minZoom;
/// Max zoom level
- (int)maxZoom;
/** Override dataForTile:tileID: to return your own data for a given tile.
The fetchInfo can be a custom object (if you set it up that way) or
you can just use the tileID argument.
You'll be called on the dispatch queue.
You can return either an NSData or a MaplyLoaderReturn
*/
- (id __nullable)dataForTile:(id __nonnull)fetchInfo tileID:(MaplyTileID)tileID;
/** Override the shutdown method.
Call the superclass shutdown method *first* and then run your own shutdown.
*/
- (void)shutdown;
@end
// Internal object used by the QuadImageLoader to generate tile load info
@interface MaplySimpleTileInfo : NSObject<MaplyTileInfoNew>
// Initialize with a min/max zoom
- (instancetype __nonnull)initWithMinZoom:(int)inMinZoom maxZoom:(int)inMaxZoom;
@end
// Encapsulates a single tile load request
@interface MaplySimpleTileFetchInfo : NSObject
@property (nonatomic,assign) int x;
@property (nonatomic,assign) int y;
@property (nonatomic,assign) int level;
@end
|