Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gslux 755 location info #175

Merged
merged 52 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
920eda7
setup click location
mki-c2c Nov 19, 2024
290edc7
query and compute location infos
mki-c2c Nov 19, 2024
fc24e3b
setup basic UI for streetview component
mki-c2c Nov 22, 2024
cd09bfd
implement OL feature for displaying streetview on map canvas
mki-c2c Nov 26, 2024
28ff7de
missing commit of fixed linting
mki-c2c Nov 26, 2024
2eaf56f
fix typing
mki-c2c Nov 26, 2024
dac271c
import streetview icons as static asssets for correct bundling
mki-c2c Nov 26, 2024
767784d
remove useless tailwind style imports for streetview icons
mki-c2c Nov 26, 2024
8bd90ea
add missing static asset import file
mki-c2c Nov 26, 2024
cb6c7a3
- make streetview-div persistant in DOM (v-show instead of v-if)
mki-c2c Nov 27, 2024
533558a
- wait for DOM update before setting streetview position, otherwise, …
mki-c2c Nov 27, 2024
2390270
add feature interactions for streetview navigation
mki-c2c Nov 27, 2024
ef6213a
fix regex in tests
mki-c2c Nov 27, 2024
d4e400c
remove yellow pointer when streetview is active
mki-c2c Nov 27, 2024
1169a8b
refactoring:
mki-c2c Nov 27, 2024
2cff725
- fix tests
mki-c2c Nov 28, 2024
2483f57
compute links to cyclomedia and oblique view
mki-c2c Nov 29, 2024
18ec59a
review fixes
mki-c2c Dec 4, 2024
ea26222
use env constants
mki-c2c Dec 4, 2024
a4d39a5
update viewport center in permalink on location info click
mki-c2c Dec 4, 2024
6ab0f26
fix short URL in migration
mki-c2c Dec 4, 2024
b9b9dd2
move composables into components
mki-c2c Dec 4, 2024
c5d4fd6
fix directives
mki-c2c Dec 4, 2024
e44218f
fix length formatter
mki-c2c Dec 4, 2024
fb58f35
use new elevation formatter
mki-c2c Dec 4, 2024
b24dba3
fix yellow click point watcher
mki-c2c Dec 4, 2024
ee61068
refactor formatting functions
mki-c2c Dec 4, 2024
28b75b0
add correct logics for buttons
mki-c2c Dec 5, 2024
9f4f92a
provide support for routing in info panel
mki-c2c Dec 5, 2024
a66c0dc
deactivate location info when the info panel is closed
mki-c2c Dec 5, 2024
84cd76b
export necessary vars for info integration in v3
mki-c2c Dec 6, 2024
4355e2f
integrate v4 location info component
mki-c2c Dec 6, 2024
748df56
fix typing
mki-c2c Dec 6, 2024
cc13f23
fix unit tests
mki-c2c Dec 6, 2024
8bf36ff
add e2e test
mki-c2c Dec 6, 2024
984ac02
review comments, import typing for google maps API
mki-c2c Dec 9, 2024
a857a73
add docstring
mki-c2c Dec 9, 2024
f3ec572
refactoring of url download and constants for CRS
mki-c2c Dec 9, 2024
1c6354f
improve DOM
mki-c2c Dec 9, 2024
2dbe417
use fixed API responses to have predictable test results
mki-c2c Dec 9, 2024
e943a0b
synchronize postrender for streetview tests
mki-c2c Dec 12, 2024
e5ec30d
integrate location info and feature info
mki-c2c Dec 12, 2024
d5c8ad1
tune assertions to fix timing in order to make location info tests re…
mki-c2c Dec 13, 2024
a814426
fix permalink
mki-c2c Dec 13, 2024
e280ba4
fix e2e test
mki-c2c Dec 13, 2024
b2efe06
use arrow function in should will make cypress wait for the expected …
mki-c2c Dec 13, 2024
525c5e6
fix test
mki-c2c Dec 13, 2024
2c3f0d8
fix legends test
mki-c2c Dec 13, 2024
af2d822
refactor info features
mki-c2c Dec 13, 2024
1954e75
explicit wait for legend fixtures
mki-c2c Dec 16, 2024
333a240
remove unnecessary unmount hook (review comments)
mki-c2c Dec 16, 2024
ce754fa
explicit wait for profile API calls
mki-c2c Dec 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VITE_V3_API_HOST="https://map.geoportail.lu/"

# Proxy urls
VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="/ogcproxywms"
Expand All @@ -9,6 +11,15 @@ VITE_GET_LEGENDS_URL="/legends/get_html"
VITE_GET_METADATA_URL="/getMetadata"
VITE_GET_INFO_SERVICE_URL="/getfeatureinfo"

# Urls for location info
VITE_FORAGE_URL="/getRapportForageVirtuel"
VITE_LIDAR_URL="https://lidar.geoportail.lu"
VITE_CYCLOMEDIA_URL="http://streetsmart.cyclomedia.com/streetsmart"
VITE_OBLIQUE_URL="https://oblique.geoportail.lu/publication/viewer"
VITE_SHORT_URL="/short/create"
VITE_QR_URL="/qr"
VITE_ADDRESS_URL="/geocode/reverse"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="/mymaps"
VITE_SYMBOLS_URL="/mymaps/symbols"
Expand Down
11 changes: 11 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VITE_V3_API_HOST="http://localhost:8080/"

# Proxy urls
VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="https://migration.geoportail.lu/ogcproxywms"
Expand All @@ -9,6 +11,15 @@ VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html"
VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata"
VITE_GET_INFO_SERVICE_URL="https://migration.geoportail.lu/getfeatureinfo"

# Urls for location info
VITE_FORAGE_URL="http://localhost:8080/getRapportForageVirtuel"
VITE_LIDAR_URL="https://lidar.geoportail.lu"
VITE_CYCLOMEDIA_URL="http://streetsmart.cyclomedia.com/streetsmart"
VITE_OBLIQUE_URL="https://oblique.geoportail.lu/publication/viewer"
VITE_SHORT_URL="http://localhost:8080/short/create"
VITE_QR_URL="http://localhost:8080/qr"
VITE_ADDRESS_URL="http://localhost:8080/geocode/reverse"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" # !!! use prod because of CORS
VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" # !!! use prod because of CORS
Expand Down
11 changes: 11 additions & 0 deletions .env.e2e
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VITE_V3_API_HOST="https://migration.geoportail.lu/"

# Proxy urls
VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="https://map.geoportail.lu/ogcproxywms"
Expand All @@ -9,6 +11,15 @@ VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html"
VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata"
VITE_GET_INFO_SERVICE_URL="https://migration.geoportail.lu/getfeatureinfo"

# Urls for location info
VITE_FORAGE_URL="https://migration.geoportail.lu/getRapportForageVirtuel"
VITE_LIDAR_URL="https://lidar.geoportail.lu"
VITE_CYCLOMEDIA_URL="http://streetsmart.cyclomedia.com/streetsmart"
VITE_OBLIQUE_URL="https://oblique.geoportail.lu/publication/viewer"
VITE_SHORT_URL="https://migration.geoportail.lu/short/create"
VITE_QR_URL="https://migration.geoportail.lu/qr"
VITE_ADDRESS_URL="https://migration.geoportail.lu/geocode/reverse"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="https://map.geoportail.lu/mymaps" # !!! use prod because of CORS
VITE_SYMBOLS_URL="https://map.geoportail.lu/mymaps/symbols" # !!! use prod because of CORS
Expand Down
11 changes: 11 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VITE_V3_API_HOST="https://migration.geoportail.lu/"

# Proxy urls
VITE_USE_PROXYURL=true
VITE_PROXYURL_WMS="https://migration.geoportail.lu/ogcproxywms"
Expand All @@ -9,6 +11,15 @@ VITE_GET_LEGENDS_URL="https://migration.geoportail.lu/legends/get_html"
VITE_GET_METADATA_URL="https://migration.geoportail.lu/getMetadata"
VITE_GET_INFO_SERVICE_URL="https://migration.geoportail.lu/getfeatureinfo"

# Urls for location info
VITE_FORAGE_URL="/getRapportForageVirtuel"
VITE_LIDAR_URL="https://lidar.geoportail.lu"
VITE_CYCLOMEDIA_URL="http://streetsmart.cyclomedia.com/streetsmart"
VITE_OBLIQUE_URL="https://oblique.geoportail.lu/publication/viewer"
VITE_SHORT_URL="https://migration.geoportail.lu/short/create"
VITE_QR_URL="https://migration.geoportail.lu/qr"
VITE_ADDRESS_URL="https://migration.geoportail.lu/geocode/reverse"

# Paths for symbols
VITE_SYMBOL_ICONS_URL="https://migration.geoportail.lu/mymaps"
VITE_SYMBOLS_URL="https://migration.geoportail.lu/mymaps/symbols"
Expand Down
35 changes: 32 additions & 3 deletions cypress/e2e/draw/draw-feat-line.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ function testFeatItemMeasurements() {

describe('Draw "Line"', () => {
beforeEach(() => {
cy.intercept(
{
method: 'POST',
pathname: '/profile.json',
},
req =>
new Promise(r => {
const resp = new Response(req.body, {
headers: { 'content-type': 'application/x-www-form-urlencoded' },
})
resp.formData().then(formData => {
const geom = formData.get('geom')
const coordinates = JSON.parse(geom as string).coordinates
if (coordinates[0][0] > 40000) {
r(req.body)
} else {
r({
fixture: 'profile.json',
})
}
})
})
).as('profile-fixture')
cy.visit('/')
cy.get('button[data-cy="drawButton"]').click()
cy.get('button[data-cy="drawLineButton"]').click()
Expand All @@ -26,10 +49,12 @@ describe('Draw "Line"', () => {
})

it('displays measurements for Line', () => {
cy.wait('@profile-fixture')
testFeatItemMeasurements()
})

it('displays the elevation profile for Line', () => {
cy.wait('@profile-fixture')
cy.get('[data-cy="featItemProfileCumul"]').should(
'contain.text',
'Δ+964 m Δ-1105 m Δ-141 m'
Expand All @@ -50,11 +75,9 @@ describe('Draw "Line"', () => {
})

describe('When editing the line', () => {
beforeEach(() => {
cy.intercept('POST', '/profile.json', { fixture: 'profile.json' })
})
it('refreshes the elevation profile for Line', () => {
cy.dragVertexOnMap(320, 223, 305, 305)
cy.wait('@profile-fixture')
cy.get('[data-cy="featItemProfileCumul"]').should($el => {
const text = $el.text()
const validValues = [
Expand All @@ -72,6 +95,7 @@ describe('Draw "Line"', () => {
})

it('downloads the profile elevation', () => {
cy.wait('@profile-fixture')
cy.get('[data-cy="featItemProfileCSV"]').click()

const downloadPath = 'cypress/downloads/Ligne_1.csv'
Expand All @@ -86,25 +110,30 @@ describe('Draw "Line"', () => {
})

it('updates length measurement when editing geometry', () => {
cy.wait('@profile-fixture')
cy.get('[data-cy="featItemLength"]').should('contain.text', '42.31 km')
cy.dragVertexOnMap(320, 223, 305, 305)
cy.wait('@profile-fixture')
cy.get('[data-cy="featItemLength"]').should('contain.text', '33.26 km')
})

it('displays the possible actions for the feature', () => {
cy.wait('@profile-fixture')
testFeatItem()
})
})

describe('When clicking button dock', () => {
it('displays the feature info in the map popup', () => {
testFeatItemDocking()
cy.wait('@profile-fixture')
testFeatItemMeasurements()
})
})

describe('When clicking button dropdown menu', () => {
it('displays the dropdown menu content for "Line"', () => {
cy.wait('@profile-fixture')
cy.get('[data-cy="featMenuPopup"] > button').should('exist')
cy.get('[data-cy="featMenuPopup"] > button').click()

Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/footer-bar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('Footer bar', () => {
cy.get('[data-cy="infoOpenClose"]').find('button').click()
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('button[data-cy="drawButton"]').click()
cy.get('[data-cy="infoPanel"]').should('not.exist')
cy.get('[data-cy="infoPanel"]').should('be.hidden')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why hiding the panel with css instead of removing it from the dom?

})
})

Expand Down Expand Up @@ -72,7 +72,7 @@ describe('Footer bar', () => {
it('Other panels are closed', () => {
cy.get('[data-cy="styleSelector"]').should('not.exist')
cy.get('[data-cy="layerPanel"]').should('not.exist')
cy.get('[data-cy="infoPanel"]').should('not.exist')
cy.get('[data-cy="infoPanel"]').should('be.hidden')
})

describe('When clicking on layers panel button', () => {
Expand All @@ -94,7 +94,7 @@ describe('Footer bar', () => {
})

it('Info panel is shown', () => {
cy.get('[data-cy="infoPanel"]').should('exist')
cy.get('[data-cy="infoPanel"]').should('be.visible')
})

it('Other panels are closed', () => {
Expand All @@ -108,7 +108,7 @@ describe('Footer bar', () => {
})

it('closes the info panel', () => {
cy.get('[data-cy="infoPanel"]').should('not.exist')
cy.get('[data-cy="infoPanel"]').should('be.hidden')
})
})
})
Expand Down
163 changes: 163 additions & 0 deletions cypress/e2e/info/location-info.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
describe('Location Info', () => {
beforeEach(() => {
cy.intercept('POST', 'short/create', {
statusCode: 200,
body: { short_url: 'http://localhost:8080/s/uSxF' },
}).as('shortUrl')

cy.intercept(
{
method: 'GET',
pathname: '/geocode/reverse',
},
req => {
const dist = Math.sqrt(
(parseFloat(req.query.easting.toString()) - 67887) ** 2 +
(parseFloat(req.query.northing.toString()) - 85410) ** 2
)
const categorizedDist =
dist > 5 ? (dist > 100 ? 1972.1284 : 394.2305) : 20.98493
req.reply({
statusCode: 200,
body: {
count: 1,
results: [
{
id_caclr_locality: '37',
id_caclr_street: '1147',
id_caclr_bat: '213956',
street: 'Bergstr',
number: '18',
locality: 'Roodt/Eisch/Test',
commune: 'Habscht',
postal_code: '8398',
country: 'Luxembourg',
country_code: 'lu',
distance: categorizedDist,
contributor: 'ACT',
geom: {
type: 'Point',
coordinates: [req.query.easting, req.query.northing],
},
geomlonlat: {
type: 'Point',
coordinates: [6.00041535, 49.697110053],
},
},
],
},
})
}
)
})

describe('Open location info on position', () => {
describe('Display basic feature info for multiple layers', () => {
beforeEach(() => {
cy.visit('/?zoom=8')
})
it('should display coordinate and address information in the panel', () => {
cy.get('[data-cy="locationInfo"]').should('be.hidden')
cy.url().should('not.contain', 'crosshair=')
cy.window()
.its('olMap')
.then(function (olMap) {
const featureLayers = olMap
.getLayers()
.getArray()
.filter((l: any) => l.get('cyLayerType') === 'infoFeatureLayer')
const features = featureLayers
.map((l: any) => l.getSource().getFeatures())
.flat()
cy.wrap(features.length).should('equal', 0)
})

cy.get('div.ol-viewport').rightclick(350, 300, { force: true })
cy.get('[data-cy="locationInfo"]').should('be.visible')
cy.get('[data-cy="locationInfo"]').find('input').should('exist')
cy.get('[data-cy="locationInfo"]')
.find('input')
.invoke('val')
.should('contain', 'localhost:8080/s')
// 8 location infos (5 projections, elevation, address, distance)
cy.get('[data-cy="locationInfo"] > div > table > tbody > tr').should(
'have.length',
8
)
cy.get('[data-cy="locationInfo"] > div > table > tbody > tr')
.eq(6)
.find('td')
.should('contain.text', 'Roodt/Eisch/Test')
cy.get('[data-cy="locationInfo"] > div > table > tbody > tr')
.eq(7)
.find('td')
.should('contain.text', '1.97 km')
// check pointer
cy.window()
.its('olMap')
.then(function (olMap) {
const featureLayers = olMap
.getLayers()
.getArray()
.filter((l: any) => l.get('cyLayerType') === 'infoFeatureLayer')
const features = featureLayers
.map((l: any) => l.getSource().getFeatures())
.flat()
cy.wrap(features.length).should('equal', 1)
})

cy.url().should('contain', 'crosshair=true')
})

it('streetview should integrate smoothly in the panel', () => {
cy.get('div.ol-viewport').rightclick(350, 300, { force: true })
cy.get('[data-cy="streetviewOff"]').should('not.exist')
cy.get('[data-cy="streetviewOn"]').click()
cy.get('[data-cy="streetviewOff"]').should('exist')
cy.get('[data-cy="streetviewNoData"]').should('be.visible')
cy.get('[data-cy="streetviewNoData"]')
.find('span')
.should(
'contain.text',
"Il n'y a pas de panorama Google disponible à cet endroit"
)
cy.window()
.its('olMap')
.then(function (olMap) {
const featureLayers = olMap
.getLayers()
.getArray()
.filter((l: any) => l.get('cyLayerType') === 'svFeatureLayer')
const features = featureLayers
.map((l: any) => l.getSource().getFeatures())
.flat()
cy.wrap(features.length).should('equal', 0)
})
cy.get('div.ol-viewport').rightclick(350, 50, { force: true })
cy.get('[data-cy="streetviewNoData"]').should('not.be.visible')
cy.get('[data-cy="streetviewLoading"]').should('not.be.visible')
cy.window()
.its('olMap')
.should(function (olMap) {
const featureLayers = olMap
.getLayers()
.getArray()
.filter((l: any) => l.get('cyLayerType') === 'svFeatureLayer')
const features = featureLayers
.map((l: any) => l.getSource().getFeatures())
.flat()
expect(features.length).to.equal(3)
})
cy.get('[data-cy="locationInfo"] > div > table > tbody > tr')
.last()
.find('td')
.should('contain.text', '20.98 m')
cy.get('div.ol-viewport').click(382, 82, { force: true })
cy.get('[data-cy="locationInfo"] > div > table > tbody > tr')
.last()
.find('td')
.should(el => expect(el).to.contain.text('394.23 m'))
})
})
})
})
Loading
Loading