Skip to content

Commit

Permalink
feat: use WmsLayer from ol-util instead of react-util
Browse files Browse the repository at this point in the history
  • Loading branch information
simonseyock committed May 14, 2024
1 parent e85441a commit 0abde72
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import './AddWmsLayerEntry.less';

import { faCopyright, faInfo } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { WmsLayer } from '@terrestris/react-util/dist/Util/typeUtils';
import { WmsLayer } from '@terrestris/ol-util';

Check failure on line 5 in src/Container/AddWmsPanel/AddWmsLayerEntry/AddWmsLayerEntry.tsx

View workflow job for this annotation

GitHub Actions / build

Module '"@terrestris/ol-util"' has no exported member 'WmsLayer'.
import { Checkbox, Tooltip } from 'antd';
import OlMap from 'ol/Map';
import React, { useEffect, useState } from 'react';
Expand Down
3 changes: 1 addition & 2 deletions src/Container/AddWmsPanel/AddWmsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import './AddWmsPanel.less';

import Logger from '@terrestris/base-util/dist/Logger';
import { WmsLayer } from '@terrestris/ol-util';

Check failure on line 4 in src/Container/AddWmsPanel/AddWmsPanel.tsx

View workflow job for this annotation

GitHub Actions / build

Module '"@terrestris/ol-util"' has no exported member 'WmsLayer'.
import useMap from '@terrestris/react-util/dist/Hooks/useMap/useMap';
import { WmsLayer } from '@terrestris/react-util/dist/Util/typeUtils';
import { Checkbox } from 'antd';
import { CheckboxValueType } from 'antd/lib/checkbox/Group';
import _isFunction from 'lodash/isFunction';
import React, { useState } from 'react';

import SimpleButton from '../../Button/SimpleButton/SimpleButton';
Expand Down
11 changes: 3 additions & 8 deletions src/Legend/Legend.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { faCircleNotch } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Logger from '@terrestris/base-util/dist/Logger';
import MapUtil from '@terrestris/ol-util/dist/MapUtil/MapUtil';
import { MapUtil, WmsLayer } from '@terrestris/ol-util';

Check failure on line 4 in src/Legend/Legend.tsx

View workflow job for this annotation

GitHub Actions / build

Module '"@terrestris/ol-util"' has no exported member 'WmsLayer'.
import { Spin } from 'antd';
import _isEqual from 'lodash/isEqual';
import OlLayerImage from 'ol/layer/Image';
import OlLayerTile from 'ol/layer/Tile';
import OlSourceImageWMS from 'ol/source/ImageWMS';
import OlSourceTileWMS from 'ol/source/TileWMS';
import * as React from 'react';
import { useCallback, useEffect, useState } from 'react';

Expand All @@ -22,7 +17,7 @@ import { CSS_PREFIX } from '../constants';
* @param params The extra params.
*/
const getLegendUrl = (
legendLayer: OlLayerTile<OlSourceTileWMS> | OlLayerImage<OlSourceImageWMS>,
legendLayer: WmsLayer,
params: any
) => {
let url;
Expand All @@ -44,7 +39,7 @@ export interface BaseProps {
/**
* The layer you want to display the legend of.
*/
layer: OlLayerTile<OlSourceTileWMS> | OlLayerImage<OlSourceImageWMS>;
layer: WmsLayer;
/**
* An object containing additional request params like "{HEIGHT: 400}" will
* be transformed to "&HEIGHT=400" an added to the GetLegendGraphic request.
Expand Down
10 changes: 4 additions & 6 deletions src/Panel/TimeLayerSliderPanel/TimeLayerSliderPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { WmsLayer } from '@terrestris/ol-util';

Check failure on line 1 in src/Panel/TimeLayerSliderPanel/TimeLayerSliderPanel.tsx

View workflow job for this annotation

GitHub Actions / build

Module '"@terrestris/ol-util"' has no exported member 'WmsLayer'.
import { DatePicker, Popover, Select } from 'antd';
import dayjs from 'dayjs';
import _isEqual from 'lodash/isEqual';
import _isFinite from 'lodash/isFinite';
import moment, { Moment } from 'moment';
import { getUid } from 'ol';
import OlLayer from 'ol/layer/Layer';
import OlImageWMS from 'ol/source/ImageWMS';
import OlTileWMS from 'ol/source/TileWMS';
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
const RangePicker = DatePicker.RangePicker;
const Option = Select.Option;
Expand Down Expand Up @@ -41,7 +39,7 @@ export type PlaybackSpeedType = 'hours' | 'days' | 'weeks' | 'months' | 'years';
export interface TimeLayerSliderPanelProps {
className?: string;
onChange?: (arg: moment.Moment) => void;
timeAwareLayers: OlLayer<OlImageWMS | OlTileWMS>[];
timeAwareLayers: WmsLayer[];
value?: moment.Moment;
dateFormat?: string;
tooltips?: Tooltips;
Expand Down Expand Up @@ -95,7 +93,7 @@ export const TimeLayerSliderPanel: React.FC<TimeLayerSliderPanelProps> = memo(

const wrapTimeSlider = useCallback(() => {
const wmsTimeLayers: TimeLayerAwareConfig[] = [];
timeAwareLayers.forEach((l: OlLayer<OlImageWMS | OlTileWMS>) => {
timeAwareLayers.forEach(l => {
if (l.get('type') === 'WMSTime') {
wmsTimeLayers.push({ layer: l });
}
Expand Down Expand Up @@ -188,7 +186,7 @@ export const TimeLayerSliderPanel: React.FC<TimeLayerSliderPanelProps> = memo(
const startDatesFromLayers: moment.Moment[] = [];
const endDatesFromLayers: moment.Moment[] = [];

timeAwareLayers.forEach((l: OlLayer<OlImageWMS | OlTileWMS, any>) => {
timeAwareLayers.forEach(l => {
const layerType = l.get('type');
if (layerType === 'WMSTime') {
const layerStartDate = l.get('startDate');
Expand Down

0 comments on commit 0abde72

Please sign in to comment.