Skip to content

Commit f7feda2

Browse files
devinleighsmithSmith
and
Smith
authored
Psp 8635, psp-8636, psp-8638 (#4104)
* psp-8636 limiting drafts to 4 decimal places no longer accurate to actual marker. * psp-8636 ensure local geoserver mimics deployed geoserver decimal accuracy. * psp-8638 ensure parcel map layer displays immediately. * psp-8635 do not block loading the property when other tabs are loading in a file. --------- Co-authored-by: Smith <[email protected]>
1 parent 34fcef0 commit f7feda2

File tree

12 files changed

+75
-47
lines changed

12 files changed

+75
-47
lines changed

source/backend/api/Pims.Api.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<Project Sdk="Microsoft.NET.Sdk.Web">
33
<PropertyGroup>
44
<UserSecretsId>0ef6255f-9ea0-49ec-8c65-c172304b4926</UserSecretsId>
5-
<Version>5.3.1-81.35</Version>
6-
<Version>5.3.1-81.35</Version>
7-
<AssemblyVersion>5.3.1.81</AssemblyVersion>
5+
<Version>5.3.2-81.35</Version>
6+
<Version>5.3.2-81.35</Version>
7+
<AssemblyVersion>5.3.2.81</AssemblyVersion>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99
<ProjectGuid>16BC0468-78F6-4C91-87DA-7403C919E646</ProjectGuid>
1010
<TargetFramework>net8.0</TargetFramework>

source/frontend/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend",
3-
"version": "5.3.1-81.35",
3+
"version": "5.3.2-81.35",
44
"private": true,
55
"dependencies": {
66
"@bcgov/bc-sans": "1.0.1",

source/frontend/src/components/common/mapFSM/MapStateMachineContext.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface IMapStateMachineContext {
6262
toggleMapLayer: () => void;
6363
setFilePropertyLocations: (locations: LatLngLiteral[]) => void;
6464
setMapLayers: (layers: ILayerItem[]) => void;
65+
setDefaultMapLayers: (layers: ILayerItem[]) => void;
6566

6667
setVisiblePimsProperties: (propertyIds: number[]) => void;
6768
setShowDisposed: (show: boolean) => void;
@@ -270,6 +271,13 @@ export const MapStateMachineProvider: React.FC<React.PropsWithChildren<unknown>>
270271
[serviceSend],
271272
);
272273

274+
const setDefaultMapLayers = useCallback(
275+
(activeLayers: ILayerItem[]) => {
276+
serviceSend({ type: 'DEFAULT_MAP_LAYERS', activeLayers });
277+
},
278+
[serviceSend],
279+
);
280+
273281
const setVisiblePimsProperties = useCallback(
274282
(propertyIds: number[]) => {
275283
serviceSend({ type: 'SET_VISIBLE_PROPERTIES', propertyIds });
@@ -366,6 +374,7 @@ export const MapStateMachineProvider: React.FC<React.PropsWithChildren<unknown>>
366374
setShowDisposed,
367375
setShowRetired,
368376
setMapLayers,
377+
setDefaultMapLayers,
369378
changeSidebar,
370379
}}
371380
>

source/frontend/src/components/common/mapFSM/machineDefinition/mapMachine.ts

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ const featureViewStates = {
2424
TOGGLE_LAYERS: {
2525
target: 'layerControl',
2626
},
27+
DEFAULT_MAP_LAYERS: {
28+
actions: assign({ activeLayers: (_, event: any) => event.activeLayers }),
29+
},
2730
},
2831
},
2932
selecting: {

source/frontend/src/components/maps/MapLeafletView.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { ZoomOutButton } from './leaflet/Control/ZoomOut/ZoomOutButton';
2727
import { LayerPopupContainer } from './leaflet/LayerPopup/LayerPopupContainer';
2828
import { InventoryLayer } from './leaflet/Layers/InventoryLayer';
2929
import { LeafletLayerListener } from './leaflet/Layers/LeafletLayerListener';
30+
import { useConfiguredMapLayers } from './leaflet/Layers/useConfiguredMapLayers';
3031
import { MapEvents } from './leaflet/MapEvents/MapEvents';
3132
import * as Styled from './leaflet/styles';
3233

@@ -55,6 +56,7 @@ const MapLeafletView: React.FC<React.PropsWithChildren<MapLeafletViewProps>> = (
5556
const popupRef = useRef<LeafletPopup>(null);
5657

5758
const mapRef = useRef<LeafletMap | null>(null);
59+
const layers = useConfiguredMapLayers();
5860

5961
const [activeFeatureLayer, setActiveFeatureLayer] = useState<L.GeoJSON>();
6062

@@ -153,15 +155,8 @@ const MapLeafletView: React.FC<React.PropsWithChildren<MapLeafletViewProps>> = (
153155
});
154156
}, []);
155157

