Authored by Thomas Rasch

o Refactoring: Renamed some methods

... ... @@ -131,7 +131,7 @@
image = [RMTileImage imageForTile:tile withURL:[self tileURL:tile]];
}
else {
image = [RMTileImage dummyTile:tile];
image = [RMTileImage tileImageFromTile:tile];
}
return image;
... ...
... ... @@ -61,7 +61,7 @@
mapContents = aContents;
radiusInMeters = newRadiusInMeters;
latLong = newLatLong;
projectedLocation = [[mapContents projection] coordinateToPoint:newLatLong];
projectedLocation = [[mapContents projection] coordinateToProjectedPoint:newLatLong];
[self setPosition:[[mapContents mercatorToScreenProjection] projectProjectedPoint:projectedLocation]];
lineWidthInPixels = kDefaultLineWidth;
... ... @@ -178,7 +178,7 @@
- (void)moveToLatLong:(CLLocationCoordinate2D)newLatLong
{
latLong = newLatLong;
[self setProjectedLocation:[[mapContents projection] coordinateToPoint:newLatLong]];
[self setProjectedLocation:[[mapContents projection] coordinateToProjectedPoint:newLatLong]];
[self setPosition:[[mapContents mercatorToScreenProjection] projectProjectedPoint:projectedLocation]];
// DLog(@"Position: %f, %f", [self position].x, [self position].y);
}
... ...
... ... @@ -335,9 +335,9 @@
.latitude = (ne.latitude + sw.latitude) / 2,
.longitude = (ne.longitude + sw.longitude) / 2
};
RMProjectedPoint myOrigin = [projection coordinateToPoint:midpoint];
RMProjectedPoint nePoint = [projection coordinateToPoint:ne];
RMProjectedPoint swPoint = [projection coordinateToPoint:sw];
RMProjectedPoint myOrigin = [projection coordinateToProjectedPoint:midpoint];
RMProjectedPoint nePoint = [projection coordinateToProjectedPoint:ne];
RMProjectedPoint swPoint = [projection coordinateToProjectedPoint:sw];
RMProjectedPoint myPoint = {.easting = nePoint.easting - swPoint.easting, .northing = nePoint.northing - swPoint.northing};
//Create the new zoom layout
RMProjectedRect zoomRect;
... ... @@ -363,7 +363,7 @@
myOrigin.easting = myOrigin.easting - (zoomRect.size.width / 2);
myOrigin.northing = myOrigin.northing - (zoomRect.size.height / 2);
RMLog(@"Origin is calculated at: %f, %f", [projection pointToCoordinate:myOrigin].latitude, [projection pointToCoordinate:myOrigin].longitude);
RMLog(@"Origin is calculated at: %f, %f", [projection projectedPointToCoordinate:myOrigin].latitude, [projection projectedPointToCoordinate:myOrigin].longitude);
/*It gets all messed up if our origin is lower than the lowest place on the map, so we check.
if(myOrigin.northing < -19971868.880409)
{
... ... @@ -397,7 +397,7 @@
- (void)moveToLatLong: (CLLocationCoordinate2D)latlong
{
RMProjectedPoint aPoint = [[self projection] coordinateToPoint:latlong];
RMProjectedPoint aPoint = [[self projection] coordinateToProjectedPoint:latlong];
[self moveToProjectedPoint: aPoint];
}
... ... @@ -863,7 +863,7 @@ static NSMutableDictionary *cachedTilesources = nil;
- (CLLocationCoordinate2D) mapCenter
{
RMProjectedPoint aPoint = [mercatorToScreenProjection projectedCenter];
return [projection pointToCoordinate:aPoint];
return [projection projectedPointToCoordinate:aPoint];
}
-(void) setMapCenter: (CLLocationCoordinate2D) center
... ... @@ -977,27 +977,27 @@ static NSMutableDictionary *cachedTilesources = nil;
- (CGPoint)latLongToPixel:(CLLocationCoordinate2D)latlong
{
return [mercatorToScreenProjection projectProjectedPoint:[projection coordinateToPoint:latlong]];
return [mercatorToScreenProjection projectProjectedPoint:[projection coordinateToProjectedPoint:latlong]];
}
- (CGPoint)latLongToPixel:(CLLocationCoordinate2D)latlong withMetersPerPixel:(float)aScale
{
return [mercatorToScreenProjection projectProjectedPoint:[projection coordinateToPoint:latlong] withMetersPerPixel:aScale];
return [mercatorToScreenProjection projectProjectedPoint:[projection coordinateToProjectedPoint:latlong] withMetersPerPixel:aScale];
}
- (RMTilePoint)latLongToTilePoint:(CLLocationCoordinate2D)latlong withMetersPerPixel:(float)aScale
{
return [mercatorToTileProjection project:[projection coordinateToPoint:latlong] atZoom:aScale];
return [mercatorToTileProjection project:[projection coordinateToProjectedPoint:latlong] atZoom:aScale];
}
- (CLLocationCoordinate2D)pixelToLatLong:(CGPoint)aPixel
{
return [projection pointToCoordinate:[mercatorToScreenProjection projectScreenPointToProjectedPoint:aPixel]];
return [projection projectedPointToCoordinate:[mercatorToScreenProjection projectScreenPointToProjectedPoint:aPixel]];
}
- (CLLocationCoordinate2D)pixelToLatLong:(CGPoint)aPixel withMetersPerPixel:(float)aScale
{
return [projection pointToCoordinate:[mercatorToScreenProjection projectScreenPointToProjectedPoint:aPixel withMetersPerPixel:aScale]];
return [projection projectedPointToCoordinate:[mercatorToScreenProjection projectScreenPointToProjectedPoint:aPixel withMetersPerPixel:aScale]];
}
- (double)scaleDenominator {
... ... @@ -1013,7 +1013,7 @@ static NSMutableDictionary *cachedTilesources = nil;
if(ne.latitude == sw.latitude && ne.longitude == sw.longitude)//There are no bounds, probably only one marker.
{
RMProjectedRect zoomRect;
RMProjectedPoint myOrigin = [projection coordinateToPoint:sw];
RMProjectedPoint myOrigin = [projection coordinateToProjectedPoint:sw];
//Default is with scale = 2.0 mercators/pixel
zoomRect.size.width = [self screenBounds].size.width * 2.0;
zoomRect.size.height = [self screenBounds].size.height * 2.0;
... ... @@ -1030,9 +1030,9 @@ static NSMutableDictionary *cachedTilesources = nil;
.latitude = (ne.latitude + sw.latitude) / 2,
.longitude = (ne.longitude + sw.longitude) / 2
};
RMProjectedPoint myOrigin = [projection coordinateToPoint:midpoint];
RMProjectedPoint nePoint = [projection coordinateToPoint:ne];
RMProjectedPoint swPoint = [projection coordinateToPoint:sw];
RMProjectedPoint myOrigin = [projection coordinateToProjectedPoint:midpoint];
RMProjectedPoint nePoint = [projection coordinateToProjectedPoint:ne];
RMProjectedPoint swPoint = [projection coordinateToProjectedPoint:sw];
RMProjectedPoint myPoint = {.easting = nePoint.easting - swPoint.easting, .northing = nePoint.northing - swPoint.northing};
//Create the new zoom layout
RMProjectedRect zoomRect;
... ... @@ -1057,7 +1057,7 @@ static NSMutableDictionary *cachedTilesources = nil;
}
myOrigin.easting = myOrigin.easting - (zoomRect.size.width / 2);
myOrigin.northing = myOrigin.northing - (zoomRect.size.height / 2);
RMLog(@"Origin is calculated at: %f, %f", [projection pointToCoordinate:myOrigin].latitude, [projection pointToCoordinate:myOrigin].longitude);
RMLog(@"Origin is calculated at: %f, %f", [projection projectedPointToCoordinate:myOrigin].latitude, [projection projectedPointToCoordinate:myOrigin].longitude);
/*It gets all messed up if our origin is lower than the lowest place on the map, so we check.
if(myOrigin.northing < -19971868.880409)
{
... ...
... ... @@ -220,8 +220,8 @@
//store projections
RMProjection *proj=self.contents.projection;
NEconstraint = [proj coordinateToPoint:ne];
SWconstraint = [proj coordinateToPoint:sw];
NEconstraint = [proj coordinateToProjectedPoint:ne];
SWconstraint = [proj coordinateToProjectedPoint:sw];
_constrainMovement=YES;
}
... ...
... ... @@ -60,8 +60,8 @@
- (void)addMarker:(RMMarker *)marker atLatLong:(CLLocationCoordinate2D)point
{
[marker setAffineTransform:rotationTransform];
[marker setProjectedLocation:[[contents projection]coordinateToPoint:point]];
[marker setPosition:[[contents mercatorToScreenProjection] projectProjectedPoint:[[contents projection] coordinateToPoint:point]]];
[marker setProjectedLocation:[[contents projection]coordinateToProjectedPoint:point]];
[marker setPosition:[[contents mercatorToScreenProjection] projectProjectedPoint:[[contents projection] coordinateToProjectedPoint:point]]];
[[contents overlay] addSublayer:marker];
}
... ... @@ -164,8 +164,8 @@
- (void)moveMarker:(RMMarker *)marker atLatLon:(CLLocationCoordinate2D)point
{
[marker setProjectedLocation:[[contents projection]coordinateToPoint:point]];
[marker setPosition:[[contents mercatorToScreenProjection] projectProjectedPoint:[[contents projection] coordinateToPoint:point]]];
[marker setProjectedLocation:[[contents projection]coordinateToProjectedPoint:point]];
[marker setPosition:[[contents mercatorToScreenProjection] projectProjectedPoint:[[contents projection] coordinateToProjectedPoint:point]]];
}
- (void)moveMarker:(RMMarker *)marker atXY:(CGPoint)point
... ...
... ... @@ -194,7 +194,7 @@
- (void)moveToLatLong:(CLLocationCoordinate2D)point
{
RMProjectedPoint mercator = [[contents projection] coordinateToPoint:point];
RMProjectedPoint mercator = [[contents projection] coordinateToProjectedPoint:point];
[self moveToXY:mercator];
}
... ... @@ -211,7 +211,7 @@
- (void)addLineToLatLong:(CLLocationCoordinate2D)point
{
RMProjectedPoint mercator = [[contents projection] coordinateToPoint:point];
RMProjectedPoint mercator = [[contents projection] coordinateToProjectedPoint:point];
[self addLineToXY:mercator];
}
... ...
... ... @@ -57,12 +57,12 @@
+ (RMProjection *)EPSGLatLong;
/// anybody know what the InBounds: parameter means?
- (id)initWithString:(NSString *)params inBounds:(RMProjectedRect)projBounds;
- (id)initWithString:(NSString *)params inBounds:(RMProjectedRect)projectedBounds;
/// inverse project meters, return latitude/longitude
- (CLLocationCoordinate2D)pointToCoordinate:(RMProjectedPoint)aPoint;
- (CLLocationCoordinate2D)projectedPointToCoordinate:(RMProjectedPoint)aPoint;
/// forward project latitude/longitude, return meters
- (RMProjectedPoint)coordinateToPoint:(CLLocationCoordinate2D)aLatLong;
- (RMProjectedPoint)coordinateToProjectedPoint:(CLLocationCoordinate2D)aLatLong;
@end
... ...
... ... @@ -35,7 +35,7 @@
@synthesize planetBounds;
@synthesize projectionWrapsHorizontally;
- (id)initWithString:(NSString *)params inBounds:(RMProjectedRect)projBounds
- (id)initWithString:(NSString *)params inBounds:(RMProjectedRect)projectedBounds
{
if (!(self = [super init]))
return nil;
... ... @@ -48,7 +48,7 @@
return nil;
}
planetBounds = projBounds;
planetBounds = projectedBounds;
projectionWrapsHorizontally = YES;
return self;
... ... @@ -103,7 +103,7 @@
return aPoint;
}
- (RMProjectedPoint)coordinateToPoint:(CLLocationCoordinate2D)aLatLong
- (RMProjectedPoint)coordinateToProjectedPoint:(CLLocationCoordinate2D)aLatLong
{
projUV uv = {
aLatLong.longitude * DEG_TO_RAD,
... ... @@ -120,7 +120,7 @@
return result_point;
}
- (CLLocationCoordinate2D)pointToCoordinate:(RMProjectedPoint)aPoint
- (CLLocationCoordinate2D)projectedPointToCoordinate:(RMProjectedPoint)aPoint
{
projUV uv = {
aPoint.easting,
... ...