Skip to content

Commit 0abde72

Browse files
committed
feat: use WmsLayer from ol-util instead of react-util
1 parent e85441a commit 0abde72

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

src/Container/AddWmsPanel/AddWmsLayerEntry/AddWmsLayerEntry.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import './AddWmsLayerEntry.less';
22

33
import { faCopyright, faInfo } from '@fortawesome/free-solid-svg-icons';
44
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
5-
import { WmsLayer } from '@terrestris/react-util/dist/Util/typeUtils';
5+
import { WmsLayer } from '@terrestris/ol-util';
66
import { Checkbox, Tooltip } from 'antd';
77
import OlMap from 'ol/Map';
88
import React, { useEffect, useState } from 'react';

src/Container/AddWmsPanel/AddWmsPanel.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import './AddWmsPanel.less';
22

33
import Logger from '@terrestris/base-util/dist/Logger';
4+
import { WmsLayer } from '@terrestris/ol-util';
45
import useMap from '@terrestris/react-util/dist/Hooks/useMap/useMap';
5-
import { WmsLayer } from '@terrestris/react-util/dist/Util/typeUtils';
66
import { Checkbox } from 'antd';
77
import { CheckboxValueType } from 'antd/lib/checkbox/Group';
8-
import _isFunction from 'lodash/isFunction';
98
import React, { useState } from 'react';
109

1110
import SimpleButton from '../../Button/SimpleButton/SimpleButton';

src/Legend/Legend.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons';
22
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
33
import Logger from '@terrestris/base-util/dist/Logger';
4-
import MapUtil from '@terrestris/ol-util/dist/MapUtil/MapUtil';
4+
import { MapUtil, WmsLayer } from '@terrestris/ol-util';
55
import { Spin } from 'antd';
6-
import _isEqual from 'lodash/isEqual';
7-
import OlLayerImage from 'ol/layer/Image';
8-
import OlLayerTile from 'ol/layer/Tile';
9-
import OlSourceImageWMS from 'ol/source/ImageWMS';
10-
import OlSourceTileWMS from 'ol/source/TileWMS';
116
import * as React from 'react';
127
import { useCallback, useEffect, useState } from 'react';
138

@@ -22,7 +17,7 @@ import { CSS_PREFIX } from '../constants';
2217
* @param params The extra params.
2318
*/
2419
const getLegendUrl = (
25-
legendLayer: OlLayerTile<OlSourceTileWMS> | OlLayerImage<OlSourceImageWMS>,
20+
legendLayer: WmsLayer,
2621
params: any
2722
) => {
2823
let url;
@@ -44,7 +39,7 @@ export interface BaseProps {
4439
/**
4540
* The layer you want to display the legend of.
4641
*/
47-
layer: OlLayerTile<OlSourceTileWMS> | OlLayerImage<OlSourceImageWMS>;
42+
layer: WmsLayer;
4843
/**
4944
* An object containing additional request params like "{HEIGHT: 400}" will
5045
* be transformed to "&HEIGHT=400" an added to the GetLegendGraphic request.

src/Panel/TimeLayerSliderPanel/TimeLayerSliderPanel.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1+
import { WmsLayer } from '@terrestris/ol-util';
12
import { DatePicker, Popover, Select } from 'antd';
23
import dayjs from 'dayjs';
34
import _isEqual from 'lodash/isEqual';
45
import _isFinite from 'lodash/isFinite';
56
import moment, { Moment } from 'moment';
67
import { getUid } from 'ol';
7-
import OlLayer from 'ol/layer/Layer';
8-
import OlImageWMS from 'ol/source/ImageWMS';
9-
import OlTileWMS from 'ol/source/TileWMS';
108
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
119
const RangePicker = DatePicker.RangePicker;
1210
const Option = Select.Option;
@@ -41,7 +39,7 @@ export type PlaybackSpeedType = 'hours' | 'days' | 'weeks' | 'months' | 'years';
4139
export interface TimeLayerSliderPanelProps {
4240
className?: string;
4341
onChange?: (arg: moment.Moment) => void;
44-
timeAwareLayers: OlLayer<OlImageWMS | OlTileWMS>[];
42+
timeAwareLayers: WmsLayer[];
4543
value?: moment.Moment;
4644
dateFormat?: string;
4745
tooltips?: Tooltips;
@@ -95,7 +93,7 @@ export const TimeLayerSliderPanel: React.FC<TimeLayerSliderPanelProps> = memo(
9593

9694
const wrapTimeSlider = useCallback(() => {
9795
const wmsTimeLayers: TimeLayerAwareConfig[] = [];
98-
timeAwareLayers.forEach((l: OlLayer<OlImageWMS | OlTileWMS>) => {
96+
timeAwareLayers.forEach(l => {
9997
if (l.get('type') === 'WMSTime') {
10098
wmsTimeLayers.push({ layer: l });
10199
}
@@ -188,7 +186,7 @@ export const TimeLayerSliderPanel: React.FC<TimeLayerSliderPanelProps> = memo(
188186
const startDatesFromLayers: moment.Moment[] = [];
189187
const endDatesFromLayers: moment.Moment[] = [];
190188

191-
timeAwareLayers.forEach((l: OlLayer<OlImageWMS | OlTileWMS, any>) => {
189+
timeAwareLayers.forEach(l => {
192190
const layerType = l.get('type');
193191
if (layerType === 'WMSTime') {
194192
const layerStartDate = l.get('startDate');

0 commit comments

Comments
 (0)