Skip to content

Commit c2c84f0

Browse files
authored
Multiple improvements over past 2 months (#3294)
* Fixing some map zooming in the map-tester and clarifying when the map is expected to be at certain position when calling the tests Simplified the app.tsx and app-start.tsx components with regards to the MapViewer instance (more clearly coupled) Removed the api.getMapViewer call which was happening in the aoi-panel component. Removed the MapEventProcessor.getMapViewer call which was happening in the overview-map component. Removed 'MapEventProcessor.getMapViewer' from add-new-layer.tsx component Removed the MapEventProcessor.getMapViewerLayerAPI reference call from geochart.tsx Specialized the 'MapEventProcessor.getMapViewerPlugins' call in footer-bar.tsx Centralized the loading and adding of a plugin into the MapEventProcessor The bounds for a layer are now initialized in the store when the layer is 'created', not only when it's 'loaded' in the layer status. The layer source and the tileGrid() can be ready, before the layer status is loaded, which we want, especially when the content of the layer is outside the map extent. getFeatureInfo now returns a promise to inform when the geometries have been loaded in the features array. New details test-suite Improved the setStyleItemVisibility to return a promise which resolves when the renderer is done on the layer enabling developer to await on the style change if they so wish. Rebased AOI Panel small adjustment Review Better geochart Small fixes to DEFAULT_WMS_LAYER_GROUP_FULL_SUB_LAYERS and fixing the test suite accordingly, adding tests too.. Added some covariant returns on the geoview layer config for the config and layer processing classes Improved the details-panel and added featureHaveGeometry to the store to provide a hook if needed Fixing metadataaccesspath and dataaccesspath urls, not doing the split '?' anymore, because of proxy Removed the EsriDynamic for raster via geocore from the test suite, because the UUID changed in GeocoreAPI :( Removed Mundialis from our test suite, because service is acting inconsistently recently :( Fixes for the tests suite * Fix for the details panel Minor typing adjustments * Nothing * Comments
1 parent f5dc6c5 commit c2c84f0

File tree

123 files changed

+3117
-1420
lines changed

Some content is hidden

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

123 files changed

+3117
-1420
lines changed

packages/geoview-about-panel/src/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class AboutPanelPlugin extends AppBarPlugin {
7777
/**
7878
* Overrides the onCreateButtonProps to pass the correct props
7979
* @returns {IconButtonPropsExtend} The icon button props
80+
* @override
8081
*/
8182
override onCreateButtonProps(): IconButtonPropsExtend {
8283
// Button props
@@ -92,6 +93,7 @@ class AboutPanelPlugin extends AppBarPlugin {
9293
/**
9394
* Overrides the creation of the content properties of this AboutPanel AppBar Plugin.
9495
* @returns {TypePanelProps} The TypePanelProps for the AboutPanel AppBar Plugin
96+
* @override
9597
*/
9698
override onCreateContentProps(): TypePanelProps {
9799
return {
@@ -105,6 +107,7 @@ class AboutPanelPlugin extends AppBarPlugin {
105107
/**
106108
* Overrides the content creation of the AppBar Plugin
107109
* @returns {JSX.Element} The about panel content
110+
* @override
108111
*/
109112
override onCreateContent = (): JSX.Element => {
110113
return <AboutPanel config={this.getConfig()} />;

packages/geoview-aoi-panel/src/aoi-panel.tsx

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import type { TypeWindow } from 'geoview-core/core/types/global-types';
22
import type { Extent } from 'geoview-core/api/types/map-schema-types';
3+
import { Projection } from 'geoview-core/geo/utils/projection';
4+
import { useMapProjection, useMapStoreActions } from 'geoview-core/core/stores/store-interface-and-intial-values/map-state';
5+
import { useGeoViewMapId } from 'geoview-core/core/stores/geoview-store';
6+
import { MapEventProcessor } from 'geoview-core/api/event-processors/event-processor-children/map-event-processor';
37
import { logger } from 'geoview-core/core/utils/logger';
4-
import { useMapStoreActions } from 'geoview-core/core/stores/store-interface-and-intial-values/map-state';
58
import { getSxClasses } from './area-of-interest-style';
69

710
interface AoiPanelProps {
8-
mapId: string;
911
config: TypeAoiProps;
1012
}
1113

@@ -24,40 +26,57 @@ export type TypeAoiProps = {
2426
};
2527

2628
export function AoiPanel(props: AoiPanelProps): JSX.Element {
27-
const { mapId, config } = props;
29+
const { config } = props;
2830
const { aoiList } = config;
2931

3032
const { cgpv } = window as TypeWindow;
31-
const { api, ui } = cgpv;
33+
const { ui } = cgpv;
34+
const { useCallback } = cgpv.reactUtilities.react;
3235

33-
const myMap = api.getMapViewer(mapId);
3436
const { Card, Box } = ui.elements;
3537

3638
const theme = ui.useTheme();
3739
const sxClasses = getSxClasses(theme);
3840

41+
const mapId = useGeoViewMapId();
42+
const mapProjection = useMapProjection();
3943
const { highlightBBox } = useMapStoreActions();
4044

45+
const handleOnClick = useCallback(
46+
(aoiItem: AoiItem) => {
47+
// Log
48+
logger.logTraceUseCallback('AOI-PANEL - handleOnClick');
49+
50+
// Project the extent from lonlatto map projection
51+
const extentInMapProjection = Projection.transformExtentFromProj(
52+
aoiItem.extent,
53+
Projection.getProjectionLonLat(),
54+
Projection.getProjectionFromString(`EPSG:${mapProjection}`)
55+
);
56+
57+
// Zoom to extent and highlight
58+
MapEventProcessor.zoomToExtent(mapId, extentInMapProjection, { maxZoom: 14 })
59+
.then(() => {
60+
// Highlight
61+
highlightBBox(extentInMapProjection, false);
62+
})
63+
.catch((error: unknown) => {
64+
// Log
65+
logger.logPromiseFailed('in zoomToLonLatExtentOrCoordinate', error);
66+
});
67+
},
68+
[mapId, mapProjection, highlightBBox]
69+
);
70+
4171
return (
4272
<Box sx={sxClasses.aoiCard}>
4373
{aoiList.map((aoiItem: AoiItem, index) => {
4474
return (
4575
<Card
4676
tabIndex={0}
4777
className="aoiCardThumbnail"
48-
onClick={() => {
49-
myMap
50-
.zoomToLonLatExtentOrCoordinate(aoiItem.extent, { maxZoom: 14 })
51-
.then(() => {
52-
highlightBBox(myMap.convertExtentLonLatToMapProj(aoiItem.extent), false);
53-
})
54-
.catch((error: unknown) => {
55-
// Log
56-
logger.logPromiseFailed('in zoomToLonLatExtentOrCoordinate', error);
57-
});
58-
}}
59-
// eslint-disable-next-line react/no-array-index-key
60-
key={index}
78+
onClick={() => handleOnClick(aoiItem)}
79+
key={aoiItem.aoiTitle}
6180
title={aoiItem.aoiTitle}
6281
contentCard={
6382
// eslint-disable-next-line react/jsx-no-useless-fragment

packages/geoview-aoi-panel/src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class AoiPanelPlugin extends AppBarPlugin {
8080
}
8181

8282
override onCreateContent = (): JSX.Element => {
83-
return <AoiPanel mapId={this.mapViewer.mapId} config={this.getConfig()} />;
83+
return <AoiPanel config={this.getConfig()} />;
8484
};
8585

8686
/**

0 commit comments

Comments
 (0)