WhirlyGlobe
1.1
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 }; 00053 typedef std::map<SimpleIdentity,VectorSceneRep *> VectorSceneRepMap; 00054 00055 } 00056 00079 @interface VectorLayer : NSObject<WhirlyGlobeLayer> 00080 { 00081 @private 00082 WhirlyGlobe::GlobeScene *scene; 00083 WhirlyGlobeLayerThread *layerThread; 00084 00085 // Visual representations of vectors 00086 WhirlyGlobe::VectorSceneRepMap vectorReps; 00087 } 00088 00090 - (void)startWithThread:(WhirlyGlobeLayerThread *)layerThread scene:(WhirlyGlobe::GlobeScene *)scene; 00091 00096 - (WhirlyGlobe::SimpleIdentity)addVector:(WhirlyGlobe::VectorShapeRef)shape desc:(NSDictionary *)dict; 00097 00102 - (WhirlyGlobe::SimpleIdentity)addVectors:(WhirlyGlobe::ShapeSet *)shapes desc:(NSDictionary *)dict; 00103 00107 - (void)changeVector:(WhirlyGlobe::SimpleIdentity)vecID desc:(NSDictionary *)dict; 00108 00110 - (void)removeVector:(WhirlyGlobe::SimpleIdentity)vecID; 00111 00114 - (DrawCost *)getCost:(WhirlyGlobe::SimpleIdentity)vecID; 00115 00116 @end