diff --git a/packages/geoview-core/public/configs/navigator/28-geocore.json b/packages/geoview-core/public/configs/navigator/28-geocore.json index 4d265953b33..139ba497d62 100644 --- a/packages/geoview-core/public/configs/navigator/28-geocore.json +++ b/packages/geoview-core/public/configs/navigator/28-geocore.json @@ -25,6 +25,10 @@ { "geoviewLayerType": "geoCore", "geoviewLayerId": "03ccfb5c-a06e-43e3-80fd-09d4f8f69703" + }, + { + "geoviewLayerType": "geoCore", + "geoviewLayerId": "6433173f-bca8-44e6-be8e-3e8a19d3c299" } ] }, diff --git a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts index ac657ef24c4..a0b89902274 100644 --- a/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts +++ b/packages/geoview-core/src/api/event-processors/event-processor-children/map-event-processor.ts @@ -412,15 +412,10 @@ export class MapEventProcessor extends AbstractEventProcessor { this.getMapStateProtected(mapId).setterActions.setPointerPosition(pointerPosition); } - static setClickCoordinates(mapId: string, clickCoordinates: TypeMapMouseInfo): Promise { - // Perform query via the feature info layer set process - const promise = this.getMapViewerLayerAPI(mapId).featureInfoLayerSet.queryLayers(clickCoordinates.lnglat); - + static setClickCoordinates(mapId: string, clickCoordinates: TypeMapMouseInfo): void { + // GV: We do not need to perform query, there is a handler on the map click in layer set. // Save in store this.getMapStateProtected(mapId).setterActions.setClickCoordinates(clickCoordinates); - - // Return the promise - return promise; } static setZoom(mapId: string, zoom: number): void { diff --git a/packages/geoview-core/src/core/app-start.tsx b/packages/geoview-core/src/core/app-start.tsx index 966775b9887..e8f66964dfc 100644 --- a/packages/geoview-core/src/core/app-start.tsx +++ b/packages/geoview-core/src/core/app-start.tsx @@ -1,4 +1,4 @@ -import { createContext, StrictMode, Suspense, useMemo } from 'react'; +import { createContext, Suspense, useMemo } from 'react'; import './translation/i18n'; import i18n from 'i18next'; @@ -81,9 +81,9 @@ function AppStart(props: AppStartProps): JSX.Element { - - - + {/* */} + + {/* */} diff --git a/packages/geoview-core/src/core/components/details/details-panel.tsx b/packages/geoview-core/src/core/components/details/details-panel.tsx index 830b706fb12..d2264680370 100644 --- a/packages/geoview-core/src/core/components/details/details-panel.tsx +++ b/packages/geoview-core/src/core/components/details/details-panel.tsx @@ -47,7 +47,6 @@ export function DetailsPanel({ fullWidth = false }: DetailsPanelType): JSX.Eleme const { addHighlightedFeature, removeHighlightedFeature } = useMapStoreActions(); // States - const [isChildRendered, setIsChildRendered] = useState(false); const [currentFeatureIndex, setCurrentFeatureIndex] = useState(0); const [selectedLayerPathLocal, setselectedLayerPathLocal] = useState(selectedLayerPath); const [arrayOfLayerListLocal, setArrayOfLayerListLocal] = useState([]); @@ -321,9 +320,6 @@ export function DetailsPanel({ fullWidth = false }: DetailsPanelType): JSX.Eleme // Log logger.logTraceUseCallback('DETAILS PANEL - handleFeatureNavigateChange', currentFeatureIndex); - // Reset shilcren state - setIsChildRendered(false); // Reset the render state - // Keep previous index for navigation prevFeatureIndex.current = currentFeatureIndex; @@ -347,11 +343,6 @@ export function DetailsPanel({ fullWidth = false }: DetailsPanelType): JSX.Eleme }, [setSelectedLayerPath] ); - - const handleChildRender = useCallback(() => { - logger.logMarkerCheck('DETAILS-MARKER', 'ddd child render'); - setIsChildRendered(true); - }, []); // #endregion // #region PROCESSING *********************************************************************************************** @@ -421,9 +412,8 @@ export function DetailsPanel({ fullWidth = false }: DetailsPanelType): JSX.Eleme */ const memoIsAllLayersQueryStatusProcessed = useMemo(() => { // Log - logger.logTraceUseMemo('DETAILS-PANEL - order layer status processing.'); + logger.logTraceUseMemo('DETAILS-PANEL - AllLayersQueryStatusProcessed.'); - logger.logMarkerCheck('DETAILS-MARKER', 'ddde memo processing', arrayOfLayerDataBatch); if (!arrayOfLayerDataBatch || arrayOfLayerDataBatch?.length === 0) return () => false; return () => arrayOfLayerDataBatch?.every((layer) => layer.queryStatus === FEATURE_INFO_STATUS.PROCESSED); @@ -439,19 +429,13 @@ export function DetailsPanel({ fullWidth = false }: DetailsPanelType): JSX.Eleme logger.logMarkerStart('DETAILS-MARKER'); const renderContent = (): JSX.Element | null => { if (!memoIsAllLayersQueryStatusProcessed()) { - logger.logMarkerCheck('DETAILS-MARKER', 'ddd skeleton', memoIsAllLayersQueryStatusProcessed()); return ; } - if (!memoIsAllLayersQueryStatusProcessed() && memoSelectedLayerDataFeatures && memoSelectedLayerDataFeatures.length === 0) { - logger.logMarkerCheck('DETAILS-MARKER', 'ddd null'); - return null; - } - if (memoSelectedLayerDataFeatures && memoSelectedLayerDataFeatures.length > 0) { // Get only the current feature const currentFeature = memoSelectedLayerDataFeatures[currentFeatureIndex]; - logger.logMarkerCheck('DETAILS-MARKER', 'ddd data'); + return ( @@ -499,11 +483,12 @@ export function DetailsPanel({ fullWidth = false }: DetailsPanelType): JSX.Eleme - + ); } + // if no condition met, return null for Guide tab return null; }; diff --git a/packages/geoview-core/src/core/components/details/feature-info-new.tsx b/packages/geoview-core/src/core/components/details/feature-info-new.tsx index e67b8b83c90..b42b0d9b308 100644 --- a/packages/geoview-core/src/core/components/details/feature-info-new.tsx +++ b/packages/geoview-core/src/core/components/details/feature-info-new.tsx @@ -14,7 +14,6 @@ import { getSxClasses } from './details-style'; interface FeatureInfoProps { feature: TypeFeatureInfoEntry; - onRenderComplete: (flag: boolean) => void; } interface FeatureHeaderProps { @@ -80,9 +79,8 @@ const FeatureHeader = memo(function FeatureHeader({ iconSrc, name, hasGeometry, ); }); -export function FeatureInfo({ feature, onRenderComplete }: FeatureInfoProps): JSX.Element | null { +export function FeatureInfo({ feature }: FeatureInfoProps): JSX.Element | null { logger.logTraceRender('components/details/feature-info-new'); - logger.logMarkerCheck('DETAILS-MARKER', 'ddd new feature info'); // Hooks const theme = useTheme(); @@ -96,28 +94,10 @@ export function FeatureInfo({ feature, onRenderComplete }: FeatureInfoProps): JS const { addCheckedFeature, removeCheckedFeature } = useDetailsStoreActions(); const { zoomToExtent, highlightBBox, transformPoints, showClickMarker } = useMapStoreActions(); - useEffect(() => { - // Call the callback after the component has mounted - onRenderComplete?.(false); - logger.logMarkerCheck('DETAILS-MARKER', 'ddd child child render'); - - // Notify parent when component is ready - const timer = setTimeout(() => { - onRenderComplete(true); - }, 0); - - // Cleanup function to handle unmounting - return () => { - clearTimeout(timer); - onRenderComplete(false); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [feature]); // Empty dependency array means this runs once after initial render - // Feature data processing const featureData = useMemo(() => { if (!feature) return null; - logger.logMarkerCheck('DETAILS-MARKER', 'ddd feature data'); + return { uid: feature.geometry ? (feature.geometry as TypeGeometry).ol_uid : null, iconSrc: feature.featureIcon.toDataURL(), @@ -131,7 +111,6 @@ export function FeatureInfo({ feature, onRenderComplete }: FeatureInfoProps): JS // Process feature info list const featureInfoList: TypeFieldEntry[] = useMemo(() => { if (!feature?.fieldInfo) return []; - logger.logMarkerCheck('DETAILS-MARKER', 'ddd feature list'); return Object.entries(feature.fieldInfo) .filter(([key]) => key !== feature.nameField) @@ -193,7 +172,7 @@ export function FeatureInfo({ feature, onRenderComplete }: FeatureInfoProps): JS // Effects useEffect(() => { logger.logTraceUseEffect('FEATURE-INFO-NEW - checkedFeatures', checkedFeatures); - logger.logMarkerCheck('DETAILS-MARKER', 'ddd checkfeat'); + if (!featureData?.uid) return; setChecked(checkedFeatures.some((checkedFeature) => (checkedFeature.geometry as TypeGeometry)?.ol_uid === featureData.uid)); @@ -201,7 +180,7 @@ export function FeatureInfo({ feature, onRenderComplete }: FeatureInfoProps): JS // Early return if no feature if (!featureData) return null; - logger.logMarkerCheck('DETAILS-MARKER', 'ddd feature'); + return ( ); - } else if (typeof item === 'string' && isImage(item)) { - element = ( + } + + if (typeof item === 'string' && isImage(item)) { + return ( ); - } else { - element = ( - - ); } - return element + return ( + + + + ); }); // Extracted FeatureRow component @@ -95,9 +96,6 @@ export const FeatureRow = memo(function FeatureRow({ featureInfoItem, index, onI const theme = useTheme(); const { alias, value } = featureInfoItem; - // Split text but leave html intact - // f (alias !== 'html') values = values.toString().split(';'); - // Convert value to string, handling arrays and other types const stringValue = useMemo((): string => { if (Array.isArray(value)) { @@ -106,7 +104,8 @@ export const FeatureRow = memo(function FeatureRow({ featureInfoItem, index, onI return stringify(value) as string; }, [value]); - const valueArray = stringValue.split(';'); + // Split text but leave html intact + const valueArray = alias !== 'html' ? stringValue.split(';') : [stringValue]; // Generate stable IDs for each item when component mounts const itemIds = useMemo(() => valueArray.map(() => generateId()), [valueArray]); @@ -121,17 +120,19 @@ export const FeatureRow = memo(function FeatureRow({ featureInfoItem, index, onI marginBottom: '1.25rem', }} > - {featureInfoItem.alias !== 'html' && ( - {alias} - )} + {featureInfoItem.alias !== 'html' && ( + + {alias} + + )} {featureInfoList.map((featureInfoItem, index) => ( diff --git a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts index 16daf08ab06..12fd85c0bb8 100644 --- a/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts +++ b/packages/geoview-core/src/geo/layer/gv-layers/raster/gv-wms.ts @@ -119,16 +119,17 @@ export class GVWMS extends AbstractGVRaster { const layerConfig = this.getLayerConfig(); // Check if bounds are properly set - if (!layerConfig.initialSettings!.bounds) { - const newBounds = this.getBounds(this.getLayerPath()); - if (newBounds) - layerConfig.initialSettings!.bounds = Projection.transformExtentFromProj( - newBounds, - this.getMapViewer().getView().getProjection(), - Projection.PROJECTION_NAMES.LNGLAT - ); - else return []; - } + // TODO: We always do the check if not bounds are not set properly from layer creation process + // if (!layerConfig.initialSettings!.bounds) { + const newBounds = this.getBounds(this.getLayerPath()); + if (newBounds) + layerConfig.initialSettings!.bounds = Projection.transformExtentFromProj( + newBounds, + this.getMapViewer().getView().getProjection(), + Projection.PROJECTION_NAMES.LNGLAT + ); + // else return []; + // } const clickCoordinate = this.getMapViewer().convertCoordinateLngLatToMapProj(lnglat); if ( diff --git a/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts b/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts index 7fccf9eb363..a1a787edb55 100644 --- a/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts +++ b/packages/geoview-core/src/geo/layer/layer-sets/feature-info-layer-set.ts @@ -81,8 +81,8 @@ export class FeatureInfoLayerSet extends AbstractLayerSet { */ // eslint-disable-next-line @typescript-eslint/no-unused-vars protected override onPropagateToStore(resultSetEntry: TypeFeatureInfoResultSetEntry, type: PropagationType): void { - // Redirect - this.#propagateToStore(resultSetEntry, type === 'layerName' ? 'name' : 'click'); + // Redirect - Add layer to the list after registration + this.#propagateToStore(resultSetEntry, type === 'layer-registration' ? 'name' : 'click'); } /** diff --git a/packages/geoview-core/src/geo/map/map-viewer.ts b/packages/geoview-core/src/geo/map/map-viewer.ts index ab7b8c4c8ab..12365f032ac 100644 --- a/packages/geoview-core/src/geo/map/map-viewer.ts +++ b/packages/geoview-core/src/geo/map/map-viewer.ts @@ -431,10 +431,7 @@ export class MapViewer { }; // Save in the store - MapEventProcessor.setClickCoordinates(this.mapId, clickCoordinates).catch((error) => { - // Log - logger.logPromiseFailed('setClickCoordinates in #handleMapSingleClick in MapViewer', error); - }); + MapEventProcessor.setClickCoordinates(this.mapId, clickCoordinates); // Emit to the outside this.#emitMapSingleClick(clickCoordinates);