156-
const fitMapBounds = () => {
157-
if (mapRef.current) {
158-
// TODO: Is this necessary?
159-
//mapRef.current.fitBounds(defaultBounds);
160-
}
161-
};
162-
163158
const handleMapReady = () => {
164-
fitMapBounds();
159+
mapMachine.setDefaultMapLayers(layers);
165160
};
166161

167162
const handleMapCreated = (mapInstance: L.Map) => {

source/frontend/src/components/maps/leaflet/Control/LayersControl/LayersMenu.tsx

+3-30
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'react-simple-tree-menu/dist/main.css';
22

33
import { Form as FormikForm, Formik, getIn, useFormikContext } from 'formik';
44
import noop from 'lodash/noop';
5-
import React, { useContext, useEffect, useMemo } from 'react';
5+
import React, { useEffect } from 'react';
66
import Form from 'react-bootstrap/Form';
77
import ListGroup from 'react-bootstrap/ListGroup';
88
import { MdArrowDropDown, MdArrowRight } from 'react-icons/md';
@@ -12,9 +12,7 @@ import styled from 'styled-components';
1212
import variables from '@/assets/scss/_variables.module.scss';
1313
import { FormSection } from '@/components/common/form/styles';
1414
import { useMapStateMachine } from '@/components/common/mapFSM/MapStateMachineContext';
15-
import { TenantContext } from '@/tenants';
1615

17-
import { layersTree } from './data';
1816
import { ILayerItem } from './types';
1917

2018
const ParentNode = styled(ListGroup.Item)`
@@ -223,35 +221,10 @@ const LayersTree: React.FC<React.PropsWithChildren<{ items: TreeMenuItem[] }>> =
223221
* This component displays the layers group menu
224222
*/
225223
export const LayersMenu: React.FC<React.PropsWithChildren<unknown>> = () => {
226-
const {
227-
tenant: { layers: confLayers },
228-
} = useContext(TenantContext);
229-
const layers = useMemo(
230-
() =>
231-
layersTree.map((parent, parentIndex) => {
232-
//add any layers defined in the configuration.
233-
const layer = confLayers?.find(cl => cl.key === parent.key);
234-
235-
const layerNodes = [...(layer?.nodes ?? [])];
236-
const parentNodes =
237-
parent?.nodes?.filter(node => !layerNodes.find(layerNode => layerNode.id === node.id)) ??
238-
[];
239-
const allNodes = [...parentNodes, ...layerNodes];
240-
241-
return {
242-
...parent,
243-
nodes: allNodes?.map((node: any, index) => ({
244-
...node,
245-
zIndex: (parentIndex + 1) * index,
246-
opacity: node?.opacity !== undefined ? Number(node?.opacity) : 0.8,
247-
})),
248-
};
249-
}),
250-
[confLayers],
251-
);
224+
const { activeLayers: layers } = useMapStateMachine();
252225

253226
return (
254-
<Formik initialValues={{ layers }} onSubmit={noop}>
227+
<Formik initialValues={{ layers }} onSubmit={noop} enableReinitialize>
255228
{() => (
256229
<FormikForm>
257230
<MapLayerSynchronizer />

source/frontend/src/components/maps/leaflet/Layers/PointClusterer.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ export const PointClusterer: React.FC<React.PropsWithChildren<PointClustererProp
9292
return mapMachine.filePropertyLocations.map(x => {
9393
// The values on the feature are rounded to the 4th decimal. Do the same to the draft points.
9494
return {
95-
lat: parseFloat(x.lat.toFixed(4)),
96-
lng: parseFloat(x.lng.toFixed(4)),
95+
lat: x.lat,
96+
lng: x.lng,
9797
};
9898
});
9999
}, [mapMachine.filePropertyLocations]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { useContext } from 'react';
2+
3+
import { TenantContext } from '@/tenants';
4+
5+
import { layersTree } from '../Control/LayersControl/data';
6+
7+
export const useConfiguredMapLayers = () => {
8+
const {
9+
tenant: { layers: confLayers },
10+
} = useContext(TenantContext);
11+
const layers = layersTree.map((parent, parentIndex) => {
12+
//add any layers defined in the configuration.
13+
const layer = confLayers?.find(cl => cl.key === parent.key);
14+
15+
const layerNodes = [...(layer?.nodes ?? [])];
16+
const parentNodes =
17+
parent?.nodes?.filter(node => !layerNodes.find(layerNode => layerNode.id === node.id)) ?? [];
18+
const allNodes = [...parentNodes, ...layerNodes];
19+
20+
return {
21+
...parent,
22+
nodes: allNodes?.map((node: any, index) => ({
23+
...node,
24+
zIndex: (parentIndex + 1) * index,
25+
opacity: node?.opacity !== undefined ? Number(node?.opacity) : 0.8,
26+
})),
27+
};
28+
});
29+
return layers;
30+
};

source/frontend/src/features/mapSideBar/shared/detail/PropertyFileContainer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const PropertyFileContainer: React.FunctionComponent<
123123
content: (
124124
<PropertyDetailsTabView
125125
property={propertyViewForm}
126-
loading={composedProperties.composedLoading ?? false}
126+
loading={composedProperties?.apiWrapper?.loading ?? false}
127127
/>
128128
),
129129
key: InventoryTabNames.property,

source/frontend/src/features/properties/map/__snapshots__/MapContainer.test.tsx.snap

+16
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,22 @@ exports[`MapContainer > Renders the map 1`] = `
485485
<div
486486
class="leaflet-pane leaflet-tile-pane"
487487
>
488+
<div
489+
class="leaflet-layer "
490+
style="z-index: 18;"
491+
>
492+
<div
493+
class="leaflet-tile-container leaflet-zoom-animated"
494+
style="z-index: 20; left: 0px; top: 0px;"
495+
>
496+
<img
497+
alt=""
498+
class="leaflet-tile"
499+
src="https://openmaps.gov.bc.ca/geo/pub/WHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW/ows?&service=WMS&request=GetMap&layers=pub%3AWHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW&styles=&format=image%2Fpng&transparent=true&version=1.1.1&key=parcelBoundaries&label=Parcel%20Boundaries&on=true&url=https%3A%2F%2Fopenmaps.gov.bc.ca%2Fgeo%2Fpub%2FWHSE_CADASTRE.PMBC_PARCEL_FABRIC_POLY_SVW%2Fows%3F&id=parcelLayer&color=%23E9AD34&width=256&height=256&srs=EPSG%3A3857&bbox=-14401959.121379772,6887893.492833805,-13775786.985667607,7514065.628545967"
500+
style="width: 256px; height: 256px; left: -214px; top: -231px;"
501+
/>
502+
</div>
503+
</div>
488504
<div
489505
class="leaflet-layer "
490506
style="z-index: 0;"

source/frontend/src/mocks/mapFSM.mock.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
emptyPmbcFeatureCollection,
66
} from '@/components/common/mapFSM/models';
77
import { defaultBounds } from '@/components/maps/constants';
8+
import { layersTree } from '@/components/maps/leaflet/Control/LayersControl/data';
89

910
export const mapMachineBaseMock: IMapStateMachineContext = {
1011
requestFlyToBounds: vi.fn(),
@@ -34,7 +35,7 @@ export const mapMachineBaseMock: IMapStateMachineContext = {
3435

3536
filePropertyLocations: [],
3637
activePimsPropertyIds: [],
37-
activeLayers: [],
38+
activeLayers: layersTree,
3839
isSelecting: false,
3940
isFiltering: false,
4041
isShowingMapLayers: false,
@@ -64,4 +65,5 @@ export const mapMachineBaseMock: IMapStateMachineContext = {
6465
setShowRetired: vi.fn(),
6566
changeSidebar: vi.fn(),
6667
setMapLayers: vi.fn(),
68+
setDefaultMapLayers: vi.fn(),
6769
};

tools/geoserver/geoserver_data/psp/settings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<id>contact</id>
1212
</contact>
1313
<charset>UTF-8</charset>
14-
<numDecimals>4</numDecimals>
14+
<numDecimals>8</numDecimals>
1515
<verbose>true</verbose>
1616
<verboseExceptions>false</verboseExceptions>
1717
<metadata>

0 commit comments

Comments
 (0)