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

[TEMPORARY] GeoChart in store #2

Closed
Closed
Changes from 6 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9162243
feat(geolocator): implement geolocator filters #closes1679
kaminderpal Jan 17, 2024
28edf46
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 17, 2024
056c7fb
feat(geolocator): refactor and fix performance issues of footer panel…
kaminderpal Jan 23, 2024
90074dd
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 23, 2024
616875e
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 23, 2024
b56d02d
Logger using green for MARKR now
Alex-NRCan Jan 23, 2024
87096b0
feat(geolocator): refactor and fix performance issues of footer panel…
kaminderpal Jan 23, 2024
a45398f
Merge pull request #1715 from Alex-NRCan/feat-logger-color
jolevesq Jan 23, 2024
dd62f34
Update logging.md
jolevesq Jan 23, 2024
493e1f3
feat(footerpanel): refactor and fix performance issues of footer pane…
kaminderpal Jan 24, 2024
979888f
Logs
Alex-NRCan Jan 24, 2024
07839fa
Merge pull request #1717 from Alex-NRCan/feat-getFeatureInfoLogs
jolevesq Jan 24, 2024
493d477
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 24, 2024
a813b01
feat(footerpanel): refactor and fix performance issues of footer pane…
kaminderpal Jan 24, 2024
d878ec6
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 24, 2024
3d75a1f
Merge pull request #1711 from kaminderpal/1702-footer-panel
jolevesq Jan 24, 2024
2e92bf1
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 24, 2024
61925ee
More logs
Alex-NRCan Jan 24, 2024
4358552
Merge pull request #1719 from Alex-NRCan/feat-morelogs
jolevesq Jan 24, 2024
2b1abed
feat(geolocator): fix geolocator fiilters #closes1679
kaminderpal Jan 24, 2024
5fbf478
feat(geolocator): fix geolocator fiilters #closes1679
kaminderpal Jan 24, 2024
a55a437
feat(geolocator): fix max width of filters #closes1679
kaminderpal Jan 24, 2024
16bb833
feat(geolocator): fix disabled state of filters #closes1679
kaminderpal Jan 24, 2024
95b1077
feat(geolocator): fix zoomtoextent for corrds #closes1679
kaminderpal Jan 24, 2024
4320023
feat(geolocator): fix filters #closes1679
kaminderpal Jan 24, 2024
0ea44a0
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 25, 2024
95422f8
feat(geolocator): add comment for geolcator url #closes1679
kaminderpal Jan 25, 2024
7fca7ea
feat(geolocator): add comment for geolcator url #closes1679
kaminderpal Jan 25, 2024
687cdad
Merge pull request #1698 from kaminderpal/1679-geolocator-filters
jolevesq Jan 25, 2024
fc06c5f
Fix for the feature-info-propagation to store
Alex-NRCan Jan 25, 2024
6f11192
feat(geolocator): fixes #closes1679
kaminderpal Jan 25, 2024
43fe31d
Merge pull request #1729 from Alex-NRCan/fix-feature-info-propagation
jolevesq Jan 25, 2024
eb41d97
Merge branch 'develop' of https://github.com/Canadian-Geospatial-Plat…
kaminderpal Jan 25, 2024
40e39c8
Merge pull request #1730 from kaminderpal/1679-geolocator-filters-fix
jolevesq Jan 25, 2024
5c0593e
GeoChart in the Store
Alex-NRCan Jan 25, 2024
7b09ba3
New callback when a selected tab has changed
Alex-NRCan Jan 25, 2024
cb1641a
Integrated comments
Alex-NRCan Jan 26, 2024
64293fa
Making setActiveTab fit with the store too in footer-tabs (removed fr…
Alex-NRCan Jan 26, 2024
c7bb268
Not using useTranslation
Alex-NRCan Jan 26, 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
3 changes: 2 additions & 1 deletion docs/programming/logging.md
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ The logger class can be found here: [https://github.com/Canadian-Geospatial-Pla
The `logger` provides functions for high-level logging abstraction following best-practices concepts and the following constants:
```ts
// The most detailed messages. Disabled by default. Only shows if actually running in dev environment, never shown otherwise.
export const LOG_TRACE_DETAILED = 1;
export const LOG_TRACE_DETAILED 1;
// For tracing useEffect unmounting. Disabled by default. Only shows if running in dev environment or GEOVIEW_LOG_ACTIVE key is set in local storage.
export const LOG_TRACE_USE_EFFECT_UNMOUNT = 2;
// For tracing rendering. Disabled by default. Only shows if running in dev environment or GEOVIEW_LOG_ACTIVE key is set in local storage.
@@ -31,6 +31,7 @@ export const LOG_WARNING = 40;
// For errors and exceptions that cannot be handled. Enabled by default. Shows all the time.
export const LOG_ERROR = 50;
```
![image](https://github.com/Canadian-Geospatial-Platform/geoview/assets/3472990/0e9b93a7-c660-4768-ac8d-aa0b37f04d0b)

The `logger` is active when (1) running in dev environment or (2) the local storage `GEOVIEW_LOG_ACTIVE` key is set.

Original file line number Diff line number Diff line change
@@ -239,7 +239,10 @@ export class LegendEventProcessor extends AbstractEventProcessor {
return layer.layerStatus === 'processed';
});
if (validFirstLayer) {
// Set the selected layer path in the store
getGeoViewStore(mapId).getState().layerState.actions.setSelectedLayerPath(validFirstLayer.layerPath);
// Log
logger.logDebug(`Selected layer ${validFirstLayer.layerPath}`);
} else {
// Log
logger.logError(`Couldn't select a layer as none were processed in time`);
Original file line number Diff line number Diff line change
@@ -75,7 +75,6 @@ export function Appbar(): JSX.Element {
useEffect(() => {
// Log
logger.logTraceUseEffect('APP-BAR - addButtonPanel', mapId);
logger.logDebug('APP-BAR - addButtonPanel', mapId); // remove this one when things stabilize

const appBarPanelCreateListenerFunction = (payload: PayloadBaseClass) => {
if (payloadIsAButtonPanel(payload)) addButtonPanel(payload);
Original file line number Diff line number Diff line change
@@ -270,7 +270,6 @@ export function FooterTabs(): JSX.Element | null {
useEffect(() => {
// Log
logger.logTraceUseEffect('FOOTER-TABS - mount');
logger.logDebug('FOOTER-TABS - mount'); // remove this one when things stabilize

if (footerTabsConfig && footerTabsConfig.tabs.core.includes('legend')) {
// create new tab and add the Layers component to the footer tab
4 changes: 2 additions & 2 deletions packages/geoview-core/src/core/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ const formatTime = (date: Date): string => {
type ColorCode = {
darkorange: string;
dodgerblue: string;
tomato: string;
yellowgreen: string;
green: string;
plum: string;
turquoise: string;
@@ -227,7 +227,7 @@ export class ConsoleLogger {
if (hours) logMsg = `${hours} hours, ${mins} minutes, ${seconds} seconds, and ${timeSpan} ms`;

// Redirect
this.logLevel(LOG_DEBUG, 'MARKR', 'tomato', logMsg, ...message, `(${markerKey})`); // Not a typo, 5 characters for alignment
this.logLevel(LOG_DEBUG, 'MARKR', 'yellowgreen', logMsg, ...message, `(${markerKey})`); // Not a typo, 5 characters for alignment
};

/**
Original file line number Diff line number Diff line change
@@ -782,27 +782,53 @@ export abstract class AbstractGeoViewLayer {
*/
async getFeatureInfo(queryType: QueryType, layerPath: string, location: TypeLocation = null): Promise<TypeArrayOfFeatureInfoEntries> {
try {
// Get the layer config
const layerConfig = this.getLayerConfig(layerPath);

if (!layerConfig || !layerConfig.source?.featureInfo?.queryable) return [];

// Log
logger.logTraceCore('abstract-geoview-layers.getFeatureInfo', queryType, layerPath);
const logMarkerKey = `${queryType} | ${layerPath}`;
logger.logMarkerStart(logMarkerKey);

let promiseGetFeature: Promise<TypeArrayOfFeatureInfoEntries>;
switch (queryType) {
case 'all':
return await this.getAllFeatureInfo(layerPath);
promiseGetFeature = this.getAllFeatureInfo(layerPath);
break;
case 'at_pixel':
return await this.getFeatureInfoAtPixel(location as Pixel, layerPath);
promiseGetFeature = this.getFeatureInfoAtPixel(location as Pixel, layerPath);
break;
case 'at_coordinate':
return await this.getFeatureInfoAtCoordinate(location as Coordinate, layerPath);
promiseGetFeature = this.getFeatureInfoAtCoordinate(location as Coordinate, layerPath);
break;
case 'at_long_lat':
return await this.getFeatureInfoAtLongLat(location as Coordinate, layerPath);
promiseGetFeature = this.getFeatureInfoAtLongLat(location as Coordinate, layerPath);
break;
case 'using_a_bounding_box':
return await this.getFeatureInfoUsingBBox(location as Coordinate[], layerPath);
promiseGetFeature = this.getFeatureInfoUsingBBox(location as Coordinate[], layerPath);
break;
case 'using_a_polygon':
return await this.getFeatureInfoUsingPolygon(location as Coordinate[], layerPath);
promiseGetFeature = this.getFeatureInfoUsingPolygon(location as Coordinate[], layerPath);
break;
default:
// Default is empty array
promiseGetFeature = Promise.resolve([]);

// Log
logger.logWarning(`Queries using ${queryType} are invalid.`);
return [];
break;
}

// Wait for results
const arrayOfFeatureInfoEntries = await promiseGetFeature;

// Log
logger.logMarkerCheck(logMarkerKey, 'to getFeatureInfo', arrayOfFeatureInfoEntries);

// Return the result
return arrayOfFeatureInfoEntries;
} catch (error) {
// Log
logger.logError(error);
@@ -919,6 +945,9 @@ export abstract class AbstractGeoViewLayer {
// This will register all existing layers to a newly created layer set.
this.registerToLayerSetListenerFunctions[layerPath].requestLayerInventory = (payload) => {
if (payloadIsRequestLayerInventory(payload)) {
// Log
logger.logTraceDetailed('abstract-geoview-layers on requestLayerInventory', this.mapId, payload);

const { layerSetId } = payload;
api.event.emit(LayerSetPayload.createLayerRegistrationPayload(this.mapId, layerPath, 'add', layerSetId));
}
@@ -934,6 +963,9 @@ export abstract class AbstractGeoViewLayer {
if (!this.registerToLayerSetListenerFunctions[layerPath].queryLegend) {
this.registerToLayerSetListenerFunctions[layerPath].queryLegend = (payload) => {
if (payloadIsQueryLegend(payload)) {
// Log
logger.logTraceDetailed('abstract-geoview-layers on queryLegend', this.mapId, payload);

this.getLegend(layerPath).then((queryResult) => {
api.event.emit(GetLegendsPayload.createLegendInfoPayload(this.mapId, layerPath, queryResult));
});
@@ -950,13 +982,17 @@ export abstract class AbstractGeoViewLayer {
if (!this.registerToLayerSetListenerFunctions[layerPath].queryLayer) {
if ('featureInfo' in layerConfig.source! && layerConfig.source.featureInfo?.queryable) {
// Listen to events that request to query a layer and return the resultset to the requester.
this.registerToLayerSetListenerFunctions[layerPath].queryLayer = (payload) => {
this.registerToLayerSetListenerFunctions[layerPath].queryLayer = async (payload) => {
if (payloadIsQueryLayer(payload)) {
// Log
logger.logTraceDetailed('abstract-geoview-layers on queryLayer', this.mapId, payload);

const { queryType, location, eventType, disabledLayers } = payload;
if (disabledLayers[layerPath]) return;
this.getFeatureInfo(queryType, layerPath, location).then((queryResult) => {
api.event.emit(GetFeatureInfoPayload.createQueryResultPayload(this.mapId, layerPath, queryType, queryResult, eventType));
});

// Get Feature Info
const queryResult = await this.getFeatureInfo(queryType, layerPath, location);
api.event.emit(GetFeatureInfoPayload.createQueryResultPayload(this.mapId, layerPath, queryType, queryResult, eventType));
}
};

4 changes: 4 additions & 0 deletions packages/geoview-core/src/geo/map/map-viewer.ts
Original file line number Diff line number Diff line change
@@ -161,6 +161,9 @@ export class MapViewer {
EVENT_NAMES.LAYER.EVENT_LAYER_ADDED,
(payload) => {
if (payloadIsGeoViewLayerAdded(payload)) {
// Log
logger.logTraceDetailed('map-viewer on EVENT_NAMES.LAYER.EVENT_LAYER_ADDED', this.mapId, payload);

const { geoviewLayer } = payload;
MapEventProcessor.setLayerZIndices(this.mapId);
if (geoviewLayer.allLayerEntryConfigProcessed()) {
@@ -209,6 +212,7 @@ export class MapViewer {
});
if (allGeoviewLayerReady) {
// Log
logger.logInfo('Map is ready', this.mapId);
logger.logMarkerCheck(`mapReady-${this.mapId}`, 'for map to be ready');
MapEventProcessor.setMapLoaded(this.mapId);
clearInterval(layerInterval);