RMMercatorToScreenProjection.h
1.93 KB
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
//
// ScreenProjection.h
// Images
//
// Created by Joseph Gentle on 28/08/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RMMercator.h"
#import "RMLatLong.h"
// This is a stateful projection. As the screen moves around, so too do projections change.
@interface RMMercatorToScreenProjection : NSObject
{
// What the screen is currently looking at.
RMMercatorPoint origin;
// Bounds of the screen in pixels
CGRect screenBounds;
// Scale is how many meters in 1 pixel. Larger scale means bigger things are smaller on the screen.
// Scale of 1 means 1 pixel == 1 meter.
// Scale of 10 means 1 pixel == 10 meters.
float scale;
}
-(id) initWithScreenBounds: (CGRect)screenBounds;
// Deltas in screen coordinates.
- (RMMercatorPoint)movePoint: (RMMercatorPoint)point By:(CGSize) delta;
- (RMMercatorRect)moveRect: (RMMercatorRect)rect By:(CGSize) delta;
// pivot given in screen coordinates.
- (RMMercatorPoint)zoomPoint: (RMMercatorPoint)point ByFactor: (float)factor Near:(CGPoint) pivot;
- (RMMercatorRect)zoomRect: (RMMercatorRect)rect ByFactor: (float)factor Near:(CGPoint) pivot;
// Move the screen.
- (void) moveScreenBy: (CGSize) delta;
- (void) zoomScreenByFactor: (float) factor Near:(CGPoint) point;
// Project -> screen coordinates.
-(CGPoint) projectMercatorPoint: (RMMercatorPoint) point;
-(CGRect) projectMercatorRect: (RMMercatorRect) rect;
-(RMMercatorPoint) projectScreenPointToMercator: (CGPoint) point;
-(RMMercatorRect) projectScreenRectToMercator: (CGRect) rect;
- (RMMercatorSize)projectScreenSizeToMercator: (CGSize) size;
-(RMMercatorRect) mercatorBounds;
-(void) setMercatorBounds: (RMMercatorRect) bounds;
-(RMMercatorPoint) mercatorCenter;
-(void) setMercatorCenter: (RMMercatorPoint) center;
-(CGRect) screenBounds;
@property (assign, readwrite) float scale;
//@property (readonly) RMMercatorPoint topLeft;
//@property (assign, readwrite) CGSize viewSize;
@end