Floor constructor
Floor({})
Implementation
Floor(
{required this.area,
required this.floorNumber,
required this.beacons,
required this.rooms,
this.landmarks}) {
//list of room keys
List<String> keys = [];
for (var room in rooms) {
keys.add(room.key);
}
//check for duplicate room keys
final duplicateKeys = keys.toSet().toList();
assert(listEquals(duplicateKeys, keys),
'Identical Room keys or on the same floor cannot exist!');
//list of beacon ids
List<String> ids = [];
for (var beacon in beacons) {
ids.add(beacon.id);
}
//check for duplicate beacon ids
final duplicateIds = ids.toSet().toList();
assert(listEquals(duplicateIds, ids),
'Identical Beacon ids or mac adresses on the same floor cannot exist!');
for (var beacon in beacons) {
assert(area.pointInArea(beacon.position),
'All beacons need to be in the Area of the floor');
}
for (var room in rooms) {
for (var roomPoint in room.area.points) {
assert(area.pointInArea(roomPoint),
'All rooms need to be in the Area of the floor');
}
}
if (landmarks != null) {
for (var landmark in landmarks!) {
for (var landmarkPoint in landmark.area.points) {
assert(area.pointInArea(landmarkPoint),
'All landmarks need to be in the Area of the floor');
}
}
}
}