aboutsummaryrefslogtreecommitdiff
path: root/iosApp/WhirlyGlobeMaplyComponent.xcframework/ios-arm64/WhirlyGlobeMaplyComponent.framework/Headers/MaplyQuadImageFrameLoader.h
blob: b1da6684241304d5cad9ecab3ef9106369c8b3cb (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/*
 *  MaplyQuadImageFrameLoader.h
 *
 *  Created by Steve Gifford on 9/13/18.
 *  Copyright 2012-2022 mousebird consulting inc
 *
 *  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 <WhirlyGlobeMaplyComponent/MaplyQuadImageLoader.h>
#import <WhirlyGlobeMaplyComponent/MaplyActiveObject.h>

@class MaplyQuadImageFrameLoader;

/**
    Quad Image FrameAnimation runs through the frames in a Quad Image Frame loader over time.
 
    Set this up with a MaplyQuadImageFrameLoader and it'll run through the available frames from start to finish.
    At the end it will snap back to the beginning.
  */
@interface MaplyQuadImageFrameAnimator : MaplyActiveObject

/// Initialize with the image frame loader and view controller
- (nonnull instancetype)initWithFrameLoader:(MaplyQuadImageFrameLoader * __nonnull)loader viewC:(MaplyBaseViewController * __nonnull)viewC;

/// How long to animate from start to finish.
@property (nonatomic,assign) NSTimeInterval period;

/// How long to pause at the end of the sequence before starting back
@property (nonatomic,assign) NSTimeInterval pauseLength;

/// Remove the animator and stop animating
- (void)shutdown;

@end

/**
    The Maply Quad Image Frame Loader can generation per-frame stats.  These are them.
  */
@interface MaplyQuadImageFrameStats : NSObject

/// Number of tiles this frame is in (loading and loaded)
@property (nonatomic) int totalTiles;

/// Number of tiles this frame has yet to load
@property (nonatomic) int tilesToLoad;

@end

/**
    Stats generated by the Maply Quad Image Frame Loader.
  */
@interface MaplyQuadImageFrameLoaderStats : NSObject

/// Total number of tiles managed by the loader
@property (nonatomic) int numTiles;

/// Per frame stats for current loading state
@property (nonatomic,nonnull) NSArray<MaplyQuadImageFrameStats *> *frames;

@end

/// How we load frames in the QuadImageFrameLoader
/// Broad means we load 0 first and the on down
/// Narrow means we load the frames around the current display first
typedef NS_ENUM(NSInteger, MaplyLoadFrameMode) {
    MaplyLoadFrameBroad,
    MaplyLoadFrameNarrow,
};

/**
 The Maply Quad Image Frame Loader is for paging individual frames of image pyramids.

 This works much like the Quad Image Loader, but handles more than one frame.  You can animate
 between the frames with the QuadImageFrameAnimator
 */
@interface MaplyQuadImageFrameLoader : MaplyQuadImageLoaderBase

/**
 Initialize with multiple tile sources (one per frame).
 
 @param params The sampling parameters describing how to break down the data for projection onto a globe or map.
 @param tileInfos A list of tile info objects to fetch for each frame.
 @param viewC the View controller (or renderer) to add objects to.
 */
- (nullable instancetype)initWithParams:(MaplySamplingParams *__nonnull)params tileInfos:(NSArray<NSObject<MaplyTileInfoNew> *> *__nonnull)tileInfos viewC:(MaplyBaseViewController * __nonnull)viewC;

/// How frames are loaded (top down vs broad)
@property (nonatomic,assign) MaplyLoadFrameMode loadFrameMode;

/**
  Add another rendering focus to the frame loader.
 
  Normally you'd have one point of focus for a frame loader resulting in one image
  to be displayed.  But if you're using render targets, you may want to have two
  and combine them in some way yourself.  Or more.  No idea why you'd do that.
 
  If you're going to do this, call addFocus right after you create the FrameLoader.
  */
- (void)addFocus;

/**
  Return the number of focii.  Normally it's 1.
 
  See addFocus for what these are.  You probably don't need to be using them.
  */
- (int)getNumFocus;

/**
  Set the interpolated location within the array of frames.
 
  Each set of frames can be accessed from [0.0,numFrames].  Images will be interpolated between
  those values and may be snapped if data has not yet loaded.
 
  This value is used once per frame, so feel free to call this as much as you'd like.
  */
- (void)setCurrentImage:(double)where;

/**
  Set the currentImage for the given focus.  See addFocus for what those are.
  */
- (void)setFocus:(int)focusID currentImage:(double)where;

/**
  Return the interpolated location within the array of frames.
  */
- (double)getCurrentImage;

/**
  Return the interpolated location within the array of frames for a given focus.  See addFocus for what that means.
  */
- (double)getCurrentImageForFocus:(int)focusID;

/**
 Set whether we require the top tiles to be loaded before a frame can be displayed.
 
 Normally the system wants all the top level tiles to be loaded (just one at level 0)
 to be in memory before it will display a frame at all.  You can turn this off.
 */
- (void)setRequireTopTiles:(bool)newVal;

/** Number of tile sources passed in as individual frames.
  */
- (int)getNumFrames;

/**
 An optional render target for this loader.
 
 The loader can draw to a render target rather than to the screen.
 You use this in a multi-pass rendering setup.
 
 This version takes a specific focus.  See addFocus for what that means.
 */
- (void)setFocus:(int)focusID renderTarget:(MaplyRenderTarget *__nonnull)renderTarget;

/**
 Shader to use for rendering the image frames for a particular focus.
 
 Consult addFocus for what this means.
 */
- (void)setFocus:(int)focusID shader:(MaplyShader * __nullable)shader;

/**
  Get the frame stats for what's loaded and what's not.
  */
- (MaplyQuadImageFrameLoaderStats * __nonnull)getFrameStats;

/**
   Change the tile sources and reload all the data.
   <br>
   You can change the tile source data is being loaded from.  This will
   force a reload and everything visual should change as the data comes in.
  */
- (void)changeTileInfos:(NSArray<MaplyTileInfoNew> * __nullable)tileInfo;

/** Turn off the image loader and shut things down.
 This unregisters us with the sampling layer and shuts down the various objects we created.
 */
- (void)shutdown;

@end