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

(WIP) Filtering and 360 #53

Draft
wants to merge 112 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
96fbee2
poc for panellum
iinus Jun 2, 2021
c9fa07f
rename three sixty to panorama
iinus Jun 2, 2021
0edc7f7
remove loading
iinus Jun 3, 2021
d7aaff6
add icon for filter and remove old unused icons
iinus Jun 3, 2021
dbe6aa3
change styling of year select
iinus Jun 3, 2021
74aedef
add filter icon
iinus Jun 4, 2021
490adf7
add basic filter component
iinus Jun 4, 2021
fdd5c01
basic styling on filtering
iinus Jun 8, 2021
4d0450d
add filterstate for camera type
iinus Jun 8, 2021
4e2a38a
add check/uncheck state on filter for camera types
iinus Jun 9, 2021
77869e9
remove items from array for filter state when they are unchecked
iinus Jun 9, 2021
6b882c9
map out each layer (from camera filter) to a TileLayer
iinus Jun 9, 2021
3e390e6
temporarily remove vegtype filter
iinus Jun 9, 2021
64e9111
add comma
iinus Jun 9, 2021
5d009e0
turn production mode off
iinus Jun 9, 2021
4f2256c
use correct panorama map layer
iinus Jun 9, 2021
d2693ce
update version log
iinus Jun 9, 2021
1b98131
better scaling of elements in header
iinus Jun 10, 2021
4f200e2
remove comment and update version log
iinus Jun 10, 2021
5a43418
Merge branch '360-images' into filtering
iinus Jun 10, 2021
6248685
remove 360 test image and use url from metadata instead
iinus Jun 10, 2021
55f3ee9
filter image points (directional markers) on camratype
iinus Jun 11, 2021
df71f13
change camera type state to radio buttons
iinus Jun 18, 2021
c84a9c8
let function for getting image points take typename as a praram, whic…
iinus Jun 20, 2021
34312c9
use correct typename for each camerafilter when fetching new images
iinus Jun 20, 2021
ea97b9d
change name of camera type filter from panorama to 360
iinus Jun 20, 2021
240d0f1
show image preview as 360 also if the image is 360
iinus Jun 20, 2021
2b71f2c
let cameraType be a property on loadedImagePoints
iinus Jun 23, 2021
826cc60
remove unused code
iinus Jun 23, 2021
2daef17
change to onøy utv url temporarly
iinus Jun 24, 2021
0ad0ffe
merge master
iinus Jul 23, 2021
f55d957
merge master
iinus Jul 27, 2021
26d3d77
Added chosen camera type (from filter) to all relevant hooks
theresmf Sep 15, 2021
0554935
Merged master (statistics and vegsystemreferanse in url) into branch)
Sep 16, 2021
2ffc195
Removed unnecessary reference to cameraType state and added return ty…
Sep 16, 2021
089b07b
Fetches 360-imagePoints based on selected year
Sep 16, 2021
418fde4
Design testing: moved filter outside search bar
Sep 20, 2021
0b076ed
Hover effect on year selector for consistency
Sep 20, 2021
0922210
Renamed cameraType state
Sep 20, 2021
91ac842
Renamed variable for camera type and added cameraType to url (wip)
Sep 21, 2021
18d7410
Image preview is the same for all camera types
theresmf Sep 22, 2021
3324e65
fetching 360 imagepoints can try to access endpoint which doesn't exi…
Sep 22, 2021
a8cfab3
Add cameratype to url when opening app
Sep 22, 2021
2507f53
(WIP) Possible to navigate betwee 360 imagepoints in imageview
Sep 22, 2021
12f5edb
Name change in url and code: cameraType to imageType
Sep 27, 2021
c68d914
Rearranged imagetype filter selection list
Sep 27, 2021
854c008
Setting imateTypeState outside useEffect to avoid using default state…
Sep 27, 2021
f8489e0
Navigation between 360 images in image view
theresmf Sep 29, 2021
a077561
Disabled basisline for 360 images
theresmf Sep 29, 2021
09c0ea1
Zoom for 360 image view (wip)
theresmf Sep 29, 2021
b489ace
Preview of panorama images in map view
theresmf Sep 30, 2021
4610e64
Turning direction in 360 resets yaw and pitch to default
theresmf Sep 30, 2021
2cbbdcd
Animation speed for 360 is slower than planar to make up for longer l…
theresmf Sep 30, 2021
eaf45e8
WIP
theresmf Oct 6, 2021
1c041af
Zoom for 360 without the need for recoil state
theresmf Oct 7, 2021
d8bf98b
Installed react pannellum fork for easier customization
theresmf Oct 7, 2021
6ec5efd
Added debug configuration for vs code
theresmf Oct 7, 2021
59d1103
Forked Pannellum and made changes to source code. Changed zoom back t…
theresmf Oct 8, 2021
b23e7a8
Merged with master
theresmf Oct 8, 2021
aaaf082
Fullscreen option for 360 viewer
theresmf Oct 8, 2021
3aa8a2f
Fullscreen for 360 viewer disabled in history mode
theresmf Oct 8, 2021
c884927
Removed Dekkekamera from filter selection and fixed a bug related to …
theresmf Oct 11, 2021
7094865
Corrected typename for api call in map layer for 360 images
theresmf Oct 11, 2021
d629fea
Year selection menu only shows years with available images for the se…
theresmf Oct 11, 2021
cae9490
Merged new url-parameters and new geonorge-api from master
theresmf Oct 13, 2021
9872c0e
Added new filter icon
theresmf Oct 14, 2021
42f19ef
Styled filter menus
Oct 14, 2021
59501ff
WIP - button to reset 360 view
Oct 14, 2021
55bb62e
ImageType in url is updated when switching between image types in his…
Oct 15, 2021
3e3a42c
History view works for imagePoints with both 360 images and planar im…
Oct 15, 2021
6738ab1
Rename variable for available years
Oct 18, 2021
7bc70a0
Retain zoom level for 360 images when navigation between imagepoints
Oct 18, 2021
53a1d85
Add 360 icon to resources
theresmf Oct 18, 2021
02ee9aa
Merge branch 'filtering-and-360' of https://github.com/NPRA/VegBilder…
Oct 18, 2021
bcd68c7
Only apply mouse eventhandlers e.g. click-zoom, drag, on non-360-imag…
Oct 18, 2021
febb4c3
Add whydidyourender to dev dependencies
Oct 18, 2021
89e834a
Only apply mouse eventhandlers e.g. click-zoom, drag, on non-360-imag…
Oct 18, 2021
47b2c60
Pannellum does not rerender when history view is toggled
theresmf Oct 19, 2021
545d9fa
Refactor and improve zoom for 360 image view
theresmf Oct 19, 2021
c91bf4a
Add background shown when panorama is loading, remove loading spinner…
theresmf Oct 20, 2021
51599f9
Add marker to show current view relative to driving direction
theresmf Oct 21, 2021
5ceb8d8
Add icon to preview in map and to history view to indicate that an im…
theresmf Oct 21, 2021
022559b
WIP - crop preview of panorama images in map view
theresmf Oct 25, 2021
9be8a4c
Merge local branch 'filtering-and-360' with diverged remote
Oct 25, 2021
db3f0a1
Crop panorama image preview in map view
Oct 25, 2021
fde10d3
Crop panorama image in history view
Oct 25, 2021
441c3ca
Redesign history view to better label 360 images and for better acces…
Oct 26, 2021
bd5d00c
Add label in image view for 360 images to indicate 360 capabilities a…
Oct 26, 2021
5938614
Change imageview layout on ipads with portrait orientation
Oct 27, 2021
ed1d07b
Refactor and add comment to explain useEffect dependency warning
theresmf Oct 28, 2021
b3d4888
Show default cursor when hovering on 360 image label
theresmf Oct 28, 2021
1b21376
WIP - If a new year or imagetype is selected in imageview for which t…
theresmf Oct 29, 2021
8d5a01b
Retain the current filter selection state and url with an image inste…
Nov 1, 2021
d85cfc0
Remove outdated 360 image preview code
Nov 1, 2021
838db10
Destroy Pannellum when exiting 360 view to avoid generating too many …
Nov 1, 2021
b42afff
Remove unused imports and variables
Nov 1, 2021
3f8d5be
Merged remote version with local
Nov 1, 2021
d5bb195
Increase specificity of css selector for compass to overwrite standar…
Nov 1, 2021
e995e3b
fixup! Destroy Pannellum when exiting 360 view to avoid generating to…
Nov 1, 2021
d9b4af3
Move the logic og resizing the 360 view when opening and closing hist…
Nov 2, 2021
7766c5e
Make sure the mini map is updated when switching between image points…
Nov 2, 2021
62aa782
Add key to buttons to remove react warning and rename selectors to re…
Nov 5, 2021
97c9d4d
Add useEffect to changeMapView to avoid updating state during render
Nov 5, 2021
f989890
Refactor history component and change check on distance variable to h…
theresmf Nov 8, 2021
a9bd3c1
Move function inside useEffect to avoid dependency warning
theresmf Nov 8, 2021
aa577c9
Do not update the map if the selected filter does not contain an imag…
theresmf Nov 9, 2021
bac9dcd
Remove eslint warning about useEffect dependencies deemed acceptable
theresmf Nov 9, 2021
b6ba745
Center minimap on new found imagePoint when changing imagetype in ima…
theresmf Nov 10, 2021
56070e2
Retain zoom level when changing directions in imageview and minor cle…
theresmf Nov 10, 2021
0789c27
Update names of maplayers to reach correct api endpoints and change p…
theresmf Nov 12, 2021
a18c9f8
Fix bug where changing filter a second time while on an imagePoint co…
theresmf Nov 16, 2021
ecefa68
Check if the selected imagetype has images on WFS before updating the…
theresmf Nov 16, 2021
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
20 changes: 12 additions & 8 deletions vegbilder-client/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"type": "pwa-chrome",
"request": "launch",
"name": "Launch chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
"webRoot": "${workspaceFolder}/src"
},
{
"type": "pwa-chrome",
"request": "attach",
"port": "9222",
"name": "attach to chrome",
"webRoot": "${workspaceFolder}/src"
}
]
}
}
3 changes: 2 additions & 1 deletion vegbilder-client/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"typescript.format.semicolons": "insert",
"javascript.format.semicolons": "insert",
"typescript.preferences.quoteStyle": "double",
"javascript.preferences.quoteStyle": "double"
"javascript.preferences.quoteStyle": "double",
"typescript.tsdk": "node_modules\\typescript\\lib"
}
22,256 changes: 70 additions & 22,186 deletions vegbilder-client/package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion vegbilder-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-leaflet": "^3.2.0",
"react-pannellum": "git://github.com/theresmf/react-pannellum.git#vegbilder-modifications",
"react-responsive": "^8.2.0",
"react-scripts": "^4.0.3",
"recoil": "^0.3.1",
Expand All @@ -42,6 +43,7 @@
"devDependencies": {
"@types/lodash": "^4.14.168",
"@types/react-leaflet": "^2.8.1",
"@types/react-responsive": "^8.0.2"
"@types/react-responsive": "^8.0.2",
"@welldone-software/why-did-you-render": "^6.2.1"
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { IBbox } from 'types';
import vegbilderOGC from './vegbilderOGC';

const getImagePointsInBbox = async (bbox: IBbox, year: number) => {
const getImagePointsInBbox = async (bbox: IBbox, typename: string) => {
const srsname = 'urn:ogc:def:crs:EPSG::4326';
const typename = `vegbilder_1_0:Vegbilder_${year}`;

const params = {
service: 'WFS',
version: '2.0.0',
request: 'GetFeature',
typenames: typename,
typename: typename,
startindex: 0,
count: 10000,
srsname: srsname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const settings = {
bboxSizeDecimals: 2, // Make sure this equals the number of decimals in bboxSizeInDegrees
};

const getImagePointsInTilesOverlappingBbox = async (bbox: IBbox, year: number) => {
const getImagePointsInTilesOverlappingBbox = async (bbox: IBbox, typename: string) => {
const { south, west, north, east } = bbox;
const { bboxSizeInDegrees, bboxSizeDecimals } = settings;

Expand All @@ -34,7 +34,7 @@ const getImagePointsInTilesOverlappingBbox = async (bbox: IBbox, year: number) =
}

const promises = fetchedBboxes.map(async (bbox) => {
return await getImagePointsInBbox(bbox, year);
return await getImagePointsInBbox(bbox, typename);
});

const responses = await Promise.all(promises);
Expand Down
28 changes: 21 additions & 7 deletions vegbilder-client/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
latLngZoomQueryParameterState,
viewQueryParamterState,
yearQueryParameterState,
vegsystemreferanseState
vegsystemreferanseState,
imageTypeQueryParameterState
} from 'recoil/selectors';
import useFetchNearestImagePoint from 'hooks/useFetchNearestImagePoint';
import { DEFAULT_COORDINATES, DEFAULT_VIEW, DEFAULT_ZOOM } from 'constants/defaultParamters';
Expand All @@ -24,7 +25,7 @@ import MobileLandingPage from './MobileLandingPage/MobileLandingPage';
import getVegByVegsystemreferanse from 'apis/NVDB/getVegByVegsystemreferanse';
import { getCoordinatesFromWkt } from 'utilities/latlngUtilities';
import { matchAndPadVegsystemreferanse } from 'utilities/vegsystemreferanseUtilities';
import { IImagePoint, queryParameterNames } from 'types';
import { imageType, IImagePoint, queryParameterNames } from 'types';
import useAsyncError from 'hooks/useAsyncError';

const useStyles = makeStyles({
Expand Down Expand Up @@ -80,17 +81,29 @@ const App = () => {
const [currentCoordinates, setCurrentCoordinates] = useRecoilState(latLngZoomQueryParameterState);
const [, setCurrentYear] = useRecoilState(yearQueryParameterState);
const [, setCurrentView] = useRecoilState(viewQueryParamterState);
const [currentImageType, setCurrentImageType] = useRecoilState(imageTypeQueryParameterState);
const [, setCurrentVegsystemreferanseState] = useRecoilState(vegsystemreferanseState);

const [snackbarVisible, setSnackbarVisible] = useState(false);
const [snackbarDuration, setSnackbarDuration] = useState(4000);
const [snackbarMessage, setSnackbarMessage] = useState('');
const isMobile = useIsMobile();

const searchParams = new URLSearchParams(window.location.search);
const imageTypeQuery = searchParams.get('imageType') as imageType;

//Setter imageType her og ikke i useEffect for å unngå at recoil state blir feil i oppstart av app.
if (!imageTypeQuery) {
setCurrentImageType("planar");
} else if (imageTypeQuery !== "planar") {
setCurrentImageType(imageTypeQuery);
}


const onbardingIsHidden = localStorage.getItem('HideSplashOnStartup') === 'true';
const [showPageInformation, setShowPageInformation] = useState(!onbardingIsHidden);

const searchParams = new URLSearchParams(window.location.search);

const requester = searchParams.get('requester');
let capitalisedRequesterName = requester && requester.charAt(0).toUpperCase() + requester.slice(1);

Expand Down Expand Up @@ -160,7 +173,7 @@ const App = () => {

const openAppByVegsystemreferanse = async (
vegsystemreferanse: string | undefined,
year: string | null
year: string | null,
) => {
if (vegsystemreferanse) {
const vegResponse = await getVegByVegsystemreferanse(vegsystemreferanse);
Expand All @@ -175,7 +188,7 @@ const App = () => {

if (latlng) {
if (year !== 'latest' && year !== null) {
fetchNearestImagePointToYearAndCoordinates(latlng, parseInt(year)).then(
fetchNearestImagePointToYearAndCoordinates(latlng, parseInt(year), currentImageType).then(
(imagePoint: IImagePoint | undefined) => {
if (!imagePoint) {
setCurrentCoordinates({ ...latlng, zoom: 15 });
Expand Down Expand Up @@ -234,11 +247,11 @@ const App = () => {
else if (imageIdQuery && imageIdQuery.length > 1) {
if (latQuery && lngQuery && yearQuery && yearQuery !== 'latest') {
const latlng = { lat: parseFloat(latQuery), lng: parseFloat(lngQuery) };
fetchNearestImagePointToYearAndCoordinatesByImageId(latlng, parseInt(yearQuery));
fetchNearestImagePointToYearAndCoordinatesByImageId(latlng, parseInt(yearQuery), imageTypeQuery);
}
}

// Initialize year, zoom, lat, and lng when opening the app the default way
// Initialize year, imageType, zoom, lat, and lng when opening the app the default way
else {
if (!yearQuery) {
setCurrentYear('Nyeste');
Expand All @@ -250,6 +263,7 @@ const App = () => {
setCurrentView(DEFAULT_VIEW);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handleSnackbarClose = (reason: any) => {
Expand Down
3 changes: 2 additions & 1 deletion vegbilder-client/src/components/CloseButton/CloseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { IconButton } from '@material-ui/core';
import CloseIcon from '@material-ui/icons/Close';
import { makeStyles } from '@material-ui/styles';
import Theme from 'theme/Theme';

const useStyles = makeStyles(() => ({
closeButton: {
Expand Down Expand Up @@ -36,7 +37,7 @@ const CloseButton = ({ onClick, transparent, positionToTop, position }: ICloseBu
<IconButton
className={classes.closeButton}
style={{
background: transparent ? 'transparent' : '',
background: transparent ? 'transparent' : `${Theme.palette.common.grayDark}`,
top: positionToTop ?? '0.3125rem',
position: position ? position : 'absolute',
}}
Expand Down
Loading