Skip to content

Commit

Permalink
Added Anyline 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Müller committed May 13, 2019
1 parent 09990b4 commit b7b02cd
Show file tree
Hide file tree
Showing 214 changed files with 1,586 additions and 617 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#import "ALUniversalSerialNumberScanViewController.h"
#import "ALVINScanViewController.h"
#import "ALContainerScanViewController.h"
#import "ALVerticalContainerScanViewController.h"

#import "ALOthersExampleManager.h"
#import "ALMeterExampleManager.h"
Expand Down Expand Up @@ -46,13 +47,17 @@ - (void)initExampleData {
image:[UIImage imageNamed:@"vin"]
viewController:[ALVINScanViewController class]];

ALExample *containerScanning = [[ALExample alloc] initWithName:NSLocalizedString(@"Shipping Container", nil)
ALExample *containerScanning = [[ALExample alloc] initWithName:NSLocalizedString(@"Horizontal Shipping Container", nil)
image:[UIImage imageNamed:@"container serial numbers"]
viewController:[ALContainerScanViewController class]];

ALExample *verticalContainerScanning = [[ALExample alloc] initWithName:NSLocalizedString(@"Vertical Shipping Container", nil)
image:[UIImage imageNamed:@"vertical container scanner"]
viewController:[ALVerticalContainerScanViewController class]];

self.sectionNames = @[@"MRO",];
self.examples = @{
self.sectionNames[0] : @[serialNumberScanning,vinScanning,containerScanning,],
self.sectionNames[0] : @[serialNumberScanning,vinScanning,containerScanning,verticalContainerScanning,],
};
}

