Skip to content

Commit cdf94fa

Browse files
authored
Merge pull request #1955 from terrestris/revert-openlayers-types
Revert openlayers types
2 parents 71c790d + fe85535 commit cdf94fa

File tree

32 files changed

+241
-336
lines changed

32 files changed

+241
-336
lines changed

package-lock.json

Lines changed: 7 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,12 @@
5252
"clean:test": "rimraf ./coverage/*",
5353
"clean:build": "rimraf ./build/*",
5454
"clean:dist": "rimraf ./dist/*",
55-
"pretest": "npm run typecheck && npm run lint",
55+
"pretest": "npm run lint",
5656
"test": "jest --maxWorkers=4 --coverage",
5757
"test:watch": "jest --watchAll",
5858
"coveralls": "cat coverage/lcov.info | coveralls",
5959
"prepublishOnly": "npm run build",
60-
"typecheck": "tsc --noEmit --project tsconfig.json",
61-
"lint:src": "eslint -c .eslintrc.js --ext ts,tsx src/",
60+
"lint:src": "tsc --noEmit --project tsconfig.json && eslint -c .eslintrc.js --ext ts,tsx src/",
6261
"lint:styleguide": "eslint -c .eslintrc.styleguide.js --no-eslintrc --ext md src/",
6362
"lint": "npm run lint:styleguide && npm run lint:src",
6463
"lint:fix": "npm run lint:styleguide -- --fix && npm run lint:src -- --fix",
@@ -83,14 +82,19 @@
8382
"@ant-design/icons": "^4.2.1",
8483
"@terrestris/base-util": "^0.2.3",
8584
"@terrestris/ol-util": "^4.0.1",
85+
"@types/lodash": "^4.14.155",
86+
"@types/moment": "^2.13.0",
87+
"@types/node": "^14.0.13",
88+
"@types/react-dom": "^17.0.0",
89+
"@types/react-rnd": "^8.0.0",
8690
"lodash": "^4.17.15",
8791
"moment": "^2.24.0",
8892
"proj4": "^2.6.0",
8993
"prop-types": "^15.7.2",
9094
"react-dom": "^16.12.0",
9195
"react-fa": "^5.0.0",
9296
"react-rnd": "^10.2.1",
93-
"typescript": "^4.1.3"
97+
"typescript": "^4.0.3"
9498
},
9599
"devDependencies": {
96100
"@babel/cli": "^7.10.1",
@@ -102,15 +106,9 @@
102106
"@babel/preset-env": "^7.10.2",
103107
"@babel/preset-react": "^7.10.1",
104108
"@babel/preset-typescript": "^7.10.1",
105-
"@hanreev/types-ol": "^3.4.2",
106109
"@types/enzyme": "^3.10.4",
107110
"@types/jest": "^26.0.0",
108-
"@types/lodash": "^4.14.155",
109-
"@types/moment": "^2.13.0",
110-
"@types/node": "^14.0.13",
111111
"@types/react": "^16.9.38",
112-
"@types/react-dom": "^17.0.0",
113-
"@types/react-rnd": "^8.0.0",
114112
"@typescript-eslint/eslint-plugin": "^3.4.0",
115113
"@typescript-eslint/eslint-plugin-tslint": "^4.1.1",
116114
"@typescript-eslint/parser": "^3.4.0",
@@ -136,7 +134,7 @@
136134
"jest-environment-jsdom-fourteen": "^1.0.1",
137135
"less-loader": "^6.1.1",
138136
"np": "^7.0.0",
139-
"ol": "^6.5.0",
137+
"ol": "^6.4.1",
140138
"react": "^16.12.0",
141139
"react-docgen-typescript": "^1.17.1",
142140
"react-styleguidist": "^11.0.8",

src/Button/DigitizeButton/DigitizeButton.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,15 @@ import OlStyleStroke from 'ol/style/Stroke';
1212
import OlStyleFill from 'ol/style/Fill';
1313
import OlStyleCircle from 'ol/style/Circle';
1414
import OlStyleText from 'ol/style/Text';
15+
import OlInteraction from 'ol/interaction/Interaction';
1516
import OlInteractionDraw, { createBox } from 'ol/interaction/Draw';
1617
import OlInteractionSelect from 'ol/interaction/Select';
1718
import OlInteractionModify from 'ol/interaction/Modify';
1819
import OlInteractionTranslate from 'ol/interaction/Translate';
1920
import OlFeature from 'ol/Feature';
2021
import { never, singleClick } from 'ol/events/condition';
21-
import OlGeometry from 'ol/geom/Geometry';
22-
import { Select } from 'ol/interaction';
23-
import Draw from 'ol/interaction/Draw';
24-
import Modify from 'ol/interaction/Modify';
25-
import Translate from 'ol/interaction/Translate';
2622

27-
import _isFunction from 'lodash/isFunction';
23+
const _isFunction = require('lodash/isFunction');
2824

2925
import ToggleButton, { ToggleButtonProps } from '../ToggleButton/ToggleButton';
3026
import MapUtil from '@terrestris/ol-util/dist/MapUtil/MapUtil';
@@ -126,7 +122,7 @@ interface BaseProps {
126122
/**
127123
* Style object / style function for drawn feature.
128124
*/
129-
drawStyle?: OlStyleStyle | ((feature: OlFeature<OlGeometry>) => OlStyleStyle);
125+
drawStyle?: OlStyleStyle | ((feature: OlFeature) => OlStyleStyle);
130126
/**
131127
* Listener function for the 'drawend' event of an ol.interaction.Draw.
132128
* See https://openlayers.org/en/latest/apidoc/module-ol_interaction_Draw-DrawEvent.html
@@ -255,25 +251,25 @@ class DigitizeButton extends React.Component<DigitizeButtonProps, DigitizeButton
255251
* The draw interaction.
256252
* @private
257253
*/
258-
_drawInteraction?: Draw;
254+
_drawInteraction?: OlInteraction;
259255

260256
/**
261257
* The select interaction.
262258
* @private
263259
*/
264-
_selectInteraction?: Select;
260+
_selectInteraction?: OlInteraction;
265261

266262
/**
267263
* The modify interaction.
268264
* @private
269265
*/
270-
_modifyInteraction?: Modify;
266+
_modifyInteraction?: OlInteraction;
271267

272268
/**
273269
* The translate interaction.
274270
* @private
275271
*/
276-
_translateInteraction?: Translate;
272+
_translateInteraction?: OlInteraction;
277273

278274
/**
279275
* Name of point draw type.
@@ -620,7 +616,7 @@ class DigitizeButton extends React.Component<DigitizeButtonProps, DigitizeButton
620616
* @param text Text for labeled feature (optional).
621617
* @return The style to use.
622618
*/
623-
getSelectedStyleFunction = (feature: OlFeature<OlGeometry>, res: number, text: string) => {
619+
getSelectedStyleFunction = (feature: OlFeature, res: number, text: React.ReactText) => {
624620
const {
625621
selectFillColor,
626622
selectStrokeColor
@@ -1077,7 +1073,7 @@ class DigitizeButton extends React.Component<DigitizeButtonProps, DigitizeButton
10771073
* @param feat The point feature to be styled with label.
10781074
* @param onModalOkCbk Optional callback function.
10791075
*/
1080-
setTextOnFeature = (feat: OlFeature<OlGeometry>, onModalOkCbk: (feat: OlFeature<OlGeometry>, label: string) => void) => {
1076+
setTextOnFeature = (feat: OlFeature, onModalOkCbk: (feat: OlFeature, label: string) => void) => {
10811077
const {
10821078
maxLabelLineLength
10831079
} = this.props;

src/Button/GeoLocationButton/GeoLocationButton.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import OlLayerVector from 'ol/layer/Vector';
99
import OlSourceVector from 'ol/source/Vector';
1010
import OlStyleStyle from 'ol/style/Style';
1111
import OlStyleIcon from 'ol/style/Icon';
12-
import Geometry from 'ol/geom/Geometry';
13-
import GeometryLayout from 'ol/geom/GeometryLayout';
1412

1513
import ToggleButton, { ToggleButtonProps } from '../ToggleButton/ToggleButton';
1614

@@ -127,7 +125,7 @@ class GeoLocationButton extends React.Component<GeoLocationButtonProps> {
127125
* The styleFunction for the geoLocationLayer. Shows a marker with arrow when
128126
* heading is not 0.
129127
*/
130-
_styleFunction = (feature: OlFeature<Geometry>) => {
128+
_styleFunction = (feature: OlFeature) => {
131129
const heading = feature.get('heading');
132130
const src = heading !== 0 ? mapMarkerHeading : mapMarker;
133131
const rotation = heading !== 0 ? heading * Math.PI / 180 : 0;
@@ -170,7 +168,7 @@ class GeoLocationButton extends React.Component<GeoLocationButtonProps> {
170168
} = this.props;
171169
const allLayers = MapUtil.getAllLayers(map);
172170

173-
this._positions = new OlGeomLineString([], GeometryLayout.XYZM);
171+
this._positions = new OlGeomLineString([], 'XYZM');
174172
this._geoLocationLayer.setStyle(this._styleFunction);
175173
if (!allLayers.includes(this._geoLocationLayer)) {
176174
map.addLayer(this._geoLocationLayer);

0 commit comments

Comments
 (0)