core: rename mbgl namespace to mln (#4487)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Bart Louwers
2026-08-14 23:25:20 +02:00
committed by GitHub
parent 836b862984
commit 550f64be22
1970 changed files with 8931 additions and 8967 deletions

View File

@@ -332,7 +332,7 @@ typedef std::unordered_map<MLNAnnotationTag, MLNAnnotationContext> MLNAnnotation
/// Mapping from an annotation object to an annotation tag.
typedef std::map<id<MLNAnnotation>, MLNAnnotationTag> MLNAnnotationObjectTagMap;
mbgl::util::UnitBezier MLNUnitBezierForMediaTimingFunction(CAMediaTimingFunction *function) {
mln::util::UnitBezier MLNUnitBezierForMediaTimingFunction(CAMediaTimingFunction *function) {
if (!function) {
function = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
}
@@ -455,7 +455,7 @@ public:
@end
@implementation MLNMapView {
std::unique_ptr<mbgl::Map> _mbglMap;
std::unique_ptr<mln::Map> _mbglMap;
std::unique_ptr<MLNMapViewImpl> _mbglView;
std::unique_ptr<MLNRenderFrontend> _rendererFrontend;
@@ -638,7 +638,7 @@ public:
self.styleURL = styleURL;
}
- (mbgl::Map &)mbglMap {
- (mln::Map &)mbglMap {
if (!_mbglMap) {
[NSException
raise:MLNUnderlyingMapUnavailableException
@@ -647,7 +647,7 @@ public:
return *_mbglMap;
}
- (mbgl::Renderer *)renderer {
- (mln::Renderer *)renderer {
return _rendererFrontend->getRenderer();
}
@@ -698,40 +698,40 @@ public:
config.localFontFamilyName
? std::optional<std::string>(std::string(config.localFontFamilyName.UTF8String))
: std::nullopt;
auto renderer = std::make_unique<mbgl::Renderer>(_mbglView->getRendererBackend(),
config.scaleFactor, localFontFamilyName);
auto renderer = std::make_unique<mln::Renderer>(_mbglView->getRendererBackend(),
config.scaleFactor, localFontFamilyName);
BOOL enableCrossSourceCollisions = !config.perSourceCollisions;
_rendererFrontend = std::make_unique<MLNRenderFrontend>(std::move(renderer), self,
_mbglView->getRendererBackend());
mbgl::MapOptions mapOptions;
mapOptions.withMapMode(mbgl::MapMode::Continuous)
mln::MapOptions mapOptions;
mapOptions.withMapMode(mln::MapMode::Continuous)
.withSize(self.size)
.withPixelRatio(config.scaleFactor)
.withConstrainMode(mbgl::ConstrainMode::None)
.withViewportMode(mbgl::ViewportMode::Default)
.withConstrainMode(mln::ConstrainMode::None)
.withViewportMode(mln::ViewportMode::Default)
.withCrossSourceCollisions(enableCrossSourceCollisions)
.withFastPFOREnabled(mlnMapoptions.fastPFOREnabled);
mbgl::TileServerOptions *tileServerOptions =
mln::TileServerOptions *tileServerOptions =
[[MLNSettings sharedSettings] tileServerOptionsInternal];
mbgl::ResourceOptions resourceOptions;
mln::ResourceOptions resourceOptions;
resourceOptions.withCachePath(MLNOfflineStorage.sharedOfflineStorage.databasePath.UTF8String)
.withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String)
.withTileServerOptions(*tileServerOptions);
mbgl::ClientOptions clientOptions;
mln::ClientOptions clientOptions;
auto apiKey = [[MLNSettings sharedSettings] apiKey];
if (apiKey) {
resourceOptions.withApiKey([apiKey UTF8String]);
}
const mbgl::util::ActionJournalOptions &actionJournalOptions =
const mln::util::ActionJournalOptions &actionJournalOptions =
[mlnMapoptions.actionJournalOptions getCoreOptions];
NSAssert(!_mbglMap, @"_mbglMap should be NULL");
_mbglMap = std::make_unique<mbgl::Map>(*_rendererFrontend, *_mbglView, mapOptions,
resourceOptions, clientOptions, actionJournalOptions);
_mbglMap = std::make_unique<mln::Map>(*_rendererFrontend, *_mbglView, mapOptions, resourceOptions,
clientOptions, actionJournalOptions);
// start paused if launch into the background
if (background) {
@@ -975,9 +975,9 @@ public:
// set initial position
//
mbgl::CameraOptions options;
options.center = mbgl::LatLng(0, 0);
mbgl::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(self.contentInset);
mln::CameraOptions options;
options.center = mln::LatLng(0, 0);
mln::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(self.contentInset);
options.padding = padding;
options.zoom = 0;
@@ -993,7 +993,7 @@ public:
_dynamicNavigationCameraAnimationDuration = NO;
}
- (mbgl::Size)size {
- (mln::Size)size {
// check for minimum texture size supported by OpenGL ES 2.0
//
CGSize size = CGSizeMake(MAX(self.bounds.size.width, 64), MAX(self.bounds.size.height, 64));
@@ -1005,7 +1005,7 @@ public:
MLNReachability *reachability = [notification object];
if (!_isWaitingForRedundantReachableNotification && [reachability isReachable]) {
mbgl::NetworkStatus::Reachable();
mln::NetworkStatus::Reachable();
}
_isWaitingForRedundantReachableNotification = NO;
}
@@ -1661,8 +1661,8 @@ public:
- (void)validateDisplayLink {
BOOL isVisible = self.superview && self.window;
if (isVisible && !_displayLink) {
if (_mbglMap && self.mbglMap.getMapOptions().constrainMode() == mbgl::ConstrainMode::None) {
self.mbglMap.setConstrainMode(mbgl::ConstrainMode::HeightOnly);
if (_mbglMap && self.mbglMap.getMapOptions().constrainMode() == mln::ConstrainMode::None) {
self.mbglMap.setConstrainMode(mln::ConstrainMode::HeightOnly);
}
_displayLink = [self.window.screen displayLinkWithTarget:self
@@ -1917,8 +1917,8 @@ public:
[self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
if (_mbglMap && self.mbglMap.getMapOptions().constrainMode() == mbgl::ConstrainMode::None) {
self.mbglMap.setConstrainMode(mbgl::ConstrainMode::HeightOnly);
if (_mbglMap && self.mbglMap.getMapOptions().constrainMode() == mln::ConstrainMode::None) {
self.mbglMap.setConstrainMode(mln::ConstrainMode::HeightOnly);
}
}
@@ -2283,8 +2283,8 @@ public:
aroundAnchorPoint:centerPoint];
if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) {
self.mbglMap.jumpTo(mbgl::CameraOptions().withZoom(newZoom).withAnchor(
mbgl::ScreenCoordinate{centerPoint.x, centerPoint.y}));
self.mbglMap.jumpTo(mln::CameraOptions().withZoom(newZoom).withAnchor(
mln::ScreenCoordinate{centerPoint.x, centerPoint.y}));
// The gesture recognizer only reports the gesture’s current center
// point, so use the previous center point to anchor the transition.
@@ -2332,8 +2332,8 @@ public:
drift = NO;
} else {
if (drift) {
self.mbglMap.easeTo(mbgl::CameraOptions().withZoom(zoom).withAnchor(
mbgl::ScreenCoordinate{centerPoint.x, centerPoint.y}),
self.mbglMap.easeTo(mln::CameraOptions().withZoom(zoom).withAnchor(
mln::ScreenCoordinate{centerPoint.x, centerPoint.y}),
MLNDurationFromTimeInterval(duration));
}
}
@@ -2401,9 +2401,9 @@ public:
aroundAnchorPoint:centerPoint];
if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) {
self.mbglMap.jumpTo(mbgl::CameraOptions()
self.mbglMap.jumpTo(mln::CameraOptions()
.withBearing(newDegrees)
.withAnchor(mbgl::ScreenCoordinate{centerPoint.x, centerPoint.y}));
.withAnchor(mln::ScreenCoordinate{centerPoint.x, centerPoint.y}));
}
[self cameraIsChanging];
@@ -2440,9 +2440,9 @@ public:
aroundAnchorPoint:centerPoint];
if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) {
self.mbglMap.easeTo(mbgl::CameraOptions()
self.mbglMap.easeTo(mln::CameraOptions()
.withBearing(newDegrees)
.withAnchor(mbgl::ScreenCoordinate{centerPoint.x, centerPoint.y}),
.withAnchor(mln::ScreenCoordinate{centerPoint.x, centerPoint.y}),
MLNDurationFromTimeInterval(decelerationRate));
[self notifyGestureDidEndWithDrift:YES];
@@ -2561,8 +2561,8 @@ public:
MLNMapCamera *toCamera = [self cameraByZoomingToZoomLevel:newZoom aroundAnchorPoint:gesturePoint];
if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) {
mbgl::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
self.mbglMap.easeTo(mbgl::CameraOptions().withZoom(newZoom).withAnchor(center),
mln::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
self.mbglMap.easeTo(mln::CameraOptions().withZoom(newZoom).withAnchor(center),
MLNDurationFromTimeInterval(MLNAnimationDuration));
__weak MLNMapView *weakSelf = self;
@@ -2596,8 +2596,8 @@ public:
MLNMapCamera *toCamera = [self cameraByZoomingToZoomLevel:newZoom aroundAnchorPoint:gesturePoint];
if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) {
mbgl::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
self.mbglMap.easeTo(mbgl::CameraOptions().withZoom(newZoom).withAnchor(center),
mln::ScreenCoordinate center(gesturePoint.x, gesturePoint.y);
self.mbglMap.easeTo(mln::CameraOptions().withZoom(newZoom).withAnchor(center),
MLNDurationFromTimeInterval(MLNAnimationDuration));
__weak MLNMapView *weakSelf = self;
@@ -2638,8 +2638,8 @@ public:
aroundAnchorPoint:centerPoint];
if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) {
self.mbglMap.jumpTo(mbgl::CameraOptions().withZoom(newZoom).withAnchor(
mbgl::ScreenCoordinate{centerPoint.x, centerPoint.y}));
self.mbglMap.jumpTo(mln::CameraOptions().withZoom(newZoom).withAnchor(
mln::ScreenCoordinate{centerPoint.x, centerPoint.y}));
}
[self cameraIsChanging];
@@ -2701,8 +2701,8 @@ public:
MLNMapCamera *toCamera = [self cameraByTiltingToPitch:pitchNew];
if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera]) {
self.mbglMap.jumpTo(mbgl::CameraOptions().withPitch(pitchNew).withAnchor(
mbgl::ScreenCoordinate{centerPoint.x, centerPoint.y}));
self.mbglMap.jumpTo(mln::CameraOptions().withPitch(pitchNew).withAnchor(
mln::ScreenCoordinate{centerPoint.x, centerPoint.y}));
}
[self cameraIsChanging];
@@ -2731,12 +2731,12 @@ public:
}
- (MLNMapCamera *)cameraByZoomingToZoomLevel:(double)zoom aroundAnchorPoint:(CGPoint)anchorPoint {
mbgl::ScreenCoordinate anchor = mbgl::ScreenCoordinate{anchorPoint.x, anchorPoint.y};
mbgl::EdgeInsets padding =
mbgl::EdgeInsets(anchor.y, anchor.x, self.size.height - anchor.y, self.size.width - anchor.x);
mbgl::CameraOptions currentCameraOptions = self.mbglMap.getCameraOptions(padding);
mln::ScreenCoordinate anchor = mln::ScreenCoordinate{anchorPoint.x, anchorPoint.y};
mln::EdgeInsets padding =
mln::EdgeInsets(anchor.y, anchor.x, self.size.height - anchor.y, self.size.width - anchor.x);
mln::CameraOptions currentCameraOptions = self.mbglMap.getCameraOptions(padding);
currentCameraOptions.zoom = mbgl::util::clamp(zoom, self.minimumZoomLevel, self.maximumZoomLevel);
currentCameraOptions.zoom = mln::util::clamp(zoom, self.minimumZoomLevel, self.maximumZoomLevel);
currentCameraOptions.anchor = anchor;
MLNCoordinateBounds bounds =
MLNCoordinateBoundsFromLatLngBounds(self.mbglMap.latLngBoundsForCamera(currentCameraOptions));
@@ -2746,11 +2746,11 @@ public:
- (MLNMapCamera *)cameraByRotatingToDirection:(CLLocationDirection)degrees
aroundAnchorPoint:(CGPoint)anchorPoint {
mbgl::CameraOptions currentCameraOptions = self.mbglMap.getCameraOptions();
mln::CameraOptions currentCameraOptions = self.mbglMap.getCameraOptions();
MLNMapCamera *camera;
mbgl::ScreenCoordinate anchor = mbgl::ScreenCoordinate{anchorPoint.x, anchorPoint.y};
mln::ScreenCoordinate anchor = mln::ScreenCoordinate{anchorPoint.x, anchorPoint.y};
currentCameraOptions.bearing = degrees;
currentCameraOptions.anchor = anchor;
camera = [self cameraForCameraOptions:currentCameraOptions];
@@ -2759,7 +2759,7 @@ public:
}
- (MLNMapCamera *)cameraByTiltingToPitch:(CGFloat)pitch {
mbgl::CameraOptions currentCameraOptions = self.mbglMap.getCameraOptions();
mln::CameraOptions currentCameraOptions = self.mbglMap.getCameraOptions();
MLNMapCamera *camera;
@@ -2957,7 +2957,7 @@ static void *windowScreenContext = &windowScreenContext;
// match a valid annotation tag, the annotation will be unnecessarily
// but safely updated.
if (annotation == [self annotationWithTag:annotationTag]) {
const mbgl::Point<double> point = MLNPointFromLocationCoordinate2D(annotation.coordinate);
const mln::Point<double> point = MLNPointFromLocationCoordinate2D(annotation.coordinate);
if (annotationTag != MLNAnnotationTagNotFound) {
MLNAnnotationContext &annotationContext =
@@ -2977,7 +2977,7 @@ static void *windowScreenContext = &windowScreenContext;
// disables the view’s animation actions, because it can’t distinguish between moves due to
// the viewport changing and moves due to the annotation’s coordinate changing.
self.mbglMap.updateAnnotation(annotationTag,
mbgl::SymbolAnnotation{point, symbolName.UTF8String});
mln::SymbolAnnotation{point, symbolName.UTF8String});
[self updateCalloutView];
}
}
@@ -3026,21 +3026,21 @@ static void *windowScreenContext = &windowScreenContext;
return self.residualDebugMask;
}
mbgl::MapDebugOptions options = self.mbglMap.getDebug();
mln::MapDebugOptions options = self.mbglMap.getDebug();
MLNMapDebugMaskOptions mask = 0;
if (options & mbgl::MapDebugOptions::TileBorders) {
if (options & mln::MapDebugOptions::TileBorders) {
mask |= MLNMapDebugTileBoundariesMask;
}
if (options & mbgl::MapDebugOptions::ParseStatus) {
if (options & mln::MapDebugOptions::ParseStatus) {
mask |= MLNMapDebugTileInfoMask;
}
if (options & mbgl::MapDebugOptions::Timestamps) {
if (options & mln::MapDebugOptions::Timestamps) {
mask |= MLNMapDebugTimestampsMask;
}
if (options & mbgl::MapDebugOptions::Collision) {
if (options & mln::MapDebugOptions::Collision) {
mask |= MLNMapDebugCollisionBoxesMask;
}
if (options & mbgl::MapDebugOptions::Overdraw) {
if (options & mln::MapDebugOptions::Overdraw) {
mask |= MLNMapDebugOverdrawVisualizationMask;
}
return mask;
@@ -3051,21 +3051,21 @@ static void *windowScreenContext = &windowScreenContext;
return;
}
mbgl::MapDebugOptions options = mbgl::MapDebugOptions::NoDebug;
mln::MapDebugOptions options = mln::MapDebugOptions::NoDebug;
if (debugMask & MLNMapDebugTileBoundariesMask) {
options |= mbgl::MapDebugOptions::TileBorders;
options |= mln::MapDebugOptions::TileBorders;
}
if (debugMask & MLNMapDebugTileInfoMask) {
options |= mbgl::MapDebugOptions::ParseStatus;
options |= mln::MapDebugOptions::ParseStatus;
}
if (debugMask & MLNMapDebugTimestampsMask) {
options |= mbgl::MapDebugOptions::Timestamps;
options |= mln::MapDebugOptions::Timestamps;
}
if (debugMask & MLNMapDebugCollisionBoxesMask) {
options |= mbgl::MapDebugOptions::Collision;
options |= mln::MapDebugOptions::Collision;
}
if (debugMask & MLNMapDebugOverdrawVisualizationMask) {
options |= mbgl::MapDebugOptions::Overdraw;
options |= mln::MapDebugOptions::Overdraw;
}
self.mbglMap.setDebug(options);
}
@@ -3088,9 +3088,9 @@ static void *windowScreenContext = &windowScreenContext;
double pitch = camera.pitch ? *camera.pitch : 0.0;
double bearing = camera.bearing ? *camera.bearing : 0.0;
double zoom = camera.zoom ? *camera.zoom : 0.0;
mbgl::LatLng center = camera.center ? *camera.center : mbgl::LatLng();
mln::LatLng center = camera.center ? *camera.center : mln::LatLng();
CLLocationDirection heading = mbgl::util::wrap(bearing, 0., 360.);
CLLocationDirection heading = mln::util::wrap(bearing, 0., 360.);
CLLocationDistance altitude = MLNAltitudeForZoomLevel(zoom, pitch, 0, self.frame.size);
self.camera =
[MLNMapCamera cameraLookingAtCenterCoordinate:MLNLocationCoordinate2DFromLatLng(center)
@@ -3170,7 +3170,7 @@ static void *windowScreenContext = &windowScreenContext;
}
- (void)setPrefetchesTiles:(BOOL)prefetchesTiles {
self.mbglMap.setPrefetchZoomDelta(prefetchesTiles ? mbgl::util::DEFAULT_PREFETCH_ZOOM_DELTA : 0);
self.mbglMap.setPrefetchZoomDelta(prefetchesTiles ? mln::util::DEFAULT_PREFETCH_ZOOM_DELTA : 0);
}
- (BOOL)prefetchesTiles {
@@ -3764,8 +3764,8 @@ static void *windowScreenContext = &windowScreenContext;
centerPoint = self.userLocationAnnotationViewCenter;
}
double newZoom = round(self.zoomLevel) + log2(scaleFactor);
self.mbglMap.jumpTo(mbgl::CameraOptions().withZoom(newZoom).withAnchor(
mbgl::ScreenCoordinate{centerPoint.x, centerPoint.y}));
self.mbglMap.jumpTo(mln::CameraOptions().withZoom(newZoom).withAnchor(
mln::ScreenCoordinate{centerPoint.x, centerPoint.y}));
[self unrotateIfNeededForGesture];
_accessibilityValueAnnouncementIsPending = YES;
@@ -3855,7 +3855,7 @@ static void *windowScreenContext = &windowScreenContext;
return;
}
mbgl::CameraOptions cameraOptions;
mln::CameraOptions cameraOptions;
cameraOptions.center = MLNLatLngFromLocationCoordinate2D(centerCoordinate);
cameraOptions.padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
cameraOptions.zoom = zoomLevel;
@@ -3863,7 +3863,7 @@ static void *windowScreenContext = &windowScreenContext;
cameraOptions.bearing = direction;
}
mbgl::AnimationOptions animationOptions;
mln::AnimationOptions animationOptions;
if (duration) {
animationOptions.duration.emplace(MLNDurationFromTimeInterval(duration));
animationOptions.easing.emplace(MLNUnitBezierForMediaTimingFunction(function));
@@ -3927,13 +3927,13 @@ static void *windowScreenContext = &windowScreenContext;
CGFloat duration = animated ? MLNAnimationDuration : 0;
self.mbglMap.easeTo(mbgl::CameraOptions().withZoom(zoomLevel),
self.mbglMap.easeTo(mln::CameraOptions().withZoom(zoomLevel),
MLNDurationFromTimeInterval(duration));
}
- (void)setMinimumZoomLevel:(double)minimumZoomLevel {
MLNLogDebug(@"Setting minimumZoomLevel: %f", minimumZoomLevel);
self.mbglMap.setBounds(mbgl::BoundOptions().withMinZoom(minimumZoomLevel));
self.mbglMap.setBounds(mln::BoundOptions().withMinZoom(minimumZoomLevel));
}
- (double)minimumZoomLevel {
@@ -3942,7 +3942,7 @@ static void *windowScreenContext = &windowScreenContext;
- (void)setMaximumZoomLevel:(double)maximumZoomLevel {
MLNLogDebug(@"Setting maximumZoomLevel: %f", maximumZoomLevel);
self.mbglMap.setBounds(mbgl::BoundOptions().withMaxZoom(maximumZoomLevel));
self.mbglMap.setBounds(mln::BoundOptions().withMaxZoom(maximumZoomLevel));
}
- (double)maximumZoomLevel {
@@ -3950,13 +3950,13 @@ static void *windowScreenContext = &windowScreenContext;
}
- (void)setMaximumScreenBounds:(MLNCoordinateBounds)maximumScreenBounds {
mbgl::LatLng sw = {maximumScreenBounds.sw.latitude, maximumScreenBounds.sw.longitude};
mbgl::LatLng ne = {maximumScreenBounds.ne.latitude, maximumScreenBounds.ne.longitude};
mbgl::BoundOptions newBounds =
mbgl::BoundOptions().withLatLngBounds(mbgl::LatLngBounds::hull(sw, ne));
mln::LatLng sw = {maximumScreenBounds.sw.latitude, maximumScreenBounds.sw.longitude};
mln::LatLng ne = {maximumScreenBounds.ne.latitude, maximumScreenBounds.ne.longitude};
mln::BoundOptions newBounds =
mln::BoundOptions().withLatLngBounds(mln::LatLngBounds::hull(sw, ne));
self.mbglMap.setBounds(newBounds);
self.mbglMap.setConstrainMode(mbgl::ConstrainMode::Screen);
self.mbglMap.setConstrainMode(mln::ConstrainMode::Screen);
}
- (MLNCoordinateBounds)maximumScreenBounds {
@@ -3970,7 +3970,7 @@ static void *windowScreenContext = &windowScreenContext;
- (void)setMinimumPitch:(CGFloat)minimumPitch {
MLNLogDebug(@"Setting minimumPitch: %f", minimumPitch);
self.mbglMap.setBounds(mbgl::BoundOptions().withMinPitch(minimumPitch));
self.mbglMap.setBounds(mln::BoundOptions().withMinPitch(minimumPitch));
}
- (CGFloat)maximumPitch {
@@ -3979,7 +3979,7 @@ static void *windowScreenContext = &windowScreenContext;
- (void)setMaximumPitch:(CGFloat)maximumPitch {
MLNLogDebug(@"Setting maximumPitch: %f", maximumPitch);
self.mbglMap.setBounds(mbgl::BoundOptions().withMaxPitch(maximumPitch));
self.mbglMap.setBounds(mln::BoundOptions().withMaxPitch(maximumPitch));
}
- (MLNCoordinateBounds)visibleCoordinateBounds {
@@ -4097,9 +4097,9 @@ static void *windowScreenContext = &windowScreenContext;
return;
}
mbgl::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
mln::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
padding += MLNEdgeInsetsFromNSEdgeInsets(self.contentInset);
std::vector<mbgl::LatLng> latLngs;
std::vector<mln::LatLng> latLngs;
latLngs.reserve(count);
for (NSUInteger i = 0; i < count; i++) {
latLngs.push_back({coordinates[i].latitude, coordinates[i].longitude});
@@ -4107,10 +4107,10 @@ static void *windowScreenContext = &windowScreenContext;
CLLocationDirection cameraDirection = direction >= 0 ? direction : self.direction;
mbgl::CameraOptions cameraOptions =
mln::CameraOptions cameraOptions =
self.mbglMap.cameraForLatLngs(latLngs, padding, cameraDirection);
mbgl::AnimationOptions animationOptions;
mln::AnimationOptions animationOptions;
if (duration > 0) {
animationOptions.duration.emplace(MLNDurationFromTimeInterval(duration));
animationOptions.easing.emplace(MLNUnitBezierForMediaTimingFunction(function));
@@ -4157,7 +4157,7 @@ static void *windowScreenContext = &windowScreenContext;
}
- (CLLocationDirection)direction {
return mbgl::util::wrap(*self.mbglMap.getCameraOptions().bearing, 0., 360.);
return mln::util::wrap(*self.mbglMap.getCameraOptions().bearing, 0., 360.);
}
- (void)setDirection:(CLLocationDirection)direction animated:(BOOL)animated {
@@ -4187,15 +4187,15 @@ static void *windowScreenContext = &windowScreenContext;
self.cameraChangeReasonBitmask |= MLNCameraChangeReasonProgrammatic;
if (self.userTrackingMode == MLNUserTrackingModeNone) {
self.mbglMap.easeTo(mbgl::CameraOptions().withBearing(direction),
self.mbglMap.easeTo(mln::CameraOptions().withBearing(direction),
MLNDurationFromTimeInterval(duration));
} else {
CGPoint anchor = self.userLocationAnnotationViewCenter;
mbgl::CameraOptions cameraOptions = mbgl::CameraOptions().withBearing(direction).withAnchor(
mbgl::ScreenCoordinate{anchor.x, anchor.y});
mln::CameraOptions cameraOptions = mln::CameraOptions().withBearing(direction).withAnchor(
mln::ScreenCoordinate{anchor.x, anchor.y});
mbgl::AnimationOptions animationOptions;
mln::AnimationOptions animationOptions;
animationOptions.duration.emplace(MLNDurationFromTimeInterval(duration));
if (CLLocationCoordinate2DIsValid(center)) {
@@ -4227,8 +4227,8 @@ static void *windowScreenContext = &windowScreenContext;
}
- (UIEdgeInsets)cameraEdgeInsets {
mbgl::CameraOptions cameraOptions = self.mbglMap.getCameraOptions();
return NSEdgeInsetsFromMLNEdgeInsets(cameraOptions.padding.value_or(mbgl::EdgeInsets()));
mln::CameraOptions cameraOptions = self.mbglMap.getCameraOptions();
return NSEdgeInsetsFromMLNEdgeInsets(cameraOptions.padding.value_or(mln::EdgeInsets()));
}
- (MLNMapCamera *)camera {
@@ -4294,7 +4294,7 @@ static void *windowScreenContext = &windowScreenContext;
edgePadding = MLNEdgeInsetsInsetEdgeInset(edgePadding, self.contentInset);
mbgl::AnimationOptions animationOptions;
mln::AnimationOptions animationOptions;
if (duration > 0) {
animationOptions.duration.emplace(MLNDurationFromTimeInterval(duration));
animationOptions.easing.emplace(MLNUnitBezierForMediaTimingFunction(function));
@@ -4329,8 +4329,8 @@ static void *windowScreenContext = &windowScreenContext;
self.cameraChangeReasonBitmask |= MLNCameraChangeReasonProgrammatic;
mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera
edgePadding:edgePadding];
mln::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera
edgePadding:edgePadding];
self.mbglMap.easeTo(cameraOptions, animationOptions);
[self didChangeValueForKey:@"camera"];
}
@@ -4387,7 +4387,7 @@ static void *windowScreenContext = &windowScreenContext;
return;
}
mbgl::AnimationOptions animationOptions;
mln::AnimationOptions animationOptions;
if (duration >= 0) {
animationOptions.duration = MLNDurationFromTimeInterval(duration);
}
@@ -4427,8 +4427,8 @@ static void *windowScreenContext = &windowScreenContext;
self.cameraChangeReasonBitmask |= MLNCameraChangeReasonProgrammatic;
mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera
edgePadding:insets];
mln::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera
edgePadding:insets];
self.mbglMap.flyTo(cameraOptions, animationOptions);
[self didChangeValueForKey:@"camera"];
}
@@ -4452,9 +4452,9 @@ static void *windowScreenContext = &windowScreenContext;
return self.residualCamera;
}
mbgl::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
mln::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
padding += MLNEdgeInsetsFromNSEdgeInsets(self.contentInset);
mbgl::CameraOptions cameraOptions =
mln::CameraOptions cameraOptions =
self.mbglMap.cameraForLatLngBounds(MLNLatLngBoundsFromCoordinateBounds(bounds), padding);
return [self cameraForCameraOptions:cameraOptions];
}
@@ -4466,14 +4466,14 @@ static void *windowScreenContext = &windowScreenContext;
return self.residualCamera;
}
mbgl::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
mln::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
padding += MLNEdgeInsetsFromNSEdgeInsets(self.contentInset);
MLNMapCamera *currentCamera = self.camera;
CGFloat pitch = camera.pitch < 0 ? currentCamera.pitch : camera.pitch;
CLLocationDirection direction = camera.heading < 0 ? currentCamera.heading : camera.heading;
mbgl::CameraOptions cameraOptions = self.mbglMap.cameraForLatLngBounds(
mln::CameraOptions cameraOptions = self.mbglMap.cameraForLatLngBounds(
MLNLatLngBoundsFromCoordinateBounds(bounds), padding, direction, pitch);
return [self cameraForCameraOptions:cameraOptions];
}
@@ -4485,14 +4485,14 @@ static void *windowScreenContext = &windowScreenContext;
return self.residualCamera;
}
mbgl::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
mln::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
padding += MLNEdgeInsetsFromNSEdgeInsets(self.contentInset);
MLNMapCamera *currentCamera = self.camera;
CGFloat pitch = camera.pitch < 0 ? currentCamera.pitch : camera.pitch;
CLLocationDirection direction = camera.heading < 0 ? currentCamera.heading : camera.heading;
mbgl::CameraOptions cameraOptions =
mln::CameraOptions cameraOptions =
self.mbglMap.cameraForGeometry([shape geometryObject], padding, direction, pitch);
return [self cameraForCameraOptions:cameraOptions];
@@ -4505,26 +4505,26 @@ static void *windowScreenContext = &windowScreenContext;
return self.residualCamera;
}
mbgl::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
mln::EdgeInsets padding = MLNEdgeInsetsFromNSEdgeInsets(insets);
padding += MLNEdgeInsetsFromNSEdgeInsets(self.contentInset);
mbgl::CameraOptions cameraOptions =
mln::CameraOptions cameraOptions =
self.mbglMap.cameraForGeometry([shape geometryObject], padding, direction);
return [self cameraForCameraOptions:cameraOptions];
}
- (MLNMapCamera *)cameraForCameraOptions:(const mbgl::CameraOptions &)cameraOptions {
- (MLNMapCamera *)cameraForCameraOptions:(const mln::CameraOptions &)cameraOptions {
if (!_mbglMap) {
return self.residualCamera;
}
mbgl::CameraOptions mapCamera = self.mbglMap.getCameraOptions();
mln::CameraOptions mapCamera = self.mbglMap.getCameraOptions();
CLLocationCoordinate2D centerCoordinate = MLNLocationCoordinate2DFromLatLng(
cameraOptions.center ? *cameraOptions.center : *mapCamera.center);
double zoomLevel = cameraOptions.zoom ? *cameraOptions.zoom : self.zoomLevel;
CLLocationDirection direction =
cameraOptions.bearing ? mbgl::util::wrap(*cameraOptions.bearing, 0., 360.) : self.direction;
cameraOptions.bearing ? mln::util::wrap(*cameraOptions.bearing, 0., 360.) : self.direction;
CGFloat pitch = cameraOptions.pitch ? *cameraOptions.pitch : *mapCamera.pitch;
CLLocationDistance altitude =
MLNAltitudeForZoomLevel(zoomLevel, pitch, centerCoordinate.latitude, self.frame.size);
@@ -4543,9 +4543,9 @@ static void *windowScreenContext = &windowScreenContext;
/// Returns a CameraOptions object that specifies parameters for animating to
/// the given camera.
- (mbgl::CameraOptions)cameraOptionsObjectForAnimatingToCamera:(MLNMapCamera *)camera
edgePadding:(UIEdgeInsets)insets {
mbgl::CameraOptions options;
- (mln::CameraOptions)cameraOptionsObjectForAnimatingToCamera:(MLNMapCamera *)camera
edgePadding:(UIEdgeInsets)insets {
mln::CameraOptions options;
if (CLLocationCoordinate2DIsValid(camera.centerCoordinate)) {
options.center = MLNLatLngFromLocationCoordinate2D(camera.centerCoordinate);
}
@@ -4567,9 +4567,9 @@ static void *windowScreenContext = &windowScreenContext;
}
/// Converts a point in the view’s coordinate system to a geographic coordinate.
- (mbgl::LatLng)convertPoint:(CGPoint)point toLatLngFromView:(nullable UIView *)view {
- (mln::LatLng)convertPoint:(CGPoint)point toLatLngFromView:(nullable UIView *)view {
CGPoint convertedPoint = [self convertPoint:point fromView:view];
return self.mbglMap.latLngForPixel(mbgl::ScreenCoordinate(convertedPoint.x, convertedPoint.y))
return self.mbglMap.latLngForPixel(mln::ScreenCoordinate(convertedPoint.x, convertedPoint.y))
.wrapped();
}
@@ -4582,8 +4582,8 @@ static void *windowScreenContext = &windowScreenContext;
}
/// Converts a geographic coordinate to a point in the view’s coordinate system.
- (CGPoint)convertLatLng:(mbgl::LatLng)latLng toPointToView:(nullable UIView *)view {
mbgl::ScreenCoordinate pixel = self.mbglMap.pixelForLatLng(latLng);
- (CGPoint)convertLatLng:(mln::LatLng)latLng toPointToView:(nullable UIView *)view {
mln::ScreenCoordinate pixel = self.mbglMap.pixelForLatLng(latLng);
return [self convertPoint:CGPointMake(pixel.x, pixel.y) toView:view];
}
@@ -4597,7 +4597,7 @@ static void *windowScreenContext = &windowScreenContext;
/// Converts a geographic bounding box to a rectangle in the view’s coordinate
/// system.
- (CGRect)convertLatLngBounds:(mbgl::LatLngBounds)bounds toRectToView:(nullable UIView *)view {
- (CGRect)convertLatLngBounds:(mln::LatLngBounds)bounds toRectToView:(nullable UIView *)view {
auto northwest = bounds.northwest();
auto northeast = bounds.northeast();
auto southwest = bounds.southwest();
@@ -4612,7 +4612,7 @@ static void *windowScreenContext = &windowScreenContext;
southwest.unwrapForShortestPath(center);
southeast.unwrapForShortestPath(center);
auto correctedLatLngBounds = mbgl::LatLngBounds::empty();
auto correctedLatLngBounds = mln::LatLngBounds::empty();
correctedLatLngBounds.extend(northwest);
correctedLatLngBounds.extend(northeast);
correctedLatLngBounds.extend(southwest);
@@ -4627,8 +4627,8 @@ static void *windowScreenContext = &windowScreenContext;
/// Converts a rectangle in the given view’s coordinate system to a geographic
/// bounding box.
- (mbgl::LatLngBounds)convertRect:(CGRect)rect toLatLngBoundsFromView:(nullable UIView *)view {
auto bounds = mbgl::LatLngBounds::empty();
- (mln::LatLngBounds)convertRect:(CGRect)rect toLatLngBoundsFromView:(nullable UIView *)view {
auto bounds = mln::LatLngBounds::empty();
auto topLeft = [self convertPoint:{CGRectGetMinX(rect), CGRectGetMinY(rect)}
toLatLngFromView:view];
auto topRight = [self convertPoint:{CGRectGetMaxX(rect), CGRectGetMinY(rect)}
@@ -4656,12 +4656,12 @@ static void *windowScreenContext = &windowScreenContext;
}
- (CLLocationDistance)metersPerPointAtLatitude:(CLLocationDegrees)latitude {
return mbgl::Projection::getMetersPerPixelAtLatitude(latitude, self.zoomLevel);
return mln::Projection::getMetersPerPixelAtLatitude(latitude, self.zoomLevel);
}
- (CLLocationDistance)metersPerPointAtLatitude:(CLLocationDegrees)latitude
zoomLevel:(double)zoomLevel {
return mbgl::Projection::getMetersPerPixelAtLatitude(latitude, zoomLevel);
return mln::Projection::getMetersPerPixelAtLatitude(latitude, zoomLevel);
}
- (MLNMapProjection *)mapProjection {
@@ -4863,7 +4863,7 @@ static void *windowScreenContext = &windowScreenContext;
annotationImagesForAnnotation[annotationValue] = annotationImage;
}
MLNAnnotationTag annotationTag = self.mbglMap.addAnnotation(mbgl::SymbolAnnotation{
MLNAnnotationTag annotationTag = self.mbglMap.addAnnotation(mln::SymbolAnnotation{
MLNPointFromLocationCoordinate2D(annotation.coordinate), symbolName.UTF8String});
MLNAnnotationContext context;
@@ -5010,14 +5010,14 @@ static void *windowScreenContext = &windowScreenContext;
return 1.0;
}
- (mbgl::Color)strokeColorForShapeAnnotation:(MLNShape *)annotation {
- (mln::Color)strokeColorForShapeAnnotation:(MLNShape *)annotation {
UIColor *color = (_delegateHasStrokeColorsForShapeAnnotations
? [self.delegate mapView:self strokeColorForShapeAnnotation:annotation]
: self.tintColor);
return color.mgl_color;
}
- (mbgl::Color)fillColorForPolygonAnnotation:(MLNPolygon *)annotation {
- (mln::Color)fillColorForPolygonAnnotation:(MLNPolygon *)annotation {
UIColor *color = (_delegateHasFillColorsForShapeAnnotations
? [self.delegate mapView:self fillColorForPolygonAnnotation:annotation]
: self.tintColor);
@@ -5864,7 +5864,7 @@ static void *windowScreenContext = &windowScreenContext;
return;
}
mbgl::LatLngBounds bounds = mbgl::LatLngBounds::empty();
mln::LatLngBounds bounds = mln::LatLngBounds::empty();
for (id<MLNAnnotation> annotation in annotations) {
if ([annotation conformsToProtocol:@protocol(MLNOverlay)]) {
@@ -5919,10 +5919,10 @@ static void *windowScreenContext = &windowScreenContext;
toAnnotationsWithImageReuseIdentifier:(NSString *)reuseIdentifier {
for (auto &pair : _annotationContextsByAnnotationTag) {
if ([pair.second.imageReuseIdentifier isEqualToString:reuseIdentifier]) {
const mbgl::Point<double> point =
const mln::Point<double> point =
MLNPointFromLocationCoordinate2D(pair.second.annotation.coordinate);
self.mbglMap.updateAnnotation(pair.first,
mbgl::SymbolAnnotation{point, iconIdentifier.UTF8String ?: ""});
mln::SymbolAnnotation{point, iconIdentifier.UTF8String ?: ""});
}
}
}
@@ -6449,13 +6449,13 @@ static void *windowScreenContext = &windowScreenContext;
CLLocationDirection direction = -1;
if (self.userTrackingMode == MLNUserTrackingModeFollowWithCourse) {
if (CLLocationCoordinate2DIsValid(self.targetCoordinate)) {
mbgl::LatLng userLatLng = MLNLatLngFromLocationCoordinate2D(self.userLocation.coordinate);
mbgl::LatLng targetLatLng = MLNLatLngFromLocationCoordinate2D(self.targetCoordinate);
mbgl::ProjectedMeters userMeters = mbgl::Projection::projectedMetersForLatLng(userLatLng);
mbgl::ProjectedMeters targetMeters = mbgl::Projection::projectedMetersForLatLng(targetLatLng);
mln::LatLng userLatLng = MLNLatLngFromLocationCoordinate2D(self.userLocation.coordinate);
mln::LatLng targetLatLng = MLNLatLngFromLocationCoordinate2D(self.targetCoordinate);
mln::ProjectedMeters userMeters = mln::Projection::projectedMetersForLatLng(userLatLng);
mln::ProjectedMeters targetMeters = mln::Projection::projectedMetersForLatLng(targetLatLng);
double angle = atan2(targetMeters.easting() - userMeters.easting(),
targetMeters.northing() - userMeters.northing());
direction = mbgl::util::wrap(MLNDegreesFromRadians(angle), 0., 360.);
direction = mln::util::wrap(MLNDegreesFromRadians(angle), 0., 360.);
} else {
direction = self.userLocation.location.course;
}
@@ -6623,7 +6623,7 @@ static void *windowScreenContext = &windowScreenContext;
predicate:(NSPredicate *)predicate {
MLNLogDebug(@"Querying visibleFeaturesAtPoint: %@ inStyleLayersWithIdentifiers: %@ predicate: %@",
NSStringFromCGPoint(point), styleLayerIdentifiers, predicate);
mbgl::ScreenCoordinate screenCoordinate = {point.x, point.y};
mln::ScreenCoordinate screenCoordinate = {point.x, point.y};
std::optional<std::vector<std::string>> optionalLayerIDs;
if (styleLayerIdentifiers) {
@@ -6636,12 +6636,12 @@ static void *windowScreenContext = &windowScreenContext;
optionalLayerIDs = layerIDs;
}
std::optional<mbgl::style::Filter> optionalFilter;
std::optional<mln::style::Filter> optionalFilter;
if (predicate) {
optionalFilter = predicate.mgl_filter;
}
std::vector<mbgl::Feature> features = _rendererFrontend->getRenderer()->queryRenderedFeatures(
std::vector<mln::Feature> features = _rendererFrontend->getRenderer()->queryRenderedFeatures(
screenCoordinate, {optionalLayerIDs, optionalFilter});
return MLNFeaturesFromMBGLFeatures(features);
}
@@ -6665,7 +6665,7 @@ static void *windowScreenContext = &windowScreenContext;
predicate:(NSPredicate *)predicate {
MLNLogDebug(@"Querying visibleFeaturesInRect: %@ inStyleLayersWithIdentifiers: %@ predicate: %@",
NSStringFromCGRect(rect), styleLayerIdentifiers, predicate);
mbgl::ScreenBox screenBox = {
mln::ScreenBox screenBox = {
{CGRectGetMinX(rect), CGRectGetMinY(rect)},
{CGRectGetMaxX(rect), CGRectGetMaxY(rect)},
};
@@ -6681,12 +6681,12 @@ static void *windowScreenContext = &windowScreenContext;
optionalLayerIDs = layerIDs;
}
std::optional<mbgl::style::Filter> optionalFilter;
std::optional<mln::style::Filter> optionalFilter;
if (predicate) {
optionalFilter = predicate.mgl_filter;
}
std::vector<mbgl::Feature> features = _rendererFrontend->getRenderer()->queryRenderedFeatures(
std::vector<mln::Feature> features = _rendererFrontend->getRenderer()->queryRenderedFeatures(
screenBox, {optionalLayerIDs, optionalFilter});
return MLNFeaturesFromMBGLFeatures(features);
}
@@ -6882,7 +6882,7 @@ static void *windowScreenContext = &windowScreenContext;
}
- (void)mapViewDidFinishRenderingFrameFullyRendered:(BOOL)fullyRendered
renderingStats:(const mbgl::gfx::RenderingStats &)stats {
renderingStats:(const mln::gfx::RenderingStats &)stats {
if (!_mbglMap) {
return;
}
@@ -7549,35 +7549,35 @@ static void *windowScreenContext = &windowScreenContext;
Adds a plug-in layer that is external to this library
*/
- (void)addPluginLayerType:(Class)pluginLayerClass {
auto layerManager = mbgl::LayerManager::get();
auto darwinLayerManager = (mbgl::LayerManagerDarwin *)layerManager;
auto layerManager = mln::LayerManager::get();
auto darwinLayerManager = (mln::LayerManagerDarwin *)layerManager;
MLNPluginLayerCapabilities *capabilities = [pluginLayerClass layerCapabilities];
std::string layerType = [capabilities.layerID UTF8String];
// Default values
mbgl::style::LayerTypeInfo::Source source = mbgl::style::LayerTypeInfo::Source::NotRequired;
mbgl::style::LayerTypeInfo::TileKind tileKind = mbgl::style::LayerTypeInfo::TileKind::NotRequired;
mbgl::style::LayerTypeInfo::FadingTiles fadingTiles =
mbgl::style::LayerTypeInfo::FadingTiles::NotRequired;
mbgl::style::LayerTypeInfo::Layout layout = mbgl::style::LayerTypeInfo::Layout::NotRequired;
mbgl::style::LayerTypeInfo::CrossTileIndex crossTileIndex =
mbgl::style::LayerTypeInfo::CrossTileIndex::NotRequired;
mln::style::LayerTypeInfo::Source source = mln::style::LayerTypeInfo::Source::NotRequired;
mln::style::LayerTypeInfo::TileKind tileKind = mln::style::LayerTypeInfo::TileKind::NotRequired;
mln::style::LayerTypeInfo::FadingTiles fadingTiles =
mln::style::LayerTypeInfo::FadingTiles::NotRequired;
mln::style::LayerTypeInfo::Layout layout = mln::style::LayerTypeInfo::Layout::NotRequired;
mln::style::LayerTypeInfo::CrossTileIndex crossTileIndex =
mln::style::LayerTypeInfo::CrossTileIndex::NotRequired;
mbgl::style::LayerTypeInfo::Pass3D pass3D = mbgl::style::LayerTypeInfo::Pass3D::NotRequired;
mln::style::LayerTypeInfo::Pass3D pass3D = mln::style::LayerTypeInfo::Pass3D::NotRequired;
if (capabilities.requiresPass3D) {
pass3D = mbgl::style::LayerTypeInfo::Pass3D::Required;
pass3D = mln::style::LayerTypeInfo::Pass3D::Required;
}
auto factory = std::make_unique<mbgl::PluginLayerPeerFactory>(
auto factory = std::make_unique<mln::PluginLayerPeerFactory>(
layerType, source, pass3D, layout, fadingTiles, crossTileIndex, tileKind);
__weak MLNMapView *weakMapView = self;
Class layerClass = pluginLayerClass;
factory->setOnLayerCreatedEvent([layerClass, weakMapView,
pluginLayerClass](mbgl::style::PluginLayer *pluginLayer) {
pluginLayerClass](mln::style::PluginLayer *pluginLayer) {
// NSLog(@"Creating Plugin Layer: %@", layerClass);
MLNPluginLayer *layer = [[layerClass alloc] init];
if (!weakMapView.pluginLayers) {
@@ -7591,25 +7591,25 @@ static void *windowScreenContext = &windowScreenContext;
pluginLayer->_platformReference = (__bridge void *)layer;
MLNPluginLayerCapabilities *capabilities = [pluginLayerClass layerCapabilities];
auto pluginLayerImpl = (mbgl::style::PluginLayer::Impl *)pluginLayer->baseImpl.get();
auto pluginLayerImpl = (mln::style::PluginLayer::Impl *)pluginLayer->baseImpl.get();
auto &pm = pluginLayerImpl->_propertyManager;
for (MLNPluginLayerProperty *property in capabilities.layerProperties) {
mbgl::style::PluginLayerProperty *p = new mbgl::style::PluginLayerProperty();
mln::style::PluginLayerProperty *p = new mln::style::PluginLayerProperty();
switch (property.propertyType) {
case MLNPluginLayerPropertyTypeSingleFloat:
p->_propertyType = mbgl::style::PluginLayerProperty::PropertyType::SingleFloat;
p->_propertyType = mln::style::PluginLayerProperty::PropertyType::SingleFloat;
p->_defaultSingleFloatValue = property.singleFloatDefaultValue;
break;
case MLNPluginLayerPropertyTypeColor: {
p->_propertyType = mbgl::style::PluginLayerProperty::PropertyType::Color;
p->_propertyType = mln::style::PluginLayerProperty::PropertyType::Color;
if (property.colorDefaultValue) {
CGFloat r, g, b, a;
[property.colorDefaultValue getRed:&r green:&g blue:&b alpha:&a];
p->_defaultColorValue = mbgl::Color(r, g, b, a);
p->_defaultColorValue = mln::Color(r, g, b, a);
}
} break;
default:
p->_propertyType = mbgl::style::PluginLayerProperty::PropertyType::Unknown;
p->_propertyType = mln::style::PluginLayerProperty::PropertyType::Unknown;
break;
}
p->_propertyName = [property.propertyName UTF8String];
@@ -7617,10 +7617,10 @@ static void *windowScreenContext = &windowScreenContext;
}
// Set the render function
auto renderFunction = [weakPlugInLayer, weakMapView](mbgl::PaintParameters &paintParameters) {
auto renderFunction = [weakPlugInLayer, weakMapView](mln::PaintParameters &paintParameters) {
#if MLN_RENDER_BACKEND_METAL
const mbgl::mtl::RenderPass &renderPass =
static_cast<mbgl::mtl::RenderPass &>(*paintParameters.renderPass);
const mln::mtl::RenderPass &renderPass =
static_cast<mln::mtl::RenderPass &>(*paintParameters.renderPass);
id encoder = (__bridge id)renderPass.getMetalEncoder().get();
#else
id encoder = nil;
@@ -7628,14 +7628,14 @@ static void *windowScreenContext = &windowScreenContext;
MLNMapView *strongMapView = weakMapView;
const mbgl::TransformState &state = paintParameters.state;
const mln::TransformState &state = paintParameters.state;
MLNPluginLayerDrawingContext drawingContext;
drawingContext.size = CGSizeMake(state.getSize().width, state.getSize().height);
drawingContext.centerCoordinate =
CLLocationCoordinate2DMake(state.getLatLng().latitude(), state.getLatLng().longitude());
drawingContext.zoomLevel = state.getZoom();
drawingContext.direction = mbgl::util::rad2deg(-state.getBearing());
drawingContext.direction = mln::util::rad2deg(-state.getBearing());
drawingContext.pitch = state.getPitch();
drawingContext.fieldOfView = state.getFieldOfView();
drawingContext.projectionMatrix = MLNMatrix4Make(paintParameters.transformParams.projMatrix);
@@ -7650,7 +7650,7 @@ static void *windowScreenContext = &windowScreenContext;
};
// Set the lambdas
// auto pluginLayerImpl = (mbgl::style::PluginLayer::Impl *)pluginLayer->baseImpl.get();
// auto pluginLayerImpl = (mln::style::PluginLayer::Impl *)pluginLayer->baseImpl.get();
pluginLayerImpl->setRenderFunction(renderFunction);
// Set the update properties function