![]() |
WhirlyGlobe
1.2
A 3D interactive globe toolkit for iOS
|
00001 /* 00002 * SelectionLayer.h 00003 * WhirlyGlobeLib 00004 * 00005 * Created by Steve Gifford on 10/26/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 "SceneRendererES1.h" 00029 00030 namespace WhirlyGlobe 00031 { 00032 00038 class RectSelectable 00039 { 00040 public: 00041 00042 // Comparison operator for sorting 00043 bool operator < (const RectSelectable &that) const; 00044 00045 // Used to identify this selectable 00046 SimpleIdentity selectID; 00047 Point3f pts[4]; // Geometry 00048 Vector3f norm; // Calculate normal 00049 float minVis,maxVis; // Range over which this is visible 00050 }; 00051 00052 typedef std::set<WhirlyGlobe::RectSelectable> RectSelectableSet; 00053 00054 } 00055 00065 @interface WGSelectionLayer : NSObject<WhirlyGlobeLayer> 00066 { 00068 WhirlyGlobeView *globeView; 00070 SceneRendererES1 *renderer; 00072 WhirlyGlobeLayerThread *layerThread; 00074 WhirlyGlobe::RectSelectableSet selectables; 00075 } 00076 00078 - (id)initWithGlobeView:(WhirlyGlobeView *)inGlobeView renderer:(SceneRendererES1 *)inRenderer; 00079 00081 - (void)startWithThread:(WhirlyGlobeLayerThread *)layerThread scene:(WhirlyGlobe::GlobeScene *)scene; 00082 00084 - (void)addSelectableRect:(WhirlyGlobe::SimpleIdentity)selectId rect:(Point3f *)pts; 00085 00087 - (void)addSelectableRect:(WhirlyGlobe::SimpleIdentity)selectId rect:(Point3f *)pts minVis:(float)minVis maxVis:(float)maxVis; 00088 00090 - (void)removeSelectable:(WhirlyGlobe::SimpleIdentity)selectId; 00091 00093 - (WhirlyGlobe::SimpleIdentity)pickObject:(Point2f)touchPt maxDist:(float)maxDist; 00094 00095 @end