Kml, kmz és geojson import és térképi megjelnítésük.
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:terepi_seged/enums/note_type.dart';
|
||||
import 'package:terepi_seged/models/imported_layer_meta.dart';
|
||||
import 'package:terepi_seged/models/note_item.dart';
|
||||
import 'package:terepi_seged/models/note_item_audio.dart';
|
||||
import 'package:terepi_seged/models/note_item_photo.dart';
|
||||
@@ -190,6 +191,22 @@ class AppDatabase {
|
||||
'ON pending_points(sync_status)',
|
||||
);
|
||||
|
||||
await db.execute('''
|
||||
CREATE TABLE IF NOT EXISTS imported_layers (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
source_type TEXT NOT NULL,
|
||||
local_path TEXT NOT NULL,
|
||||
storage_path TEXT,
|
||||
is_visible INTEGER NOT NULL DEFAULT 1,
|
||||
project_id INTEGER,
|
||||
imported_at TEXT NOT NULL,
|
||||
synced_at TEXT
|
||||
)
|
||||
''');
|
||||
await db.execute(
|
||||
'CREATE INDEX idx_imp_layers_project ON imported_layers(project_id)');
|
||||
|
||||
// Alap projekt létrehozása az első indításhoz
|
||||
final now = DateTime.now().toIso8601String();
|
||||
await db.insert('projects', {
|
||||
@@ -559,4 +576,33 @@ class AppDatabase {
|
||||
);
|
||||
return rows.map(NoteItemAudio.fromMap).toList();
|
||||
}
|
||||
|
||||
// ----------- Layer meta adatok
|
||||
Future<void> insertImportedLayer(ImportedLayerMeta meta) async {
|
||||
final db = await database;
|
||||
await db.insert('imported_layers', meta.toMap(),
|
||||
conflictAlgorithm: ConflictAlgorithm.replace);
|
||||
}
|
||||
|
||||
Future<void> updateImportedLayer(ImportedLayerMeta meta) async {
|
||||
final db = await database;
|
||||
await db.update('imported_layers', meta.toMap(),
|
||||
where: 'id = ?', whereArgs: [meta.id]);
|
||||
}
|
||||
|
||||
Future<void> deleteImportedLayer(String id) async {
|
||||
final db = await database;
|
||||
await db.delete('imported_layers', where: 'id = ?', whereArgs: [id]);
|
||||
}
|
||||
|
||||
Future<List<ImportedLayerMeta>> listImportedLayers({int? projectId}) async {
|
||||
final db = await database;
|
||||
final rows = await db.query(
|
||||
'imported_layers',
|
||||
where: projectId != null ? 'project_id = ?' : null,
|
||||
whereArgs: projectId != null ? [projectId] : null,
|
||||
orderBy: 'imported_at DESC',
|
||||
);
|
||||
return rows.map(ImportedLayerMeta.fromMap).toList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user