NavData checks implemented, SHOULD be working
This commit is contained in:
parent
73734f35fc
commit
0504483b00
@ -2,38 +2,4 @@
|
|||||||
<Bucket
|
<Bucket
|
||||||
type = "0"
|
type = "0"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
<Breakpoints>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "FMC Planner 2/ViewController.m"
|
|
||||||
timestampString = "482309570.816347"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "31"
|
|
||||||
endingLineNumber = "31"
|
|
||||||
landmarkName = "-viewDidLoad"
|
|
||||||
landmarkType = "5">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
<BreakpointProxy
|
|
||||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
|
||||||
<BreakpointContent
|
|
||||||
shouldBeEnabled = "No"
|
|
||||||
ignoreCount = "0"
|
|
||||||
continueAfterRunningActions = "No"
|
|
||||||
filePath = "FMC Planner 2/ViewController.m"
|
|
||||||
timestampString = "482309584.090983"
|
|
||||||
startingColumnNumber = "9223372036854775807"
|
|
||||||
endingColumnNumber = "9223372036854775807"
|
|
||||||
startingLineNumber = "26"
|
|
||||||
endingLineNumber = "26"
|
|
||||||
landmarkName = "-viewDidLoad"
|
|
||||||
landmarkType = "5">
|
|
||||||
</BreakpointContent>
|
|
||||||
</BreakpointProxy>
|
|
||||||
</Breakpoints>
|
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
|||||||
@ -21,6 +21,10 @@
|
|||||||
#pragma mark - Search for elements in normal route entry
|
#pragma mark - Search for elements in normal route entry
|
||||||
|
|
||||||
- (NSArray *)findWaypoint:(NSString *)waypoint;
|
- (NSArray *)findWaypoint:(NSString *)waypoint;
|
||||||
|
- (NSArray *)findWaypoint:(NSString *)waypoint onAirway:(NSString *)airway;
|
||||||
- (NSArray *)findAirway:(NSString *)airway;
|
- (NSArray *)findAirway:(NSString *)airway;
|
||||||
|
- (NSArray *)findCrosspointBetween:(NSString *)airwayOne
|
||||||
|
and:(NSString *)airwayTwo
|
||||||
|
withStart:(NSString *)waypoint;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@ -14,7 +14,7 @@ NSString *const Airways = @"NAVDATA/awys.txt";
|
|||||||
NSString *const Intersections = @"NAVDATA/ints.txt";
|
NSString *const Intersections = @"NAVDATA/ints.txt";
|
||||||
NSString *const Navaids = @"NAVDATA/navs.txt";
|
NSString *const Navaids = @"NAVDATA/navs.txt";
|
||||||
|
|
||||||
- (id)init
|
- (instancetype)init
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
self.parserReady = false;
|
self.parserReady = false;
|
||||||
@ -28,20 +28,17 @@ NSString *const Navaids = @"NAVDATA/navs.txt";
|
|||||||
for (NSString *str in temp) {
|
for (NSString *str in temp) {
|
||||||
if (str.length > 0 &&
|
if (str.length > 0 &&
|
||||||
![[str substringToIndex:1] isEqualToString:@";"]) {
|
![[str substringToIndex:1] isEqualToString:@";"]) {
|
||||||
if ([self.navaids objectForKey:[str substringToIndex:5]] != nil) {
|
if ((self.navaids)[[str substringToIndex:5]] != nil) {
|
||||||
// Item exists, make array and set that.
|
// Item exists, make array and set that.
|
||||||
NSMutableArray *temp2 = [[NSMutableArray alloc] init];
|
NSMutableArray *temp2 = [[NSMutableArray alloc] init];
|
||||||
[temp2 addObject:[str substringFromIndex:10]];
|
[temp2 addObject:[str substringFromIndex:10]];
|
||||||
if ([[self.navaids objectForKey:[str substringToIndex:5]]
|
if ([(self.navaids)[[str substringToIndex:5]]
|
||||||
isKindOfClass:[NSArray class]]) {
|
isKindOfClass:[NSArray class]]) {
|
||||||
[temp2 addObjectsFromArray:
|
[temp2 addObjectsFromArray:(self.navaids)[
|
||||||
[self.navaids
|
[str substringToIndex:5]]];
|
||||||
objectForKey:[str substringToIndex:5]]];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[temp2
|
[temp2 addObject:(self.navaids)[[str substringToIndex:5]]];
|
||||||
addObject:[self.navaids
|
|
||||||
objectForKey:[str substringToIndex:5]]];
|
|
||||||
}
|
}
|
||||||
[self.navaids setValue:temp2 forKey:[str substringToIndex:5]];
|
[self.navaids setValue:temp2 forKey:[str substringToIndex:5]];
|
||||||
}
|
}
|
||||||
@ -62,21 +59,18 @@ NSString *const Navaids = @"NAVDATA/navs.txt";
|
|||||||
for (NSString *str in temp) {
|
for (NSString *str in temp) {
|
||||||
if (str.length > 0 &&
|
if (str.length > 0 &&
|
||||||
![[str substringToIndex:1] isEqualToString:@";"]) {
|
![[str substringToIndex:1] isEqualToString:@";"]) {
|
||||||
if ([self.intersections objectForKey:[str substringToIndex:5]] !=
|
if ((self.intersections)[[str substringToIndex:5]] != nil) {
|
||||||
nil) {
|
|
||||||
// Item exists, make array and set that.
|
// Item exists, make array and set that.
|
||||||
NSMutableArray *temp2 = [[NSMutableArray alloc] init];
|
NSMutableArray *temp2 = [[NSMutableArray alloc] init];
|
||||||
[temp2 addObject:[str substringFromIndex:10]];
|
[temp2 addObject:[str substringFromIndex:10]];
|
||||||
if ([[self.intersections objectForKey:[str substringToIndex:5]]
|
if ([(self.intersections)[[str substringToIndex:5]]
|
||||||
isKindOfClass:[NSArray class]]) {
|
isKindOfClass:[NSArray class]]) {
|
||||||
[temp2 addObjectsFromArray:
|
[temp2 addObjectsFromArray:(self.intersections)[
|
||||||
[self.intersections
|
[str substringToIndex:5]]];
|
||||||
objectForKey:[str substringToIndex:5]]];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[temp2
|
[temp2 addObject:(self.intersections)[
|
||||||
addObject:[self.intersections
|
[str substringToIndex:5]]];
|
||||||
objectForKey:[str substringToIndex:5]]];
|
|
||||||
}
|
}
|
||||||
[self.intersections setValue:temp2
|
[self.intersections setValue:temp2
|
||||||
forKey:[str substringToIndex:5]];
|
forKey:[str substringToIndex:5]];
|
||||||
@ -97,25 +91,22 @@ NSString *const Navaids = @"NAVDATA/navs.txt";
|
|||||||
for (NSString *str in temp) {
|
for (NSString *str in temp) {
|
||||||
if (str.length > 0 &&
|
if (str.length > 0 &&
|
||||||
![[str substringToIndex:1] isEqualToString:@";"]) {
|
![[str substringToIndex:1] isEqualToString:@";"]) {
|
||||||
if ([self.airways objectForKey:[str substringToIndex:5]] != nil) {
|
if ((self.airways)[[str substringToIndex:5]] != nil) {
|
||||||
// Item exists, make array and set that.
|
// Item exists, make array and set that.
|
||||||
NSMutableArray *temp2 = [[NSMutableArray alloc] init];
|
NSMutableArray *temp2 = [[NSMutableArray alloc] init];
|
||||||
[temp2 addObject:[str substringFromIndex:10]];
|
[temp2 addObject:[str substringFromIndex:8]];
|
||||||
if ([[self.airways objectForKey:[str substringToIndex:5]]
|
if ([(self.airways)[[str substringToIndex:5]]
|
||||||
isKindOfClass:[NSArray class]]) {
|
isKindOfClass:[NSArray class]]) {
|
||||||
[temp2 addObjectsFromArray:
|
[temp2 addObjectsFromArray:(self.airways)[
|
||||||
[self.airways
|
[str substringToIndex:5]]];
|
||||||
objectForKey:[str substringToIndex:5]]];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[temp2
|
[temp2 addObject:(self.airways)[[str substringToIndex:5]]];
|
||||||
addObject:[self.airways
|
|
||||||
objectForKey:[str substringToIndex:5]]];
|
|
||||||
}
|
}
|
||||||
[self.airways setValue:temp2 forKey:[str substringToIndex:5]];
|
[self.airways setValue:temp2 forKey:[str substringToIndex:5]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[self.airways setValue:[str substringFromIndex:10]
|
[self.airways setValue:[str substringFromIndex:8]
|
||||||
forKey:[str substringToIndex:5]];
|
forKey:[str substringToIndex:5]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,9 +123,31 @@ NSString *const Navaids = @"NAVDATA/navs.txt";
|
|||||||
|
|
||||||
#pragma mark - Search for elements in normal route entry
|
#pragma mark - Search for elements in normal route entry
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the given airway in both files, returns Array if found
|
||||||
|
* @param airway
|
||||||
|
*/
|
||||||
- (NSArray *)findAirway:(NSString *)airway
|
- (NSArray *)findAirway:(NSString *)airway
|
||||||
{
|
{
|
||||||
return nil;
|
if ([airway isEqualToString:@"DIRECT"]) {
|
||||||
|
return @[ @"OK" ];
|
||||||
|
}
|
||||||
|
NSMutableArray *array = [[NSMutableArray alloc] init];
|
||||||
|
for (int i = (int)airway.length; i < 5; i++) {
|
||||||
|
airway = [airway stringByAppendingString:@" "];
|
||||||
|
}
|
||||||
|
|
||||||
|
id airways = _airways[airway];
|
||||||
|
if (airways != nil) {
|
||||||
|
if ([airways isKindOfClass:[NSArray class]]) {
|
||||||
|
[array addObjectsFromArray:airways];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[array addObject:airways];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -148,8 +161,8 @@ NSString *const Navaids = @"NAVDATA/navs.txt";
|
|||||||
waypoint = [waypoint stringByAppendingString:@" "];
|
waypoint = [waypoint stringByAppendingString:@" "];
|
||||||
}
|
}
|
||||||
|
|
||||||
id navaids = [_navaids objectForKey:waypoint];
|
id navaids = _navaids[waypoint];
|
||||||
id intersections = [_intersections objectForKey:waypoint];
|
id intersections = _intersections[waypoint];
|
||||||
|
|
||||||
if (navaids != nil) {
|
if (navaids != nil) {
|
||||||
if ([navaids isKindOfClass:[NSArray class]]) {
|
if ([navaids isKindOfClass:[NSArray class]]) {
|
||||||
@ -172,4 +185,67 @@ NSString *const Navaids = @"NAVDATA/navs.txt";
|
|||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *)findWaypoint:(NSString *)waypoint onAirway:(NSString *)airway
|
||||||
|
{
|
||||||
|
NSArray *airwayWaypoints = [self findAirway:airway];
|
||||||
|
for (int i = (int)waypoint.length; i < 5; i++) {
|
||||||
|
waypoint = [waypoint stringByAppendingString:@" "];
|
||||||
|
}
|
||||||
|
for (NSString *wpt in airwayWaypoints) {
|
||||||
|
if ([wpt isEqualToString:@"OK"]) {
|
||||||
|
return @[ @"DIRECT" ];
|
||||||
|
}
|
||||||
|
if ([[wpt substringWithRange:NSMakeRange(5, 5)]
|
||||||
|
isEqualToString:waypoint]) {
|
||||||
|
return airwayWaypoints;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)findCrosspointBetween:(NSString *)airwayOne
|
||||||
|
and:(NSString *)airwayTwo
|
||||||
|
withStart:(NSString *)waypoint
|
||||||
|
{
|
||||||
|
NSArray *airwayOneArray = [self findAirway:airwayOne];
|
||||||
|
NSArray *airwayTwoArray = [self findAirway:airwayTwo];
|
||||||
|
|
||||||
|
if (airwayOneArray.count < airwayTwoArray.count) {
|
||||||
|
for (int i = 0; i < airwayTwoArray.count; i++) {
|
||||||
|
NSString *waypointTwo =
|
||||||
|
[airwayTwoArray[i] substringWithRange:NSMakeRange(5, 43)];
|
||||||
|
for (int j = 0; j < airwayOneArray.count; j++) {
|
||||||
|
NSString *waypointOne =
|
||||||
|
[airwayOneArray[j] substringWithRange:NSMakeRange(5, 43)];
|
||||||
|
if ([waypointOne isEqualToString:waypointTwo]) {
|
||||||
|
return @[
|
||||||
|
[[waypointTwo substringToIndex:5]
|
||||||
|
stringByReplacingOccurrencesOfString:@" "
|
||||||
|
withString:@""]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int i = 0; i < airwayOneArray.count; i++) {
|
||||||
|
NSString *waypointOne =
|
||||||
|
[airwayOneArray[i] substringWithRange:NSMakeRange(5, 43)];
|
||||||
|
for (int j = 0; j < airwayTwoArray.count; j++) {
|
||||||
|
NSString *waypointTwo =
|
||||||
|
[airwayTwoArray[j] substringWithRange:NSMakeRange(5, 43)];
|
||||||
|
if ([waypointOne isEqualToString:waypointTwo]) {
|
||||||
|
return @[
|
||||||
|
[[waypointTwo substringToIndex:5]
|
||||||
|
stringByReplacingOccurrencesOfString:@" "
|
||||||
|
withString:@""]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@ -130,7 +130,10 @@
|
|||||||
actionWithTitle:@"Load"
|
actionWithTitle:@"Load"
|
||||||
style:UIAlertActionStyleDefault
|
style:UIAlertActionStyleDefault
|
||||||
handler:^(UIAlertAction *action) {
|
handler:^(UIAlertAction *action) {
|
||||||
[self loadSave:[_save valueForKey:@"MENU@LSKR1"]];
|
[self loadSave:[@"SAVES/"
|
||||||
|
stringByAppendingString:
|
||||||
|
[_save
|
||||||
|
valueForKey:@"MENU@LSKR1"]]];
|
||||||
}];
|
}];
|
||||||
UIAlertAction *replaceAction =
|
UIAlertAction *replaceAction =
|
||||||
[UIAlertAction actionWithTitle:@"Replace"
|
[UIAlertAction actionWithTitle:@"Replace"
|
||||||
|
|||||||
@ -39,8 +39,6 @@ NavDataParser *parser = nil;
|
|||||||
reg.numberOfTouchesRequired = 1;
|
reg.numberOfTouchesRequired = 1;
|
||||||
[label addGestureRecognizer:reg];
|
[label addGestureRecognizer:reg];
|
||||||
}
|
}
|
||||||
|
|
||||||
parser = _main.navDataParser;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidAppear:(BOOL)animated
|
- (void)viewDidAppear:(BOOL)animated
|
||||||
@ -75,6 +73,7 @@ NavDataParser *parser = nil;
|
|||||||
|
|
||||||
- (void)enterLSK:(UITapGestureRecognizer *)tapReg
|
- (void)enterLSK:(UITapGestureRecognizer *)tapReg
|
||||||
{
|
{
|
||||||
|
parser = _main.navDataParser;
|
||||||
if ([_Scratchpad.text isEqualToString:INVALID] ||
|
if ([_Scratchpad.text isEqualToString:INVALID] ||
|
||||||
[_Scratchpad.text isEqualToString:NOTREADY]) {
|
[_Scratchpad.text isEqualToString:NOTREADY]) {
|
||||||
// DO NOTHING AS OF YET
|
// DO NOTHING AS OF YET
|
||||||
@ -102,6 +101,8 @@ NavDataParser *parser = nil;
|
|||||||
[_main saveToFile:_main.save];
|
[_main saveToFile:_main.save];
|
||||||
_main.save = [[NSMutableDictionary alloc] init];
|
_main.save = [[NSMutableDictionary alloc] init];
|
||||||
[self clearScreen];
|
[self clearScreen];
|
||||||
|
_numRoutePage = 1;
|
||||||
|
_maxNumRoutePages = 1;
|
||||||
NSArray *optional = [[[NSDictionary alloc]
|
NSArray *optional = [[[NSDictionary alloc]
|
||||||
initWithContentsOfFile:[[NSBundle mainBundle]
|
initWithContentsOfFile:[[NSBundle mainBundle]
|
||||||
pathForResource:@"LSKs"
|
pathForResource:@"LSKs"
|
||||||
@ -136,21 +137,156 @@ NavDataParser *parser = nil;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ([[_Header.text substringToIndex:3] isEqualToString:@"ROU"]) {
|
else if ([[_Header.text substringToIndex:3] isEqualToString:@"ROU"]) {
|
||||||
|
|
||||||
#warning TEST BED for NOW
|
|
||||||
if (parser.parserReady) {
|
if (parser.parserReady) {
|
||||||
NSArray *finds = [[NSArray alloc] init];
|
// Required entries for checks
|
||||||
|
UILabel *opposite = nil;
|
||||||
|
|
||||||
|
UILabel *precedingWaypoint = nil;
|
||||||
|
UILabel *precedingAirway = nil;
|
||||||
|
|
||||||
|
for (UILabel *label in _LSK) {
|
||||||
|
// General population
|
||||||
if (tapReg.view.tag > 5) {
|
if (tapReg.view.tag > 5) {
|
||||||
|
// Right hand LSKs
|
||||||
|
if (label.tag == tapReg.view.tag - 6) {
|
||||||
|
opposite = label;
|
||||||
|
}
|
||||||
|
if (label.tag == tapReg.view.tag - 7) {
|
||||||
|
precedingAirway = label;
|
||||||
|
}
|
||||||
|
if (label.tag == tapReg.view.tag - 1) {
|
||||||
|
precedingWaypoint = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Left hand LSKs
|
||||||
|
if (label.tag == tapReg.view.tag + 6) {
|
||||||
|
opposite = label;
|
||||||
|
}
|
||||||
|
if (label.tag == tapReg.view.tag + 5) {
|
||||||
|
precedingWaypoint = label;
|
||||||
|
}
|
||||||
|
if (label.tag == tapReg.view.tag - 1) {
|
||||||
|
precedingAirway = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Specials for page transitioning querries
|
||||||
|
if (tapReg.view.tag == 6 || tapReg.view.tag == 0) {
|
||||||
|
// First waypoint or airway on page
|
||||||
|
precedingAirway = [[UILabel alloc] init];
|
||||||
|
precedingWaypoint = [[UILabel alloc] init];
|
||||||
|
precedingAirway.text = (_main.save)[[NSString
|
||||||
|
stringWithFormat:@"ROUTE %lu/@LSKL6",
|
||||||
|
(unsigned long)_numRoutePage - 1]];
|
||||||
|
precedingWaypoint.text = (_main.save)[[NSString
|
||||||
|
stringWithFormat:@"ROUTE %lu/@LSKR6",
|
||||||
|
(unsigned long)_numRoutePage - 1]];
|
||||||
|
precedingAirway.restorationIdentifier = @"LSKL6";
|
||||||
|
precedingWaypoint.restorationIdentifier = @"LSKR6";
|
||||||
|
if (precedingWaypoint.text == nil) {
|
||||||
|
precedingWaypoint.text = @"";
|
||||||
|
}
|
||||||
|
if (precedingAirway.text == nil) {
|
||||||
|
precedingAirway.text = @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NSArray *finds = nil;
|
||||||
|
// Checks
|
||||||
|
if (tapReg.view.tag <= 5) {
|
||||||
|
// Left hand LSKs, aka airway entry
|
||||||
|
if (tapReg.view.tag == 0 && [[_Header.text substringToIndex:8]
|
||||||
|
isEqualToString:@"ROUTE 1/"]) {
|
||||||
|
// Not allowed
|
||||||
|
NSLog(@"NOT ALLOWED");
|
||||||
|
}
|
||||||
|
else if ([precedingWaypoint.text isEqualToString:@""] &&
|
||||||
|
[opposite.text isEqualToString:@""]) {
|
||||||
|
if ([precedingAirway.text
|
||||||
|
isEqualToString:_Scratchpad.text]) {
|
||||||
|
// Case : L2 == T104, L3 == T104, R1 == DKB
|
||||||
|
// : INVALID
|
||||||
|
NSLog(@"NOT ALLOWED 2");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
finds = [parser
|
||||||
|
findCrosspointBetween:precedingAirway.text
|
||||||
|
and:_Scratchpad.text
|
||||||
|
withStart:precedingWaypoint.text];
|
||||||
|
if (finds.count > 0) {
|
||||||
|
precedingWaypoint.text = finds.firstObject;
|
||||||
|
if (tapReg.view.tag == 0) {
|
||||||
|
(_main.save)[[NSString
|
||||||
|
stringWithFormat:
|
||||||
|
@"ROUTE %lu/@%@",
|
||||||
|
(unsigned long)_numRoutePage - 1,
|
||||||
|
precedingWaypoint
|
||||||
|
.restorationIdentifier]] =
|
||||||
|
precedingWaypoint.text;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(_main.save)[
|
||||||
|
[NSString stringWithFormat:
|
||||||
|
@"ROUTE %lu/@%@",
|
||||||
|
(unsigned long)_numRoutePage,
|
||||||
|
precedingWaypoint
|
||||||
|
.restorationIdentifier]] =
|
||||||
|
precedingWaypoint.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (![precedingWaypoint.text isEqualToString:@""] &&
|
||||||
|
[opposite.text isEqualToString:@""]) {
|
||||||
|
// Case : L2 == T104, R1 == DKB
|
||||||
|
// : Check if R1 on L2
|
||||||
|
finds = [parser findWaypoint:precedingWaypoint.text
|
||||||
|
onAirway:_Scratchpad.text];
|
||||||
|
}
|
||||||
|
else if (!([precedingWaypoint.text isEqualToString:@""] &&
|
||||||
|
[opposite.text isEqualToString:@""])) {
|
||||||
|
// Case : L2 == T104, L3 == DIRECT, R2 == DKB, R3 == WLD
|
||||||
|
// : Check for validity on R2 and R3, L3 =!= T104
|
||||||
|
finds = [parser findWaypoint:precedingWaypoint.text
|
||||||
|
onAirway:_Scratchpad.text];
|
||||||
|
if (finds.count > 0) {
|
||||||
|
finds = [parser findWaypoint:opposite.text
|
||||||
|
onAirway:_Scratchpad.text];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Right hand LSKs, aka waypoint entry
|
||||||
|
if ([precedingWaypoint.text isEqualToString:@""]) {
|
||||||
|
// Not allowed
|
||||||
|
NSLog(@"NOT ALLOWED 3");
|
||||||
|
}
|
||||||
|
else if ([opposite.text isEqualToString:@""]) {
|
||||||
|
// Special case if no airway has been entered (DIRECT gets
|
||||||
|
// enterd only if waypoint exists)
|
||||||
finds = [parser findWaypoint:_Scratchpad.text];
|
finds = [parser findWaypoint:_Scratchpad.text];
|
||||||
}
|
}
|
||||||
else if (tapReg.view.tag <= 5) {
|
else {
|
||||||
finds = [parser findAirway:_Scratchpad.text];
|
// Check if waypoint is on airway
|
||||||
|
finds = [parser findWaypoint:_Scratchpad.text
|
||||||
|
onAirway:opposite.text];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Writing to LSK if check are done
|
||||||
if (finds.count != 0) {
|
if (finds.count > 0) {
|
||||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
_Scratchpad.text = @"";
|
_Scratchpad.text = @"";
|
||||||
|
if (tapReg.view.tag > 5) {
|
||||||
|
if ([opposite.text isEqualToString:@""]) {
|
||||||
|
opposite.text = @"DIRECT";
|
||||||
|
(_main.save)[[NSString
|
||||||
|
stringWithFormat:@"ROUTE %lu/@%@",
|
||||||
|
(unsigned long)_numRoutePage,
|
||||||
|
opposite.restorationIdentifier]] =
|
||||||
|
opposite.text;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
_Scratchpad.text = INVALID;
|
_Scratchpad.text = INVALID;
|
||||||
@ -163,9 +299,28 @@ NavDataParser *parser = nil;
|
|||||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
_Scratchpad.text = @"";
|
_Scratchpad.text = @"";
|
||||||
}
|
}
|
||||||
if ([((UILabel *)tapReg.view)
|
}
|
||||||
.restorationIdentifier isEqualToString:@"LSKR6"] &&
|
else {
|
||||||
_numRoutePage == _maxNumRoutePages) {
|
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
||||||
|
_Scratchpad.text = @"";
|
||||||
|
}
|
||||||
|
if ([[_Header.text substringToIndex:4] isEqualToString:@"ROUT"]) {
|
||||||
|
(_main.save)[[NSString
|
||||||
|
stringWithFormat:@"ROUTE %lu/@%@", (unsigned long)_numRoutePage,
|
||||||
|
((UILabel *)tapReg.view).restorationIdentifier]] =
|
||||||
|
((UILabel *)tapReg.view).text;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(_main.save)[[NSString
|
||||||
|
stringWithFormat:@"%@@%@", _Header.text,
|
||||||
|
((UILabel *)tapReg.view).restorationIdentifier]] =
|
||||||
|
((UILabel *)tapReg.view).text;
|
||||||
|
}
|
||||||
|
if (([((UILabel *)tapReg.view)
|
||||||
|
.restorationIdentifier isEqualToString:@"LSKR6"] ||
|
||||||
|
tapReg.view.tag == 5) &&
|
||||||
|
_numRoutePage == _maxNumRoutePages &&
|
||||||
|
[[_Header.text substringToIndex:4] isEqualToString:@"ROUT"]) {
|
||||||
_maxNumRoutePages += 1;
|
_maxNumRoutePages += 1;
|
||||||
NSRange indexSlash = [_Header.text rangeOfString:@"/"];
|
NSRange indexSlash = [_Header.text rangeOfString:@"/"];
|
||||||
_Header.text = [_Header.text
|
_Header.text = [_Header.text
|
||||||
@ -173,22 +328,14 @@ NavDataParser *parser = nil;
|
|||||||
indexSlash.location,
|
indexSlash.location,
|
||||||
_Header.text.length -
|
_Header.text.length -
|
||||||
indexSlash.location)
|
indexSlash.location)
|
||||||
withString:
|
withString:[NSString
|
||||||
[NSString
|
|
||||||
stringWithFormat:
|
stringWithFormat:
|
||||||
@"/%lu",
|
@"/%lu",
|
||||||
(unsigned long)
|
(unsigned long)
|
||||||
_maxNumRoutePages]];
|
_maxNumRoutePages]];
|
||||||
}
|
}
|
||||||
}
|
(_main.save)[@"maxRte"] = @(_maxNumRoutePages);
|
||||||
else {
|
|
||||||
((UILabel *)tapReg.view).text = _Scratchpad.text;
|
|
||||||
_Scratchpad.text = @"";
|
|
||||||
}
|
|
||||||
(_main.save)[[NSString
|
|
||||||
stringWithFormat:@"%@@%@", _Header.text,
|
|
||||||
((UILabel *)tapReg.view).restorationIdentifier]] =
|
|
||||||
((UILabel *)tapReg.view).text;
|
|
||||||
[_main saveToFile:_main.save];
|
[_main saveToFile:_main.save];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,8 +405,15 @@ NavDataParser *parser = nil;
|
|||||||
{
|
{
|
||||||
for (NSString *ident in _main.save) {
|
for (NSString *ident in _main.save) {
|
||||||
NSRange range = [ident rangeOfString:@"@"];
|
NSRange range = [ident rangeOfString:@"@"];
|
||||||
if ([[ident substringToIndex:range.location]
|
NSRange range2 = [ident rangeOfString:@"/"];
|
||||||
isEqualToString:_Header.text]) {
|
if ((range.location != NSNotFound &&
|
||||||
|
[_Header.text
|
||||||
|
isEqualToString:[ident substringToIndex:range.location]]) ||
|
||||||
|
(range2.location != NSNotFound &&
|
||||||
|
_Header.text.length > range2.location &&
|
||||||
|
[[ident substringToIndex:range2.location]
|
||||||
|
isEqualToString:[_Header.text
|
||||||
|
substringToIndex:range2.location]])) {
|
||||||
for (UILabel *label in _LSK) {
|
for (UILabel *label in _LSK) {
|
||||||
if ([label.restorationIdentifier
|
if ([label.restorationIdentifier
|
||||||
isEqualToString:[ident
|
isEqualToString:[ident
|
||||||
@ -285,6 +439,11 @@ NavDataParser *parser = nil;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([[_main.save valueForKey:@"maxRte"] unsignedIntegerValue] > 0) {
|
||||||
|
_maxNumRoutePages =
|
||||||
|
[[_main.save valueForKey:@"maxRte"] unsignedIntegerValue];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user