Refactoring and implementing the actual selection of features to display.
This commit is contained in:
1 parent
8ddbe1bdee
commit
36337623ca
5 files changed
+137
-64
No files matched your search
@@ -22,6 +22,7 @@ import Tree from '../tree';
|
||||
import { createCachedSignal } from '../../workers/cached-signals';
|
||||
import dispatch from '../../workers/dispatcher-main';
|
||||
import getUri from '../../lib/ids';
|
||||
import { Feature } from 'ol';
|
||||
|
||||
const id = getUri('overlays', undefined);
|
||||
|
||||
@@ -176,13 +177,35 @@ const currentOverlayKey = () =>
|
||||
const currentOverlay = () =>
|
||||
getOverlays() ? getOverlays()[currentOverlayKey()] : {};
|
||||
|
||||
const currentOverlayDefinition = () => overlayDefinitions[currentOverlayKey()];
|
||||
export const currentOverlayDefinition = () =>
|
||||
overlayDefinitions[currentOverlayKey()];
|
||||
|
||||
const currentOverlayHighlightedKey = () =>
|
||||
currentOverlay() && currentOverlay().highlighted
|
||||
? Object.keys(currentOverlay().highlighted)[0]
|
||||
: 'none';
|
||||
|
||||
export const currentOverlayHighlightedDefinition = () =>
|
||||
currentOverlayDefinition()[currentOverlayHighlightedKey()];
|
||||
|
||||
export const isHighlighted = (feature: Feature) => {
|
||||
const type = feature.get('sub-type');
|
||||
const subType = feature.get('class');
|
||||
const highlightedType = currentOverlayHighlightedDefinition()[type];
|
||||
if (!highlightedType) {
|
||||
return false;
|
||||
}
|
||||
// console.log({
|
||||
// caller: 'Overlays / isHighlighted',
|
||||
// feature,
|
||||
// type,
|
||||
// subType,
|
||||
// currentOverlayHighlightedDefinition: currentOverlayHighlightedDefinition(),
|
||||
// highlightedType,
|
||||
// });
|
||||
return highlightedType === '*' || highlightedType.includes(subType);
|
||||
};
|
||||
|
||||
const MapTilesProvider: Component<{}> = (props) => {
|
||||
const [open, setOpen] = createSignal(false);
|
||||
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
export { default, mapTileProviders } from './MapTileProvider';
|
||||
export {
|
||||
default,
|
||||
mapTileProviders,
|
||||
currentOverlayDefinition,
|
||||
currentOverlayHighlightedDefinition,
|
||||
isHighlighted,
|
||||
} from './MapTileProvider';
|
||||
Reference in new issue
Block a user