Files
rogaining_app/lib/models/check_points.dart
2022-02-08 16:16:13 +05:30

77 lines
1.4 KiB
Dart

import 'dart:ffi';
enum Entity {
gathering,
siteSeen,
boating,
diving
}
class CheckPoint{
int? id;
double? lat;
double? long;
Entity? entitty;
String? image1;
String? image2;
String? image3;
String? image4;
String? title;
CheckPoint.fromId(int id) {
// TODO: implement
this.id = id;
}
CheckPoint({this.id, this.lat, this.long, this.entitty, this.image1, this.image2, this.image3, this.image4, this.title});
factory CheckPoint.fromMap(Map<String, dynamic> json) => CheckPoint(
id: json['id'],
lat: json['lat'],
long: json['long'],
entitty: json['entity'],
image1: json['image1'],
image2: json['image2'],
image3: json['image3'],
image4: json['image4'],
title: json['note'],
);
Map<String, dynamic> toMap() {
return {
'id': id,
'lat': lat,
'long': long,
'entity': entitty,
'image1': image1,
'image2': image2,
'image3': image3,
'image4': image4,
'note': title,
};
}
Map<String, dynamic> toFeatureMap() {
return {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
long,
lat
]
},
"properties": {
'entity': entitty.toString(),
'image1': image1,
'image2': image2,
'image3': image3,
'image4': image4,
'note': title,
}
};
}
}