Skip to content

Commit 6d73615

Browse files
committed
WIP
1 parent c3c2883 commit 6d73615

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

packages/viewer/src/modules/menu/components/advancedTools/ImportFile/ImportFileLocalTab.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ async function loadFile() {
3939
await handleFileSource(selectedFile.value, false)
4040
importSuccessMessage.value = 'file_imported_success'
4141
} catch (error) {
42+
console.error('Error loading file:', error)
4243
errorFileLoadingMessage.value = generateErrorMessageFromErrorType(
4344
error instanceof Error ? error : new Error(String(error))
4445
)

packages/viewer/src/modules/menu/components/advancedTools/ImportFile/parser/KMLParser.class.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ export class KMLParser extends FileParser<KMLLayer> {
3333
currentProjection: CoordinateSystem,
3434
linkFiles: Map<string, ArrayBuffer> = new Map()
3535
): Promise<KMLLayer> {
36+
console.log('KMLParser.parseFileContent called')
3637
if (!fileContent || !isKml(fileContent)) {
3738
throw new InvalidFileContentError('No KML data found in this file')
3839
}
3940
const kmlAsText = new TextDecoder('utf-8').decode(fileContent)
4041
const extent = getKmlExtent(kmlAsText)
42+
console.log('KMLParser.parseFileContent - extent:', extent)
4143
if (!extent) {
4244
throw new EmptyFileContentError()
4345
}
@@ -46,7 +48,12 @@ export class KMLParser extends FileParser<KMLLayer> {
4648
WGS84,
4749
currentProjection
4850
)
51+
console.log(
52+
'KMLParser.parseFileContent - extentInCurrentProjection:',
53+
extentInCurrentProjection
54+
)
4955
if (!extentInCurrentProjection) {
56+
console.log('KMLParser.parseFileContent - throwing OutOfBoundsError')
5057
throw new OutOfBoundsError(
5158
`KML is out of bounds of current projection: ${extent.toString()}`
5259
)

packages/viewer/tests/cypress/tests-e2e/importToolFile.cy.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,21 +1054,21 @@ describe('The Import File Tool', () => {
10541054
.should('be.visible')
10551055
.should('contain', 'Invalid file, only KML, KMZ, GPX or COG file are supported')
10561056

1057-
// //----------------------------------------------------------------------
1058-
// // Attach a local KML file that is out of bounds
1059-
// cy.log('Test add a local KML file that is out of bounds')
1060-
// cy.fixture(outOfBoundKMLFile, undefined).as('outOfBoundKMLFileFixture')
1061-
// cy.get('[data-cy="file-input"]').selectFile('@outOfBoundKMLFileFixture', {
1062-
// force: true,
1063-
// })
1064-
// cy.get('[data-cy="import-file-load-button"]:visible').click()
1057+
//----------------------------------------------------------------------
1058+
// Attach a local KML file that is out of bounds
1059+
cy.log('Test add a local KML file that is out of bounds')
1060+
cy.fixture(outOfBoundKMLFile, undefined).as('outOfBoundKMLFileFixture')
1061+
cy.get('[data-cy="file-input"]').selectFile('@outOfBoundKMLFileFixture', {
1062+
force: true,
1063+
})
1064+
cy.get('[data-cy="import-file-load-button"]:visible').click()
10651065

1066-
// cy.get('[data-cy="file-input-text"]')
1067-
// .should('have.class', 'is-invalid')
1068-
// .should('not.have.class', 'is-valid')
1069-
// cy.get('[data-cy="file-input-invalid-feedback"]')
1070-
// .should('be.visible')
1071-
// .contains('out of projection bounds')
1066+
cy.get('[data-cy="file-input-text"]')
1067+
.should('have.class', 'is-invalid')
1068+
.should('not.have.class', 'is-valid')
1069+
cy.get('[data-cy="file-input-invalid-feedback"]')
1070+
.should('be.visible')
1071+
.contains('out of projection bounds')
10721072

10731073
// //----------------------------------------------------------------------
10741074
// // Attach a local empty KML file

0 commit comments

Comments
 (0)