Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(NSArray *)geofencesForLocation:(ProximiioLocation *)location {
- NSMutableArray *geofences = [NSMutableArray array];
- NSArray *allGeofences = [[ProximiioResourceManager sharedManager] allGeofences];
- ProximiioFloor *currentFloor = [[ProximiioLocationManager sharedManager] currentFloor];
- int level = currentFloor.level.intValue;
- NSLog(@"curent level: %d", level);
- for (ProximiioGeofence *geofence in allGeofences) {
- int geofenceLevel = 0;
- if (geofence.department && geofence.department.floor) {
- geofenceLevel = geofence.department.floor.level.intValue;
- }
- if (geofenceLevel == level) {
- if (geofence.isPolygon) {
- if ([location isInsidePolygon:geofence.polygon]) {
- [geofences addObject:geofence];
- }
- } else {
- if ([geofence.area distanceFromLocation:location] <= geofence.radius) {
- [geofences addObject:geofence];
- }
- }
- }
- }
- return geofences;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement