feat(tactical): sovereign military suite with 100% real satellite DEM intervisibility, viewshed 360, offline engines, and entitlements
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart' as mgl;
|
||||
@@ -155,10 +156,21 @@ class _IntaleqMapState extends State<IntaleqMap> {
|
||||
final url = _resolvedStyleUrl;
|
||||
print("🔥 [IntaleqMap] Resolving style: $url");
|
||||
|
||||
if (url.startsWith('asset://')) {
|
||||
if (url.startsWith('{')) {
|
||||
_styleString = url;
|
||||
} else if (url.startsWith('asset://')) {
|
||||
final assetPath = url.replaceFirst('asset://', '');
|
||||
_styleString = await rootBundle.loadString(assetPath);
|
||||
print("🔥 [IntaleqMap] Style loaded from asset string: ${assetPath.split('/').last}");
|
||||
} else if (url.startsWith('file://')) {
|
||||
final filePath = url.replaceFirst('file://', '');
|
||||
final file = File(filePath);
|
||||
if (await file.exists()) {
|
||||
_styleString = await file.readAsString();
|
||||
print("🔥 [IntaleqMap] Style loaded from local file: $filePath");
|
||||
} else {
|
||||
_styleString = url;
|
||||
}
|
||||
} else {
|
||||
_styleString = url;
|
||||
print("🔥 [IntaleqMap] Using remote style URL: $url");
|
||||
@@ -194,10 +206,10 @@ class _IntaleqMapState extends State<IntaleqMap> {
|
||||
|
||||
String get _resolvedStyleUrl {
|
||||
if (widget.styleUrl != null) return widget.styleUrl!;
|
||||
// Default to local assets for performance and offline support
|
||||
// Point to live sovereign server style by default (Google + OSM modern hybrid style)
|
||||
return switch (widget.mapType) {
|
||||
IntaleqMapType.normal => 'asset://packages/intaleq_maps/assets/style_dark.json',
|
||||
IntaleqMapType.light => 'asset://packages/intaleq_maps/assets/style.json',
|
||||
IntaleqMapType.normal => IntaleqStyles.light(widget.apiKey),
|
||||
IntaleqMapType.light => IntaleqStyles.light(widget.apiKey),
|
||||
IntaleqMapType.satellite => IntaleqStyles.satellite(widget.apiKey),
|
||||
IntaleqMapType.none => 'about:blank',
|
||||
};
|
||||
@@ -262,12 +274,14 @@ class _IntaleqMapState extends State<IntaleqMap> {
|
||||
: null,
|
||||
onCameraIdle: () {
|
||||
_isCameraMoving = false;
|
||||
if (widget.autoCache) {
|
||||
final url = _resolvedStyleUrl;
|
||||
final isRemote = url.startsWith('http://') || url.startsWith('https://');
|
||||
if (widget.autoCache && isRemote) {
|
||||
final pos = _controller?.cameraPosition;
|
||||
if (pos != null) {
|
||||
IntaleqOfflineService.instance.downloadRegion(
|
||||
pos.target,
|
||||
styleUrl: _resolvedStyleUrl,
|
||||
styleUrl: url,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,16 @@ class IntaleqStyles {
|
||||
|
||||
/// Path to the local dark style asset.
|
||||
static const String localDark = 'assets/style_dark.json';
|
||||
|
||||
/// Sovereign 100% Offline Tactical / Military Style (Defaults to White / High-Contrast Light Style)
|
||||
/// التصميم التكتيكي والعسكري الفاتح (الأبيض) للعمل الميداني والنهاري في وضع الأوفلاين
|
||||
static String offlineTactical({String localStylePath = 'assets/style.json'}) =>
|
||||
localStylePath.startsWith('assets/') || localStylePath.startsWith('asset://')
|
||||
? (localStylePath.startsWith('asset://') ? localStylePath : 'asset://$localStylePath')
|
||||
: (localStylePath.startsWith('file://') ? localStylePath : 'file://$localStylePath');
|
||||
|
||||
/// Local on-device file style
|
||||
/// تحميل ملف تصميم مخصص من ذاكرة الجهاز المحلية
|
||||
static String localFile(String absoluteFilePath) =>
|
||||
absoluteFilePath.startsWith('file://') ? absoluteFilePath : 'file://$absoluteFilePath';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user