ISCoordinatesConverter Class Reference
Inherits from | NSObject |
---|---|
Declared in | ISCoordinatesConverter.h |
Overview
Utils class that manages coordinates convertions between 3 systems of references : - screen coordinates (in pixel, with (0,0) at the top left corner of the displayed surface) - real coordinates (in meter, with (0,0) at the top left corner of the map) - map coordinates (in pixel at zoom level 0, with (0,0) at the top left corner of the map)
+ setScreenDimensionsWithWidth:andHeight:
This should be called before any use of the coord converter, in order to initialize it. By default, this method is called on map view creation.
+ (void)setScreenDimensionsWithWidth:(int)screenWidth andHeight:(int)screenHeight
Parameters
screenWidth |
map canvas width |
---|---|
screenHeight |
map canvas height |
Declared In
ISCoordinatesConverter.h
+ getScreenDimensions
Returns the current screen dimensions. @return
+ (CGPoint)getScreenDimensions
Declared In
ISCoordinatesConverter.h
+ getRatioWithZoomLevel:andScale:
Computes the “map ratio”, that is a combination of the map’s scale and the map’s current zoom level. The result is used everywhere in the coord transformations. @param aZoomLevel @param aScale @return
+ (double)getRatioWithZoomLevel:(float)zoomLevel andScale:(float)scale
Declared In
ISCoordinatesConverter.h
+ getDisplayOffsetWithDisplayCenter:andZoomLevel:
Computes the position of map (0,0) on the screen, in pixels at z0 @param aDisplayCenter @return
+ (CGPoint)getDisplayOffsetWithDisplayCenter:(CGPoint)displayCenter andZoomLevel:(float)zoomLevel
Declared In
ISCoordinatesConverter.h
+ getDisplayOffsetAtZWithDisplayCenter:andZoomLevel:
Computes the position of map (0,0) on the screen, in pixels at zoomLevel @param aDisplayCenter @param zoomLevel @return
+ (CGPoint)getDisplayOffsetAtZWithDisplayCenter:(CGPoint)displayCenter andZoomLevel:(float)zoomLevel
Declared In
ISCoordinatesConverter.h
+ convertCoordForZoomLevelWithPixelsPoint:andSourceZoomLevel:andDestZoomLevel:
convert coordinates in pixel from source zoom level, to dest zoom level @param pixels @param srcZoomLevel @param destZoomLevel @return
+ (CGPoint)convertCoordForZoomLevelWithPixelsPoint:(CGPoint)pixels andSourceZoomLevel:(float)srcZoomLevel andDestZoomLevel:(float)destZoomLevel
Declared In
ISCoordinatesConverter.h
+ convertCoordForZoomLevelWithPixelsRect:andSourceZoomLevel:andDestZoomLevel:
+ (ISRect *)convertCoordForZoomLevelWithPixelsRect:(ISRect *)pixels andSourceZoomLevel:(float)srcZoomLevel andDestZoomLevel:(float)destZoomLevel
+ convertRealDistanceToScreenDistanceWithDistance:andRatio:
Converts a raw distance into a screen distance, in the routine above we already computed the ratio using a scale and a zoom level @param aDistance @param aRatio @return
+ (int)convertRealDistanceToScreenDistanceWithDistance:(float)distance andRatio:(float)ratio
Declared In
ISCoordinatesConverter.h
+ convertScreenDistanceToRealDistanceWithDistance:andRatio:
+ (float)convertScreenDistanceToRealDistanceWithDistance:(float)distance andRatio:(float)ratio
+ convertScreenPointToRealPointWithScreenPoint:andDisplayCenter:andZoomLevel:andScale:
+ (CGPoint)convertScreenPointToRealPointWithScreenPoint:(CGPoint)screenPoint andDisplayCenter:(CGPoint)displayCenter andZoomLevel:(float)zoomLevel andScale:(float)scale
+ convertRealPointToScreenPointWithRealPoint:andDisplayCenter:andZoomLevel:andScale:
+ (CGPoint)convertRealPointToScreenPointWithRealPoint:(CGPoint)realPoint andDisplayCenter:(CGPoint)displayCenter andZoomLevel:(float)zoomLevel andScale:(float)scale
+ convertScreenDistanceInMapDistanceWithScreenDistance:andZoomLevel:
convert screen distance into map coordinates (pixels at z0) @param screenDistance @param zoomLevel @return
+ (CGPoint)convertScreenDistanceInMapDistanceWithScreenDistance:(CGPoint)screenDistance andZoomLevel:(float)zoomLevel
Declared In
ISCoordinatesConverter.h
+ convertMapDistanceInScreenDistanceWithMapDistance:andZoomLevel:
+ (CGPoint)convertMapDistanceInScreenDistanceWithMapDistance:(CGPoint)mapDistance andZoomLevel:(float)zoomLevel
+ convertMapPointToScreenPointWithX:andY:andDisplayCenter:andZoomLevel:
convert map coordinates (pixels at z0) into screen coordinates input : pixels (float) output : pixels (integer)
+ (CGPoint)convertMapPointToScreenPointWithX:(float)x andY:(float)y andDisplayCenter:(CGPoint)displayCenter andZoomLevel:(float)zoomLevel
Declared In
ISCoordinatesConverter.h
+ convertScreenPointToMapPointWithX:andY:andDisplayCenter:andZoomLevel:
+ (CGPoint)convertScreenPointToMapPointWithX:(int)x andY:(int)y andDisplayCenter:(CGPoint)displayCenter andZoomLevel:(float)zoomLevel
+ getViewPortWithDisplayCenter:andZoomLevel:
calculate the current screen rectangle in pixels at this zoomlevel @param aDisplayCenter @param aZoomLevel @return
+ (ISRect *)getViewPortWithDisplayCenter:(CGPoint)displayCenter andZoomLevel:(float)zoomLevel
Declared In
ISCoordinatesConverter.h
+ convertViewPortWithViewport:andSrcZoomLevel:andDestZoomLevel:
convert the view port at srcZoomLevel, in destZoomLevel coordinates @param viewPort @param srcZoomLevel @param destZoomLevel @return
+ (ISRect *)convertViewPortWithViewport:(ISRect *)viewPort andSrcZoomLevel:(float)srcZoomLevel andDestZoomLevel:(float)destZoomLevel
Declared In
ISCoordinatesConverter.h
+ getZoomLevelWithScale:andRealWidth:
+ (double)getZoomLevelWithScale:(float)scale andRealWidth:(double)realWidth