Implement arbitrary turn penalty file IO and integration (#2306)
Closes #1830
This commit is contained in:
@@ -105,11 +105,16 @@ module.exports = function () {
|
||||
} else cb();
|
||||
};
|
||||
|
||||
this.setExtractArgs = (args) => {
|
||||
this.setExtractArgs = (args, callback) => {
|
||||
this.extractArgs = args;
|
||||
this.forceExtract = true;
|
||||
this.forceContract = true;
|
||||
callback();
|
||||
};
|
||||
|
||||
this.setContractArgs = (args) => {
|
||||
this.setContractArgs = (args, callback) => {
|
||||
this.contractArgs = args;
|
||||
this.forceContract = true;
|
||||
callback();
|
||||
};
|
||||
};
|
||||
|
||||
@@ -295,9 +295,10 @@ module.exports = function () {
|
||||
this.writeAndExtract((e) => {
|
||||
if (e) return callback(e);
|
||||
this.isContracted((isContracted) => {
|
||||
var contractFn = isContracted ? noop : this.contractData;
|
||||
var contractFn = (isContracted && !this.forceContract) ? noop : this.contractData;
|
||||
if (isContracted) this.log('Already contracted ' + this.osmData.contractedFile, 'preprocess');
|
||||
contractFn((e) => {
|
||||
this.forceContract = false;
|
||||
if (e) return callback(e);
|
||||
this.logPreprocessDone();
|
||||
callback();
|
||||
@@ -311,9 +312,10 @@ module.exports = function () {
|
||||
this.writeInputData((e) => {
|
||||
if (e) return callback(e);
|
||||
this.isExtracted((isExtracted) => {
|
||||
var extractFn = isExtracted ? noop : this.extractData;
|
||||
var extractFn = (isExtracted && !this.forceExtract) ? noop : this.extractData;
|
||||
if (isExtracted) this.log('Already extracted ' + this.osmData.extractedFile, 'preprocess');
|
||||
extractFn((e) => {
|
||||
this.forceExtract = false;
|
||||
callback(e);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -24,10 +24,12 @@ module.exports = function () {
|
||||
});
|
||||
|
||||
this.After((scenario, callback) => {
|
||||
this.setExtractArgs('');
|
||||
this.setContractArgs('');
|
||||
if (this.loadMethod === 'directly' && !!this.OSRMLoader.loader) this.OSRMLoader.shutdown(callback);
|
||||
else callback();
|
||||
this.setExtractArgs('', () => {
|
||||
this.setContractArgs('', () => {
|
||||
if (this.loadMethod === 'directly' && !!this.OSRMLoader.loader) this.OSRMLoader.shutdown(callback);
|
||||
else callback();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.Around('@stress', (scenario, callback) => {
|
||||
|
||||
Reference in New Issue
Block a user