![]() |
WhirlyGlobe
1.2
A 3D interactive globe toolkit for iOS
|
00001 /* 00002 * MarkerLayer.h 00003 * WhirlyGlobeLib 00004 * 00005 * Created by Steve Gifford on 10/21/11. 00006 * Copyright 2011 mousebird consulting. All rights reserved. 00007 * 00008 * Licensed under the Apache License, Version 2.0 (the "License"); 00009 * you may not use this file except in compliance with the License. 00010 * You may obtain a copy of the License at 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 * 00019 */ 00020 00021 #import <math.h> 00022 #import <set> 00023 #import <map> 00024 #import "Identifiable.h" 00025 #import "Drawable.h" 00026 #import "DataLayer.h" 00027 #import "LayerThread.h" 00028 #import "TextureAtlas.h" 00029 #import "DrawCost.h" 00030 #import "SelectionLayer.h" 00031 00033 static const int MarkerDrawPriority=1005; 00034 00036 static const int MaxMarkerDrawableTris=1<<15/3; 00037 00038 namespace WhirlyGlobe 00039 { 00040 00043 class MarkerSceneRep : public Identifiable 00044 { 00045 public: 00046 MarkerSceneRep(); 00047 ~MarkerSceneRep() { }; 00048 00049 SimpleIDSet drawIDs; // Drawables created for this 00050 SimpleIdentity selectID; // ID used for selection 00051 SimpleIDSet markerIDs; // IDs for markers sent to the generator 00052 float fade; // Time to fade away for deletion 00053 }; 00054 typedef std::set<MarkerSceneRep *,IdentifiableSorter> MarkerSceneRepSet; 00055 00056 } 00057 00062 @interface WGMarker : NSObject 00063 { 00066 bool isSelectable; 00069 WhirlyGlobe::SimpleIdentity selectID; 00071 WhirlyGlobe::GeoCoord loc; 00075 std::vector<WhirlyGlobe::SimpleIdentity> texIDs; 00077 float width; 00079 float height; 00081 NSTimeInterval period; 00084 NSTimeInterval timeOffset; 00085 } 00086 00087 @property (nonatomic,assign) bool isSelectable; 00088 @property (nonatomic,assign) WhirlyGlobe::SimpleIdentity selectID; 00089 @property (nonatomic,assign) WhirlyGlobe::GeoCoord loc; 00090 @property (nonatomic,readonly) std::vector<WhirlyGlobe::SimpleIdentity> texIDs; 00091 @property (nonatomic,assign) float width,height; 00092 @property (nonatomic,assign) NSTimeInterval period; 00093 @property (nonatomic,assign) NSTimeInterval timeOffset; 00094 00096 - (void)addTexID:(WhirlyGlobe::SimpleIdentity)texID; 00097 00098 @end 00099 00115 @interface WGMarkerLayer : NSObject<WhirlyGlobeLayer> 00116 { 00118 WhirlyGlobeLayerThread *layerThread; 00120 WhirlyGlobe::SimpleIdentity generatorId; 00122 WhirlyGlobe::GlobeScene *scene; 00124 WGSelectionLayer *selectLayer; 00126 WhirlyGlobe::MarkerSceneRepSet markerReps; 00127 } 00128 00133 @property (nonatomic,assign) WGSelectionLayer *selectLayer; 00134 00136 - (void)startWithThread:(WhirlyGlobeLayerThread *)layerThread scene:(WhirlyGlobe::GlobeScene *)scene; 00137 00139 - (WhirlyGlobe::SimpleIdentity) addMarker:(WGMarker *)marker desc:(NSDictionary *)desc; 00140 00143 // the SingleMarkers, if set. 00144 - (WhirlyGlobe::SimpleIdentity) addMarkers:(NSArray *)markers desc:(NSDictionary *)desc; 00145 00147 - (void) removeMarkers:(WhirlyGlobe::SimpleIdentity)markerID; 00148 00149 @end