Expand Down
4 changes: 2 additions & 2 deletions AnylineExamples/Anyline Demo App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>10</string>
<string>10.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>182</string>
<string>183</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ - (void)viewDidLoad {

self.controllerType = ALScanHistoryBadge;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.ocrModuleView];
[self.view sendSubviewToBack:self.ocrModuleView];
[self startListeningForMotion];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ - (void)viewDidLoad {

self.scanView = [[ALScanView alloc] initWithFrame:frame scanViewPlugin:self.bottlecapScanViewPlugin];

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ - (void)viewDidLoad {

self.scanView = [[ALScanView alloc] initWithFrame:frame scanViewPlugin:self.cattleTagScanViewPlugin];

// After setup is complete we add the module to the view of this view controller
//Enable Zoom Gesture
[self.scanView enableZoomPinchGesture:YES];

// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ - (void)viewDidLoad {
[super viewDidLoad];
// Set the background color to black to have a nicer transition
self.view.backgroundColor = [UIColor blackColor];
self.title = @"Shipping Container";
self.title = @"Horizontal Shipping Container";
// Initializing the module. Its a UIView subclass. We set the frame to fill the whole screen
CGRect frame = [[UIScreen mainScreen] applicationFrame];
frame = CGRectMake(frame.origin.x, frame.origin.y + self.navigationController.navigationBar.frame.size.height, frame.size.width, frame.size.height - self.navigationController.navigationBar.frame.size.height);
Expand Down Expand Up @@ -62,7 +62,10 @@ - (void)viewDidLoad {

self.scanView = [[ALScanView alloc] initWithFrame:frame scanViewPlugin:self.containerScanViewPlugin];

// After setup is complete we add the module to the view of this view controller
//Enable Zoom Gesture
[self.scanView enableZoomPinchGesture:YES];

// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

//
// ALContainerScanScanViewController.h
// AnylineExamples
//
// Created by Daniel Albertini on 09.04.18.
//

#import <UIKit/UIKit.h>

#import "ALBaseScanViewController.h"

@interface ALVerticalContainerScanViewController : ALBaseScanViewController

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
//
// ALShippingContainerScanViewController.m
// AnylineExamples
//
// Created by Daniel Albertini on 09.04.18.
//

#import "ALVerticalContainerScanViewController.h"
#import <Anyline/Anyline.h>
#import "ALAppDemoLicenses.h"
#import "ALResultEntry.h"
#import "ALResultViewController.h"

// This is the license key for the examples project used to set up Aynline below
NSString * const kVerticalContainerScannerLicenseKey = kDemoAppLicenseKey;
@interface ALVerticalContainerScanViewController ()<ALOCRScanPluginDelegate, ALInfoDelegate>

// The Anyline plugin used for OCR
@property (nonatomic, strong) ALOCRScanViewPlugin *containerScanViewPlugin;
@property (nonatomic, strong) ALOCRScanPlugin *containerScanPlugin;
@property (nullable, nonatomic, strong) ALScanView *scanView;

@end

@implementation ALVerticalContainerScanViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Set the background color to black to have a nicer transition
self.view.backgroundColor = [UIColor blackColor];
self.title = @"Vertical Shipping Container";
// Initializing the module. Its a UIView subclass. We set the frame to fill the whole screen
CGRect frame = [[UIScreen mainScreen] applicationFrame];
frame = CGRectMake(frame.origin.x, frame.origin.y + self.navigationController.navigationBar.frame.size.height, frame.size.width, frame.size.height - self.navigationController.navigationBar.frame.size.height);

ALOCRConfig *config = [[ALOCRConfig alloc] init];

config.scanMode = ALAuto;

NSString *containerAny = [[NSBundle mainBundle] pathForResource:@"USNr" ofType:@"any"];
[config setLanguages:@[containerAny] error:nil];

NSString *cmdFile = [[NSBundle mainBundle] pathForResource:@"container_scanner_vertical" ofType:@"ale"];
config.customCmdFilePath = cmdFile;

NSError *error = nil;

self.containerScanPlugin = [[ALOCRScanPlugin alloc] initWithPluginID:@"ANYLINE_OCR"
licenseKey:kVerticalContainerScannerLicenseKey
delegate:self
ocrConfig:config
error:&error];
NSAssert(self.containerScanPlugin, @"Setup Error: %@", error.debugDescription);
[self.containerScanPlugin addInfoDelegate:self];

NSString *confPath = [[NSBundle mainBundle] pathForResource:@"vertical_container_scanner_capture_config" ofType:@"json"];
ALScanViewPluginConfig *scanViewPluginConfig = [ALScanViewPluginConfig configurationFromJsonFilePath:confPath];

self.containerScanViewPlugin = [[ALOCRScanViewPlugin alloc] initWithScanPlugin:self.containerScanPlugin
scanViewPluginConfig:scanViewPluginConfig];
NSAssert(self.containerScanViewPlugin, @"Setup Error: %@", error.debugDescription);

self.scanView = [[ALScanView alloc] initWithFrame:frame scanViewPlugin:self.containerScanViewPlugin];

//Enable Zoom Gesture
[self.scanView enableZoomPinchGesture:YES];

// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

//Start Camera:
[self.scanView startCamera];
[self startListeningForMotion];

//Enable Zoom Gesture for the scanView
[self.scanView enableZoomPinchGesture:YES];

self.controllerType = ALScanHistoryContainer;
}

/*
This method will be called once the view controller and its subviews have appeared on screen
*/
-(void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];

// We use this subroutine to start Anyline. The reason it has its own subroutine is
// so that we can later use it to restart the scanning process.
[self startAnyline];
}

/*
Cancel scanning to allow the module to clean up
*/
- (void)viewWillDisappear:(BOOL)animated {
[self.containerScanViewPlugin stopAndReturnError:nil];
}

/*
This method is used to tell Anyline to start scanning. It gets called in
viewDidAppear to start scanning the moment the view appears. Once a result
is found scanning will stop automatically (you can change this behaviour
with cancelOnResult:). When the user dismisses self.identificationView this
method will get called again.
*/
- (void)startAnyline {
NSError *error;
BOOL success = [self.containerScanViewPlugin startAndReturnError:&error];
if( !success ) {
// Something went wrong. The error object contains the error description
NSAssert(success, @"Start Scanning Error: %@", error.debugDescription);
}
}


#pragma mark -- AnylineOCRModuleDelegate

/*
This is the main delegate method Anyline uses to report its results
*/
- (void)anylineOCRScanPlugin:(ALOCRScanPlugin *)anylineOCRScanPlugin
didFindResult:(ALOCRResult *)result {
// We are done. Cancel scanning
[self anylineDidFindResult:result.result barcodeResult:@"" image:result.image scanPlugin:anylineOCRScanPlugin viewPlugin:self.containerScanViewPlugin completion:^{
//Display the result
NSMutableArray <ALResultEntry*> *resultData = [[NSMutableArray alloc] init];
[resultData addObject:[[ALResultEntry alloc] initWithTitle:@"Shipping Container Number" value:result.result]];

ALResultViewController *vc = [[ALResultViewController alloc] initWithResultData:resultData image:result.image];
[self.navigationController pushViewController:vc animated:YES];
}];
}

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
NSError *error = nil;
BOOL success = [self.containerScanViewPlugin startAndReturnError:&error];

NSAssert(success, @"We failed starting: %@",error.debugDescription);
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"viewPlugin" : {
"cutoutConfig" : {
"style": "rect",
"maxWidthPercent": "10%",
"alignment": "top_half",
"ratioFromSize": {
"width": 9,
"height": 62
},
"outerColor": "000000",
"outerAlpha": 0.3,
"strokeWidth": 1,
"strokeColor": "FFFFFF",
"cornerRadius": 2,
"feedbackStrokeColor": "0099FF",
},
"scanFeedback" : {
"animation": "traverse_multi",
"animationDuration" : 250,
"style": "contour_rect",
"strokeWidth": 2,
"strokeColor": "0099FF",
"beepOnResult": true,
"vibrateOnResult": true,
"blinkAnimationOnResult": true
},
"cancelOnResult" : true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ - (void)viewDidLoad {
self.controllerType = ALScanHistoryDocument;
self.documentScanViewPlugin.translatesAutoresizingMaskIntoConstraints = NO;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (void)viewDidLoad {

self.controllerType = ALScanHistoryDrivingLicense;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ - (void)viewDidLoad {

self.controllerType = ALScanHistoryGermanIDFront;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ - (void)viewDidLoad {

self.controllerType = ALScanHistoryHashtag;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.ocrModuleView];


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ - (void)viewDidLoad {

self.scanView = [[ALScanView alloc] initWithFrame:frame scanViewPlugin:self.ibanScanViewPlugin];

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ - (void)viewDidLoad {

self.scanView = [[ALScanView alloc] initWithFrame:frame scanViewPlugin:self.isbnScanViewPlugin];

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ - (void)viewDidLoad {
[self.ocrModuleView enableReporting:[NSUserDefaults AL_reportingEnabled]];
self.controllerType = ALScanHistoryLicensePlatesAT;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.ocrModuleView];
[self.view sendSubviewToBack:self.ocrModuleView];
[self startListeningForMotion];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ - (void)viewDidLoad {
[self.ocrModuleView enableReporting:[NSUserDefaults AL_reportingEnabled]];
self.controllerType = ALScanHistoryLicensePlatesDE;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.ocrModuleView];
[self.view sendSubviewToBack:self.ocrModuleView];
[self startListeningForMotion];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ - (void)viewDidLoad {

self.controllerType = ALScanHistoryLicensePlates;

// After setup is complete we add the module to the view of this view controller
// After setup is complete we add the scanView to the view of this view controller
[self.view addSubview:self.scanView];
[self.view sendSubviewToBack:self.scanView];

Expand Down
Loading

0 comments on commit b7b02cd

Please sign in to comment.