forked from mousebird-consulting-inc/WhirlyGlobe
/
WhirlyGlobeViewController.h
113 lines (88 loc) · 4.36 KB
/
WhirlyGlobeViewController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* GlobeViewController.h
* WhirlyGlobeComponent
*
* Created by Steve Gifford on 7/21/12.
* Copyright 2011-2012 mousebird consulting
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import <UIKit/UIKit.h>
#import "MaplyBaseViewController.h"
@class WGViewControllerLayer;
@class WhirlyGlobeViewController;
/** Fill in this protocol to get called when the user taps on or near an object for
selection.
*/
@protocol WhirlyGlobeViewControllerDelegate <NSObject>
@optional
/// Called when the user taps on or near an object.
/// You're given the object you passed in originally, such as a WGScreenMarker.
- (void)globeViewController:(WhirlyGlobeViewController *)viewC didSelect:(NSObject *)selectedObj;
/// Called when the user taps outside the globe.
/// Passes in the location on the view.
- (void)globeViewControllerDidTapOutside:(WhirlyGlobeViewController *)viewC;
/// The user tapped at the given location.
/// This won't be called if they tapped and selected, just if they tapped.
- (void)globeViewController:(WhirlyGlobeViewController *)viewC didTapAt:(WGCoordinate)coord;
/// This is called when a given layer loads.
/// Not all layers support this callback. Those that load immediately (which is most of them)
/// won't trigger this.
- (void)globeViewController:(WhirlyGlobeViewController *)viewC layerDidLoad:(WGViewControllerLayer *)layer;
@end
/** This is the main object in the WhirlyGlobe Component. You fire up one
of these, add its view to your view hierarchy and start tossing in data.
At the very least you'll want a base image layer and then you can put
markers, labels, and vectors on top of that.
*/
@interface WhirlyGlobeViewController : MaplyBaseViewController
{
NSObject<WhirlyGlobeViewControllerDelegate> * __weak delegate;
}
/// Set this to keep the north pole facing upward when moving around.
/// Off by default.
@property(nonatomic,assign) bool keepNorthUp;
/// Set this to trun on/off the pinch (zoom) gesture recognizer
/// On by default
@property(nonatomic,assign) bool pinchGesture;
/// Set this to turn on or off the rotation gesture recognizer.
/// On by default.
@property(nonatomic,assign) bool rotateGesture;
/// Set this to get callbacks for various events.
@property(nonatomic,weak) NSObject<WhirlyGlobeViewControllerDelegate> *delegate;
/// Get/set the current height above terrain.
/// The radius of the earth is 1.0. Height above terrain is relative to that.
@property (nonatomic,assign) float height;
/// Return the min and max heights above the globe for zooming
- (void)getZoomLimitsMin:(float *)minHeight max:(float *)maxHeight;
/// Set the min and max heights above the globe for zooming
- (void)setZoomLimitsMin:(float)minHeight max:(float)maxHeight;
/// Set this to something other than zero and it will autorotate
/// after that interval the given number of degrees per second
- (void)setAutoRotateInterval:(float)autoRotateInterval degrees:(float)autoRotateDegrees;
/// Animate to the given position over the given amount of time
- (void)animateToPosition:(MaplyCoordinate)newPos time:(NSTimeInterval)howLong;
/// Animate the given position to the given screen location over time.
/// If this isn't physically possible, it will just do nothing
- (void)animateToPosition:(WGCoordinate)newPos onScreen:(CGPoint)loc time:(NSTimeInterval)howLong;
/// Set the view to the given position immediately
- (void)setPosition:(WGCoordinate)newPos;
/// Set position and height at the same time
- (void)setPosition:(WGCoordinate)newPos height:(float)height;
/// Get the current position and height
- (void)getPosition:(WGCoordinate *)pos height:(float *)height;
/// Add a spherical earth layer with the given set of base images
- (WGViewControllerLayer *)addSphericalEarthLayerWithImageSet:(NSString *)name;
/// This utility routine returns the on screen location for a coordinate in lat/lon
- (CGPoint)screenPointFromGeo:(MaplyCoordinate)geoCoord;
@end