stepKey static method
Stepping operation for quadkey
Implementation
static String stepKey(String key, int num) {
var parts = key.split('/');
var faceS = parts[0];
var posS = parts[1];
var level = parts[1].length;
var posL = int.parse(posS, radix: 4);
/// Translate posS to base 10
int otherL;
if (num > 0) {
otherL = posL + num.abs();
} else if (num < 0) {
otherL = posL - num.abs();
} else {
otherL = posL;
}
var otherS = otherL.toRadixString(4);
if (otherS == '0') {
print("Warning: face/position wrapping is not yet supported");
}
while (otherS.length < level) {
otherS = '0$otherS';
}
return '$faceS/$otherS';
}