Add Tile LOD controls (#2958)

Co-authored-by: Bart Louwers <bart@emeel.net>
Co-authored-by: Adrian Cojocaru <adrian.cojocaru92@yahoo.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
alasram
2025-06-04 05:49:41 -07:00
committed by GitHub
parent 2e4541c441
commit b11134a301
43 changed files with 1066 additions and 114 deletions

View File

@@ -202,6 +202,50 @@ MLN_EXPORT IB_DESIGNABLE @interface MLNMapView : NSView<MLNStylable>
*/
@property (nonatomic, assign) BOOL prefetchesTiles;
// MARK: Tile LOD controls
/**
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;
/**
Camera based tile level of detail controls
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;
/**
Camera based tile level of detail controls
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;
/**
Camera based tile level of detail controls
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.
*/
@property (nonatomic, assign) double tileLodZoomShift;
// MARK: Manipulating the Viewpoint
/**

View File

@@ -710,6 +710,46 @@ public:
return _mbglMap->getPrefetchZoomDelta() > 0 ? YES : NO;
}
- (void)setTileLodMinRadius:(double)tileLodMinRadius
{
_mbglMap->setTileLodMinRadius(tileLodMinRadius);
}
- (double)tileLodMinRadius
{
return _mbglMap->getTileLodMinRadius();
}
- (void)setTileLodScale:(double)tileLodScale
{
_mbglMap->setTileLodScale(tileLodScale);
}
- (double)tileLodScale
{
return _mbglMap->getTileLodScale();
}
-(void)setTileLodPitchThreshold:(double)tileLodPitchThreshold
{
_mbglMap->setTileLodPitchThreshold(tileLodPitchThreshold);
}
-(double)tileLodPitchThreshold
{
return _mbglMap->getTileLodPitchThreshold();
}
-(void)setTileLodZoomShift:(double)tileLodZoomShift
{
_mbglMap->setTileLodZoomShift(tileLodZoomShift);
}
-(double)tileLodZoomShift
{
return _mbglMap->getTileLodZoomShift();
}
- (mbgl::Renderer *)renderer {
return _rendererFrontend->getRenderer();
}