From 775d1848dcaa6c618d4062c5948cf51f66934d9f Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Mon, 31 Oct 2011 05:45:35 -0400 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- Classes/GLGestureRecognizer.m | 20 ++++++++++---------- Classes/GestureView.m | 18 +++++++++--------- Classes/GesturesAppDelegate.m | 6 +++--- Gestures.json | 4 ++-- main.m | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Classes/GLGestureRecognizer.m b/Classes/GLGestureRecognizer.m index 16811d4..625efb7 100644 --- a/Classes/GLGestureRecognizer.m +++ b/Classes/GLGestureRecognizer.m @@ -3,11 +3,11 @@ // Gestures // // Created by Adam Preble on 4/28/09. adam@giraffelab.com -// +// // Largely an implementation of the $1 Unistroke Recognizer: // http://depts.washington.edu/aimgroup/proj/dollar/ // Jacob O. Wobbrock, Andrew D. Wilson, Yang Li -// +// #import "GLGestureRecognizer.h" #define kSamplePoints (16) @@ -72,18 +72,18 @@ - (NSString *)findBestMatchCenter:(CGPoint*)outCenter angle:(float*)outRadians s const int samplePoints = kSamplePoints; CGPoint samples[samplePoints]; int c = [[self touchPoints] count]; - + // Load up the samples. We use a very simplistic method for this; the JavaScript version is much more sophisticated. for (i = 0; i < samplePoints; i++) { samples[i] = [[[self touchPoints] objectAtIndex:MAX(0, (c-1)*i/(samplePoints-1))] CGPointValue]; } - + CGPoint center = Centroid(samples, samplePoints); if (outCenter) *outCenter = center; Translate(samples, samplePoints, -center.x, -center.y); // Recenter - + // Now rotate the path around 0,0, since the points have been transformed to that point. // Find the angle of the first point: CGPoint firstPoint = samples[0]; @@ -92,7 +92,7 @@ - (NSString *)findBestMatchCenter:(CGPoint*)outCenter angle:(float*)outRadians s if (outRadians) *outRadians = firstPointAngle; Rotate(samples, samplePoints, -firstPointAngle); - + CGPoint lowerLeft, upperRight; // For finding the boundaries of the gesture for (i = 0; i < samplePoints; i++) { @@ -108,10 +108,10 @@ - (NSString *)findBestMatchCenter:(CGPoint*)outCenter angle:(float*)outRadians s } float scale = 2.0f/MAX(upperRight.x - lowerLeft.x, upperRight.y - lowerLeft.y); Scale(samples, samplePoints, scale, scale); - + center = Centroid(samples, samplePoints); Translate(samples, samplePoints, -center.x, -center.y); // Recenter - + // Now we can compare the samples against our known samples: NSString *bestTemplateName = nil; float best = INFINITY; @@ -135,14 +135,14 @@ - (NSString *)findBestMatchCenter:(CGPoint*)outCenter angle:(float*)outRadians s NSLog(@"Best: %@ with %0.2f", bestTemplateName, best); if (outScore) *outScore = best; - + self.resampledPoints = [NSMutableArray arrayWithCapacity:samplePoints]; for (i = 0; i < samplePoints; i++) { CGPoint pt = samples[i]; [resampledPoints addObject:[NSValue valueWithCGPoint:pt]]; } - + // Serialize the samples as JSON: #ifndef NDEBUG NSMutableString *string = [NSMutableString stringWithString:@"\"template_name\": [ "]; diff --git a/Classes/GestureView.m b/Classes/GestureView.m index 9a0871a..905c1e3 100644 --- a/Classes/GestureView.m +++ b/Classes/GestureView.m @@ -35,26 +35,26 @@ - (void)awakeFromNib recognizer = [[GLGestureRecognizer alloc] init]; NSData *jsonData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Gestures" ofType:@"json"]]; [recognizer loadTemplatesFromJsonData:jsonData]; - + self.caption = @""; } -- (void)drawRect:(CGRect)rect +- (void)drawRect:(CGRect)rect { // Drawing code CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetRGBFillColor(ctx, 0, 0, 0, 1); CGContextSetRGBStrokeColor(ctx, 1, 1, 1, 1); CGContextFillRect(ctx, rect); - + CGContextSetRGBFillColor(ctx, 1, 1, 1, 1); - CGContextSetTextDrawingMode(ctx, kCGTextFillStroke); + CGContextSetTextDrawingMode(ctx, kCGTextFillStroke); CGContextSelectFont(ctx, "Helvetica", 20, kCGEncodingMacRoman); - CGContextSetTextMatrix(ctx, CGAffineTransformMakeScale(1, -1)); + CGContextSetTextMatrix(ctx, CGAffineTransformMakeScale(1, -1)); CGContextShowTextAtPoint(ctx, 10, 30, [caption UTF8String], [caption length]); - + CGContextSetRGBFillColor(ctx, 0, 0, 0, 1); - + for (NSValue *pointValue in [recognizer touchPoints]) { CGPoint pointInView = [pointValue CGPointValue]; @@ -76,7 +76,7 @@ - (void)drawRect:(CGRect)rect CGContextAddLineToPoint(ctx, pointInView.x, pointInView.y); } CGContextStrokePath(ctx); - + CGContextSetRGBFillColor(ctx, 1, 0, 0, 1); CGContextFillRect(ctx, CGRectMake(center.x, center.y, 4.0f, 4.0f)); } @@ -101,7 +101,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [recognizer addTouches:touches fromView:self]; - + [self processGestureData]; [self setNeedsDisplay]; } diff --git a/Classes/GesturesAppDelegate.m b/Classes/GesturesAppDelegate.m index b39d250..c375497 100644 --- a/Classes/GesturesAppDelegate.m +++ b/Classes/GesturesAppDelegate.m @@ -15,9 +15,9 @@ @implementation GesturesAppDelegate @synthesize viewController; -- (void)applicationDidFinishLaunching:(UIApplication *)application { - - // Override point for customization after app launch +- (void)applicationDidFinishLaunching:(UIApplication *)application { + + // Override point for customization after app launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; } diff --git a/Gestures.json b/Gestures.json index 5d8fbf7..36c6ec8 100644 --- a/Gestures.json +++ b/Gestures.json @@ -1,8 +1,8 @@ { "circle": [ - [0.80, -0.00], [0.80, 0.15], [0.46, 0.61], [0.08, 0.81], [-0.31, 0.82], [-0.84, 0.56], [-1.15, 0.15], [-1.16, -0.15], [-0.92, -0.44], [-0.59, -0.63], [-0.17, -0.64], [0.21, -0.60], [0.43, -0.45], [0.71, -0.20], [0.84, -0.01], [0.83, 0.03], + [0.80, -0.00], [0.80, 0.15], [0.46, 0.61], [0.08, 0.81], [-0.31, 0.82], [-0.84, 0.56], [-1.15, 0.15], [-1.16, -0.15], [-0.92, -0.44], [-0.59, -0.63], [-0.17, -0.64], [0.21, -0.60], [0.43, -0.45], [0.71, -0.20], [0.84, -0.01], [0.83, 0.03], ], "line": [ - [1.06, -0.00], [0.98, -0.00], [0.71, -0.01], [0.61, -0.01], [0.57, -0.01], [0.50, -0.01], [0.30, -0.02], [0.16, -0.02], [0.02, -0.02], [-0.25, -0.03], [-0.41, -0.00], [-0.59, 0.01], [-0.86, 0.03], [-0.91, 0.03], [-0.93, 0.03], [-0.94, 0.03], + [1.06, -0.00], [0.98, -0.00], [0.71, -0.01], [0.61, -0.01], [0.57, -0.01], [0.50, -0.01], [0.30, -0.02], [0.16, -0.02], [0.02, -0.02], [-0.25, -0.03], [-0.41, -0.00], [-0.59, 0.01], [-0.86, 0.03], [-0.91, 0.03], [-0.93, 0.03], [-0.94, 0.03], ], } \ No newline at end of file diff --git a/main.m b/main.m index 3c4c357..f2d39fd 100644 --- a/main.m +++ b/main.m @@ -9,7 +9,7 @@ #import int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release];