Skip to content

Commit

Permalink
expose camera based lod controls to iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
yousifd committed Feb 19, 2025
1 parent 00c228a commit 2d379f2
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
43 changes: 43 additions & 0 deletions platform/ios/src/MLNMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,49 @@ MLN_EXPORT

@property (nonatomic, assign) BOOL tileCacheEnabled;

// MARK: Camera based tile level of detail controls

/**
Minimum radius around the view point in unit of tiles in which the fine
grained zoom level tiles are always used when performing LOD
radius must be greater than 1 (At least 1 fine detailed tile is present)
A smaller radius value may improve performance at the cost of quality (tiles away from
camera use lower Zoom levels)
*/

@property (nonatomic, assign) double tileLodMinRadius;

/**
factor for the distance to the camera view point
A value larger than 1 increases the distance to the camera view point reducing LOD
Larger values may improve performance at the cost of quality (tiles away from camera
use lower Zoom levels)
*/

@property (nonatomic, assign) double tileLodScale;

/**
pitch angle in radians above which LOD calculation is performed
A smaller radius value may improve performance at the cost of quality
*/

@property (nonatomic, assign) double tileLodPitchThreshold;

/**
Shift applied to the Zoom level during LOD calculation
A negative value shifts the Zoom level to a coarser level reducing quality but
improving performance
A positive value shifts the Zoom level to a finer level increasing details but
negatively affecting performance
A value of zero (default) does not apply any shift to the Zoom level
It is not recommended to change the default value unless performance is critical
and the loss of quality is acceptable. A value of -1 reduces the number of
displayed tiles by a factor of 4 on average
It is recommended to first configure the pixelRatio before adjusting
TileLodZoomShift. {@link MapLibreMapOptions#pixelRatio(float)}
*/
@property (nonatomic, assign) double tileLodZoomShift;

// MARK: Displaying the User’s Location

/**
Expand Down
40 changes: 40 additions & 0 deletions platform/ios/src/MLNMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3159,6 +3159,46 @@ - (BOOL)tileCacheEnabled
return _rendererFrontend->getTileCacheEnabled();
}

- (void)setTileLodMinRadius:(double)radius
{
self.mbglMap.setTileLodMinRadius(radius);
}

- (double)tileLodMinRadius
{
return self.mbglMap.getTileLodMinRadius();
}

- (void)setTileLodScale:(double)scale
{
self.mbglMap.setTileLodScale(scale);
}

- (double)tileLodScale
{
return self.mbglMap.getTileLodScale();
}

- (void)setTileLodPitchThreshold:(double)threshold
{
self.mbglMap.setTileLodPitchThreshold(threshold);
}

- (double)tileLodPitchThreshold
{
return self.mbglMap.getTileLodPitchThreshold();
}

- (void)setTileLodZoomShift:(double)shift
{
self.mbglMap.setTileLodZoomShift(shift);
}

- (double)tileLodZoomShift
{
return self.mbglMap.getTileLodZoomShift();
}

// MARK: - Accessibility -

- (NSString *)accessibilityValue
Expand Down

0 comments on commit 2d379f2

Please sign in to comment.