Skip to content

Commit 2f9863a

Browse files
committed
Remove deprecated code.
Removing deprecated code which we've moved to the core component 6months ago. Adapted tests. Resolves: OLPEDGE-2466 Signed-off-by: Oleksii Zubko <[email protected]>
1 parent c73f415 commit 2f9863a

File tree

82 files changed

+376
-2075
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+376
-2075
lines changed

@here/olp-sdk-authentication/index.node.ts

-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ export { OAuthArgs, Token } from "./lib/requestToken_common";
2323
export * from "./lib/requestToken";
2424
export * from "./lib/UserAuth";
2525
export * from "./lib/loadCredentialsFromFile";
26-
export * from "./lib/HttpError";

@here/olp-sdk-authentication/index.web.ts

-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@
2020
export { OAuthArgs, Token } from "./lib/requestToken_common";
2121
export * from "./lib/requestToken.web";
2222
export * from "./lib/UserAuth";
23-
export * from "./lib/HttpError";

@here/olp-sdk-authentication/lib.version.ts

-24
This file was deleted.

@here/olp-sdk-authentication/lib/HttpError.ts

-25
This file was deleted.

@here/olp-sdk-core/lib/utils/TileKey.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 HERE Europe B.V.
2+
* Copyright (C) 2020-2021 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -238,6 +238,30 @@ export class TileKey implements QuadKey {
238238
return Math.floor(mortonCode / 4);
239239
}
240240

241+
/**
242+
* Checks if a quadkey is valid.
243+
*
244+
* The number of rows and columns must not be greater than the maximum number of rows and columns in the given level.
245+
* The maximum number of rows and columns in a level is computed as 2 to the power of the level.
246+
*
247+
* @note As the JavaScript number type can hold 53 bits in its mantissa, only levels up to 26 can be
248+
* represented in the number representation returned by [[mortonCodeFromQuadKey]].
249+
* A level must be positive and can't be greater than 26.
250+
*
251+
* @param key The current quadkey.
252+
* @return True if the quadkey is valid, false otherwise.
253+
*/
254+
static isValid(key: QuadKey): boolean {
255+
// tslint:disable-next-line:no-magic-numbers
256+
if (key.level < 0 || key.level > 26) {
257+
return false;
258+
}
259+
const dimensionAtLevel = Math.pow(2, key.level);
260+
const rowValid = key.row >= 0 && key.row < dimensionAtLevel;
261+
const columnValid = key.column >= 0 && key.column < dimensionAtLevel;
262+
return rowValid && columnValid;
263+
}
264+
241265
/**
242266
* Returns a tile key representing the parent of the tile addressed by this tile key.
243267
*

@here/olp-sdk-core/test/unit/TileKey.test.ts

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 HERE Europe B.V.
2+
* Copyright (C) 2020-2021 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -231,4 +231,26 @@ describe("TileKey", function() {
231231
);
232232
}
233233
});
234+
235+
it("Tile is not valid if the row/column is out of bounds", function() {
236+
const invalid_tile_1 = { row: 5, column: 1, level: 1 };
237+
assert.isFalse(TileKey.isValid(invalid_tile_1));
238+
239+
const invalid_tile_2 = { row: -5, column: 1, level: 1 };
240+
assert.isFalse(TileKey.isValid(invalid_tile_2));
241+
242+
const invalid_tile_3 = { row: 1, column: 5, level: 1 };
243+
assert.isFalse(TileKey.isValid(invalid_tile_3));
244+
245+
const invalid_tile_4 = { row: 1, column: -5, level: 1 };
246+
assert.isFalse(TileKey.isValid(invalid_tile_4));
247+
});
248+
249+
it("Tile is not valid if the level is out of bounds", function() {
250+
const invalid_tile_1 = { row: 0, column: 0, level: -1 };
251+
assert.isFalse(TileKey.isValid(invalid_tile_1));
252+
253+
const invalid_tile_2 = { row: 0, column: 0, level: 100 };
254+
assert.isFalse(TileKey.isValid(invalid_tile_2));
255+
});
234256
});

@here/olp-sdk-dataservice-api/index.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019 HERE Europe B.V.
2+
* Copyright (C) 2019-2021 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818
*/
1919

2020
export * from "./lib/RequestBuilder";
21-
export * from "./lib/HttpError";
2221

2322
import * as ArtifactApi from "./lib/artifact-api";
2423
import * as AuthorizationAPI from "./lib/authorization-api-v1.1";

@here/olp-sdk-dataservice-api/lib/HttpError.ts

-54
This file was deleted.

@here/olp-sdk-dataservice-api/test/HttpError.test.ts

-41
This file was deleted.

@here/olp-sdk-dataservice-read/lib.version.ts

-24
This file was deleted.

@here/olp-sdk-dataservice-read/lib/DataStoreDownloadManager.ts

-24
This file was deleted.

@here/olp-sdk-dataservice-read/lib/DataStoreRequestBuilder.ts

-24
This file was deleted.

@here/olp-sdk-dataservice-read/lib/DownloadManager.ts

-24
This file was deleted.

@here/olp-sdk-dataservice-read/lib/HRN.ts

-24
This file was deleted.

@here/olp-sdk-dataservice-read/lib/cache/ApiCacheRepository.ts

-24
This file was deleted.

0 commit comments

Comments
 (0)