@interface MaplyActiveObject : NSObject
Active Objects are used implement animation. Active Objects work in conjuction with the renderer to make updates on the main thread. The way they work is this. They're called right at the beginning of a frame draw. They can make updates to regular Maply objects via the MaplyBaseViewController add and remove calls with the MaplyThreadMode set to MaplyThreadCurrent. This forces the changes to happen immediately on the current (main) thread. Active Objects have access to the internals of the toolkit, for historical reasons. That makes it difficult to document them here. Look at the AnimationTest example in the test app. You will need to fill in the following methods at least.
|init||The init method is up to you. There’s no specific signature you’ll need, but do pass in all the information you’ll want to run quickly in updateForFrame.|
|(bool)hasUpdate||Returns true if there’s an update to be processed.|
|(void)updateForFrame:(id)frameInfo||This is where you do your work. Remove the objects that need to be removed, add the objects that need to be added and be sure to use the MaplyThreadCurrent mode to make the changes happen immediately.|
|teardown||This method is called when the active object is to be removed. Clean up all your visible objects.|
Active Objects are run on the main thread and you're probably going to be asking the view controller to add and remove objects on the main thread. As such, this can be slow. Be sure to precalculate whatever you might need to make this run faster. Also consider implementing your changes another way. If it can be done on another thread, do it on another thread.
Initialize with a view controller
The default initializer just takes a view controller. If you replace this with your own, be sure to pass in what you need.