![]() |
WhirlyGlobe
1.2
A 3D interactive globe toolkit for iOS
|
00001 /* 00002 * VectorLoader.h 00003 * WhirlyGlobeLib 00004 * 00005 * Created by Stephen Gifford on 3/7/11. 00006 * Copyright 2011 mousebird consulting. All rights reserved. 00007 * 00008 */ 00009 00010 #import "DataLayer.h" 00011 #import "Drawable.h" 00012 #import "VectorLayer.h" 00013 #import "LabelLayer.h" 00014 00015 /* Vector Info 00016 This is passed to the target/selector right before we create a drawable. 00017 */ 00018 @interface VectorLoaderInfo : NSObject 00019 { 00020 @public 00021 // The feature we're going to represent 00022 WhirlyGlobe::VectorShapeRef shape; 00023 00024 // Where we'll draw the label, if there is one 00025 WhirlyGlobe::GeoCoord loc; 00026 00027 // Attributes for visual and label representation 00028 // Setting this to nil will kill the feature entirely 00029 // Setting shape or label to nil will kill that component 00030 NSMutableDictionary *desc; 00031 } 00032 00033 @property (nonatomic,retain) NSMutableDictionary *desc; 00034 00035 @end 00036 00037 /* Vector Loader description dictionary 00038 shape <NSDictionary> [See VectorLayer for details] 00039 label <NSDictionary> [See LabelLayer for details] 00040 */ 00041 00042 /* Vector Loader 00043 Loads the vector data as it comes from one or more readers. 00044 This will insert itself into the layer thread run loop and add 00045 a feature every time it gets called until it runs out. 00046 Each reader you hand it may have an associated target/selector. 00047 This gets called for every vector feature you add. 00048 You can pass in defaults which control how the feature is represented. 00049 */ 00050 @interface VectorLoader : NSObject<WhirlyGlobeLayer> 00051 { 00052 WhirlyGlobeLayerThread *layerThread; 00053 VectorLayer *vecLayer; // We'll add our vector data here 00054 LabelLayer *labelLayer; // Labels go here 00055 00056 unsigned int curReader; // Which reader we're looking at 00057 NSMutableArray *readers; // Readers (and callbacks) we'll use 00058 } 00059 00060 // Need a vector, and possibly label, layer(s) to feed data into 00061 - (id)initWithVectorLayer:(VectorLayer *)layer labelLayer:(LabelLayer *)labelLayer; 00062 00063 // Add this reader to the list to be read from 00064 // VectorLoader is now responsible for deletion 00065 - (void)addReader:(WhirlyGlobe::VectorReader *)reader target:(NSObject *)target selector:(SEL)selector desc:(NSDictionary *)defaultDict; 00066 00067 // Convenience routine that creates a shapefile reader and adds that to the list 00068 // The target/selector are called with VectorInfo. See that for details 00069 - (BOOL)addShapeFile:(NSString *)fileName target:(NSObject *)target selector:(SEL)selector desc:(NSDictionary *)defaultDict; 00070 00071 @end