![]() |
WhirlyGlobe
1.2
A 3D interactive globe toolkit for iOS
|
00001 /* 00002 * ShapeDisplay.h 00003 * WhirlyGlobeLib 00004 * 00005 * Created by Steve Gifford on 1/26/11. 00006 * Copyright 2011 mousebird consulting 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 <vector> 00023 #import <set> 00024 #import <map> 00025 #import <Foundation/Foundation.h> 00026 #import "Drawable.h" 00027 #import "DataLayer.h" 00028 #import "VectorData.h" 00029 #import "GlobeMath.h" 00030 #import "LayerThread.h" 00031 #import "DrawCost.h" 00032 00033 namespace WhirlyGlobe 00034 { 00035 00036 /* This is the representation of a group of vectors 00037 in the scene. You do not want to create individual 00038 vector features on the globe one by one, that's too expensive. 00039 It needs to be batched and that's how we do this. 00040 The VectorSceneRep keeps track of what shapes are being 00041 represented by what drawables in the scene. We use this 00042 for modifications or deletions later on. 00043 */ 00044 class VectorSceneRep : public Identifiable 00045 { 00046 public: 00047 VectorSceneRep() { } 00048 VectorSceneRep(ShapeSet &inShapes) : shapes(inShapes) { }; 00049 00050 ShapeSet shapes; // Shapes associated with this 00051 SimpleIDSet drawIDs; // The drawables we created 00052 float fade; // If set, the amount of time to fade out before deletion 00053 }; 00054 typedef std::map<SimpleIdentity,VectorSceneRep *> VectorSceneRepMap; 00055 00056 } 00057 00082 @interface VectorLayer : NSObject<WhirlyGlobeLayer> 00083 { 00084 @private 00085 WhirlyGlobe::GlobeScene *scene; 00086 WhirlyGlobeLayerThread *layerThread; 00087 00088 // Visual representations of vectors 00089 WhirlyGlobe::VectorSceneRepMap vectorReps; 00090 } 00091 00093 - (void)startWithThread:(WhirlyGlobeLayerThread *)layerThread scene:(WhirlyGlobe::GlobeScene *)scene; 00094 00099 - (WhirlyGlobe::SimpleIdentity)addVector:(WhirlyGlobe::VectorShapeRef)shape desc:(NSDictionary *)dict; 00100 00105 - (WhirlyGlobe::SimpleIdentity)addVectors:(WhirlyGlobe::ShapeSet *)shapes desc:(NSDictionary *)dict; 00106 00108 - (WhirlyGlobe::SimpleIdentity)addVectors:(WhirlyGlobe::ShapeSet *)shapes desc:(NSDictionary *)dict cacheName:(NSString *)cacheName; 00109 00112 - (WhirlyGlobe::SimpleIdentity)addVectorsFromCache:(NSString *)cacheName; 00113 00117 - (void)changeVector:(WhirlyGlobe::SimpleIdentity)vecID desc:(NSDictionary *)dict; 00118 00120 - (void)removeVector:(WhirlyGlobe::SimpleIdentity)vecID; 00121 00124 - (DrawCost *)getCost:(WhirlyGlobe::SimpleIdentity)vecID; 00125 00126 @end