Files
smart-city-digital-twin-mar…/smart-app-city/frontend/node_modules/react-native-maps/ios/AirMaps/AIRMapWMSTile.m
Eric FELIXINE e30ae8ed09 feat(smart-app): implement complete mobile app MVP
- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
2026-06-01 18:00:35 -04:00

117 lines
4.1 KiB
Objective-C

//
// AIRMapWMSTile.m
// AirMaps
//
// Created by nizam on 10/28/18.
// Copyright © 2018. All rights reserved.
//
#import "AIRMapWMSTile.h"
#import <React/UIView+React.h>
@implementation AIRMapWMSTile
- (void)createTileOverlayAndRendererIfPossible
{
if (!_urlTemplateSet) return;
if (_tileCachePathSet || _maximumNativeZSet) {
NSLog(@"tileCache new overlay dir %@", self.tileCachePath);
NSLog(@"tileCache %d", _tileCachePathSet);
NSLog(@"tileCache %d", _maximumNativeZSet);
self.tileOverlay = [[AIRMapWMSTileCachedOverlay alloc] initWithURLTemplate:self.urlTemplate];
_cachedOverlayCreated = YES;
if (_tileCachePathSet) {
NSURL *urlPath = [NSURL URLWithString:[self.tileCachePath stringByAppendingString:@"/"]];
if (urlPath.fileURL) {
self.tileOverlay.tileCachePath = urlPath;
} else {
NSURL *filePath = [NSURL fileURLWithPath:self.tileCachePath isDirectory:YES];
self.tileOverlay.tileCachePath = filePath;
}
if (_tileCacheMaxAgeSet) {
self.tileOverlay.tileCacheMaxAge = self.tileCacheMaxAge;
}
}
} else {
NSLog(@"tileCache normal overlay");
self.tileOverlay = [[AIRMapWMSTileOverlay alloc] initWithURLTemplate:self.urlTemplate];
_cachedOverlayCreated = NO;
}
[self updateProperties];
self.renderer = [[MKTileOverlayRenderer alloc] initWithTileOverlay:self.tileOverlay];
if (_opacitySet) {
self.renderer.alpha = self.opacity;
}
}
@end
@implementation AIRMapWMSTileOverlay
- (id)initWithURLTemplate:(NSString *)URLTemplate
{
self = [super initWithURLTemplate:URLTemplate];
return self;
}
- (NSURL *)URLForTilePath:(MKTileOverlayPath)path
{
return [AIRMapWMSTileHelper URLForTilePath:path withURLTemplate:self.URLTemplate withTileSize:self.tileSize.width];
}
@end
@implementation AIRMapWMSTileCachedOverlay
- (id)initWithURLTemplate:(NSString *)URLTemplate
{
self = [super initWithURLTemplate:URLTemplate];
return self;
}
- (NSURL *)URLForTilePath:(MKTileOverlayPath)path
{
return [AIRMapWMSTileHelper URLForTilePath:path withURLTemplate:self.URLTemplate withTileSize:self.tileSize.width];
}
@end
@implementation AIRMapWMSTileHelper
+ (NSURL *)URLForTilePath:(MKTileOverlayPath)path withURLTemplate:(NSString *)URLTemplate withTileSize:(NSInteger)tileSize
{
NSArray *bb = [self getBoundBox:path.x yAxis:path.y zoom:path.z];
NSMutableString *url = [URLTemplate mutableCopy];
[url replaceOccurrencesOfString: @"{minX}" withString:[NSString stringWithFormat:@"%@", bb[0]] options:0 range:NSMakeRange(0, url.length)];
[url replaceOccurrencesOfString: @"{minY}" withString:[NSString stringWithFormat:@"%@", bb[1]] options:0 range:NSMakeRange(0, url.length)];
[url replaceOccurrencesOfString: @"{maxX}" withString:[NSString stringWithFormat:@"%@", bb[2]] options:0 range:NSMakeRange(0, url.length)];
[url replaceOccurrencesOfString: @"{maxY}" withString:[NSString stringWithFormat:@"%@", bb[3]] options:0 range:NSMakeRange(0, url.length)];
[url replaceOccurrencesOfString: @"{width}" withString:[NSString stringWithFormat:@"%d", (int)tileSize] options:0 range:NSMakeRange(0, url.length)];
[url replaceOccurrencesOfString: @"{height}" withString:[NSString stringWithFormat:@"%d", (int)tileSize] options:0 range:NSMakeRange(0, url.length)];
return [NSURL URLWithString:url];
}
+ (NSArray *)getBoundBox:(NSInteger)x yAxis:(NSInteger)y zoom:(NSInteger)zoom
{
double MapX = -20037508.34789244;
double MapY = 20037508.34789244;
double FULL = 20037508.34789244 * 2;
double tile = FULL / pow(2.0, (double)zoom);
NSArray *result =[[NSArray alloc] initWithObjects:
[NSNumber numberWithDouble:MapX + (double)x * tile],
[NSNumber numberWithDouble:MapY - (double)(y + 1) * tile],
[NSNumber numberWithDouble:MapX + (double)(x + 1) * tile],
[NSNumber numberWithDouble:MapY - (double)y * tile],
nil];
return result;
}
@end