WhirlyGlobe  1.2
A 3D interactive globe toolkit for iOS
/Users/sjg/iPhone/WhirlyGlobe/WhirlyGlobeSrc/WhirlyGlobeLib/include/LoftLayer.h
00001 /*
00002  *  LoftLayer.h
00003  *  WhirlyGlobeLib
00004  *
00005  *  Created by Steve Gifford on 7/16/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 #import "ShapeReader.h"
00032 #import "DataLayer.h"
00033 
00034 namespace WhirlyGlobe
00035 {
00036     
00040 class LoftedPolySceneRep : public Identifiable
00041 {
00042 public:
00043     LoftedPolySceneRep() { }
00044     ~LoftedPolySceneRep() { }
00045     
00046     // If we're keeping a cache of the meshes, read and write
00047     bool readFromCache(NSString *key);
00048     bool writeToCache(NSString *key);
00049         
00050     SimpleIDSet drawIDs;  // Drawables created for this
00051     ShapeSet shapes;    // The shapes for the outlines
00052     GeoMbr shapeMbr;       // Overall bounding box
00053     float fade;            // Fade out, used for delete
00054     std::vector<VectorRing> triMesh;  // The post-clip triangle mesh, pre-loft
00055 };
00056 typedef std::map<SimpleIdentity,LoftedPolySceneRep *> LoftedPolySceneRepMap;
00057     
00058 }
00059 
00075 @interface WGLoftLayer : NSObject<WhirlyGlobeLayer>
00076 {
00077     WhirlyGlobeLayerThread *layerThread;
00078     WhirlyGlobe::GlobeScene *scene;
00079     
00081     WhirlyGlobe::LoftedPolySceneRepMap polyReps;
00082 
00085     float gridSize;
00086 }
00087 
00088 @property (nonatomic,assign) float gridSize;
00089 @property (nonatomic,assign) BOOL useCache;
00090 
00092 - (void)startWithThread:(WhirlyGlobeLayerThread *)layerThread scene:(WhirlyGlobe::GlobeScene *)scene;
00093 
00100 - (WhirlyGlobe::SimpleIdentity) addLoftedPolys:(WhirlyGlobe::ShapeSet *)shape desc:(NSDictionary *)desc cacheName:(NSString *)cacheName;
00101 
00107 - (WhirlyGlobe::SimpleIdentity) addLoftedPoly:(WhirlyGlobe::VectorShapeRef)shape desc:(NSDictionary *)desc cacheName:(NSString *)cacheName;
00108 
00110 - (void) removeLoftedPoly:(WhirlyGlobe::SimpleIdentity)polyID;
00111 
00113 - (void) changeLoftedPoly:(WhirlyGlobe::SimpleIdentity)polyID desc:(NSDictionary *)desc;
00114 
00115 @end