Files
MapLibreParticleLab/platform/darwin/src/NSCompoundPredicate+MGLAdditions.mm
Fabian Guerra Soto c8fbcfd322 [ios, macos] Logging. (#13235)
* [ios, macos] Update the logging subsystem to platform agnostic.

* [ios, macos] Add coordinate to string function.

* [ios, macos] Add BOOL to string function.

* [ios, macos] Add tracing logs.

* [ios, macos] Add tracing logs to generated style classes.

* [ios, macos] Split logging categories accordingly to MGLLoggingLevel.

* [ios, macos] Log network requests.

* [ios, macos] Migrate NSAssert to MGLAssert.

* [ios, macos] Include MGLLoggingConfiguration to filesource-files.txt.

* [ios, macos] Fix logger string specifier for the line parameter.

* [ios, macos] Add logs to shapes classes.

* [ios, macos] Add logs to offline classes.

* [ios, macos] Add logs to annotation classes.

* [ios, macos] Add logs to foundation classes.

* [ios, macos] Fix snapshotter size logging.

* [macos] Add logs to map view.

* [ios, macos] Fix string from boolean prefix, add custom function for NSCAssert.

* Log size test

* [ios, macos] Add logging conditional compilation flag.

* [ios, macos] Rename function NSStringFromMGLTransition to MGLStringFromMGLTransition.

* [ios, macos] Remove verbose logging for release builds.

* [ios, macos] Rename NSStringFromCLLocationCoordinate2D to MGLStringFromCLLocationCoordinate2D.

* [ios, macos] Clean unnecesary blank lines in MGLLight.mm set methods.

* [ios, macos] Fix logging grammar, format, function names.

* [ios, macos] Remove compilation flag, rename flags.
2018-11-14 15:42:18 -08:00

51 lines
1.5 KiB
Plaintext

#import "NSCompoundPredicate+MGLAdditions.h"
#import "MGLStyleValue_Private.h"
#import "NSPredicate+MGLPrivateAdditions.h"
#import "NSExpression+MGLPrivateAdditions.h"
#import "MGLLoggingConfiguration_Private.h"
#include <mbgl/style/conversion/property_value.hpp>
@implementation NSCompoundPredicate (MGLAdditions)
- (std::vector<mbgl::style::Filter>)mgl_subfilters
{
std::vector<mbgl::style::Filter>filters;
for (NSPredicate *predicate in self.subpredicates) {
filters.push_back(predicate.mgl_filter);
}
return filters;
}
@end
@implementation NSCompoundPredicate (MGLExpressionAdditions)
- (id)mgl_jsonExpressionObject {
switch (self.compoundPredicateType) {
case NSNotPredicateType: {
MGLAssert(self.subpredicates.count <= 1, @"NOT predicate cannot have multiple subpredicates.");
NSPredicate *subpredicate = self.subpredicates.firstObject;
return @[@"!", subpredicate.mgl_jsonExpressionObject];
}
case NSAndPredicateType: {
NSArray *subarrays = [self.subpredicates valueForKeyPath:@"mgl_jsonExpressionObject"];
return [@[@"all"] arrayByAddingObjectsFromArray:subarrays];
}
case NSOrPredicateType: {
NSArray *subarrays = [self.subpredicates valueForKeyPath:@"mgl_jsonExpressionObject"];
return [@[@"any"] arrayByAddingObjectsFromArray:subarrays];
}
}
[NSException raise:@"Compound predicate type not handled"
format:@""];
return nil;
}
@end