diff --git a/dashboards/map.json b/dashboards/map.json index 7775b86..9dda20f 100644 --- a/dashboards/map.json +++ b/dashboards/map.json @@ -116,6 +116,7 @@ "shape": "circle", "showLegend": true, "showPin": true, + "showBorder": false, "size": { "field": "availablespotnumber", "fixed": 1, diff --git a/dashboards/timescaledb-map.json b/dashboards/timescaledb-map.json index 2545ad6..861244d 100644 --- a/dashboards/timescaledb-map.json +++ b/dashboards/timescaledb-map.json @@ -312,6 +312,7 @@ "shape": "circle", "showLegend": true, "showPin": true, + "showBorder": false, "size": { "fixed": 1, "max": 15, diff --git a/src/GeomapPanel.tsx b/src/GeomapPanel.tsx index df3eacd..b42472c 100644 --- a/src/GeomapPanel.tsx +++ b/src/GeomapPanel.tsx @@ -36,6 +36,7 @@ import { getGlobalStyles } from './globalStyles'; import { GeomapHoverFeature, GeomapHoverPayload } from './event'; import { DataHoverView } from './components/DataHoverView'; import { ExtendMapLayerOptions } from './extension'; +import LayerGroup from 'ol/layer/Group'; interface MapLayerState { config: ExtendMapLayerOptions; @@ -165,6 +166,23 @@ export class GeomapPanel extends Component { } } } + if (layer instanceof LayerGroup) { + const groupLayers = layer.getLayersArray(); + for (let l of groupLayers) { + if (l instanceof VectorLayer) { + let source = l.getSource(); + if (source !== undefined && source instanceof Vector) { + let features = source.getFeatures(); + for (let feature of features) { + let geo = feature.getGeometry(); + if (geo) { + extend(extent, geo.getExtent()); + } + } + } + } + } + } } if (!isEqual(extent, createEmpty())) { this.map.getView().fit(extent); diff --git a/src/layers/data/markersLayer.tsx b/src/layers/data/markersLayer.tsx index 2c2af42..e06de3b 100644 --- a/src/layers/data/markersLayer.tsx +++ b/src/layers/data/markersLayer.tsx @@ -50,6 +50,7 @@ export interface MarkersConfig { shape?: string; showLegend?: boolean; showPin?: boolean; + showBorder?: boolean; iconSize?: number; enableGradient?: boolean; enableShadow?: boolean; @@ -79,6 +80,7 @@ const defaultOptions: MarkersConfig = { shape: 'circle', showLegend: true, showPin: false, + showBorder: false, enableGradient: false, enableShadow: false, pinShape: 'marker', @@ -355,6 +357,7 @@ export const markersLayer: ExtendMapLayerRegistryItem = { const showPin = options.config?.showPin ?? defaultOptions.showPin; const cluster = options.config?.cluster ?? defaultOptions.cluster; + const showBorder = options.config?.showBorder ?? defaultOptions.showBorder; for (const frame of data.series) { if ((options.query && options.query.options === frame.refId) || (frame.meta)) { @@ -383,16 +386,24 @@ export const markersLayer: ExtendMapLayerRegistryItem = { if (geoType === 'Point') { geometry.setStyle(shape!.make(color, fillColor, radius)); } else { - const strokeSize = getScaledDimension(frame, config.geoJsonStrokeSize); let style = new Style({ - stroke: new Stroke({ - color: color, - width: strokeSize.get(i), - }), fill: new Fill({ color: fillColor, - }), + }) }); + if (showBorder) + { + const strokeSize = getScaledDimension(frame, config.geoJsonStrokeSize); + style = new Style({ + stroke: new Stroke({ + color: color, + width: strokeSize.get(i), + }), + fill: new Fill({ + color: fillColor, + }) + }); + } geometry.setStyle(style); } geometryFeatures.push(geometry); @@ -515,6 +526,12 @@ export const markersLayer: ExtendMapLayerRegistryItem = { description: 'Show pin', defaultValue: defaultOptions.showPin, }) + .addBooleanSwitch({ + path: 'config.showBorder', + name: 'Show border', + description: 'Show border', + defaultValue: defaultOptions.showBorder, + }) .addSelect({ path: 'config.pinShape', name: 'Pin Shape',