mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-06-02 21:21:35 +02:00
UX basically working
This commit is contained in:
@@ -11,6 +11,27 @@ class OsmCameraNode {
|
||||
required this.tags,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'lat': coord.latitude,
|
||||
'lon': coord.longitude,
|
||||
'tags': tags,
|
||||
};
|
||||
|
||||
factory OsmCameraNode.fromJson(Map<String, dynamic> json) {
|
||||
final tags = <String, String>{};
|
||||
if (json['tags'] != null) {
|
||||
(json['tags'] as Map<String, dynamic>).forEach((k, v) {
|
||||
tags[k.toString()] = v.toString();
|
||||
});
|
||||
}
|
||||
return OsmCameraNode(
|
||||
id: json['id'] is int ? json['id'] as int : int.tryParse(json['id'].toString()) ?? 0,
|
||||
coord: LatLng((json['lat'] as num).toDouble(), (json['lon'] as num).toDouble()),
|
||||
tags: tags,
|
||||
);
|
||||
}
|
||||
|
||||
bool get hasDirection =>
|
||||
tags.containsKey('direction') || tags.containsKey('camera:direction');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user