Skip to content

Commit

Permalink
add changes from 4.0.5 ol ext
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr committed Mar 18, 2023
1 parent ee68e8c commit ea3937f
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 22 deletions.
8 changes: 7 additions & 1 deletion @types/ol-ext/control/SearchFeature.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface Options extends SearchOptions {
property?: string;
getTitle?: (f: Feature) => string;
getSearchString?: (f: Feature) => string;
sort: (f1: Feature, f2: Feature) => number;
}

/**
Expand All @@ -38,5 +39,10 @@ export default class SearchFeature extends Search {
* @param {function} options.getTitle a function that takes a feature and return the name to display in the index, default return the property
* @param {function | undefined} options.getSearchString a function that take a feature and return a text to be used as search string, default geTitle() is used as search string
*/
constructor(options: Options);
constructor(options?: Options);

/** Set function to sort autocomplete results
* @param {function} sort a sort function that takes 2 features and returns 0, -1 or 1
*/
setSortFunction(sort: (f1: Feature, f2: Feature) => number): void
}
2 changes: 2 additions & 0 deletions @types/ol-ext/control/SearchGeoportail.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type AddressType = 'StreetAddress' | 'PositionOfInterest' | 'CadastralPar
export interface Options extends SearchJsonOptions {
className?: string;
apiKey?: string;
version?: string;
authentication?: string;
label?: string;
reverse?: boolean;
Expand All @@ -30,6 +31,7 @@ export default class SearchGeoportail extends SearchJSON {
* @param {any} options extend ol.control.SearchJSON options
* @param {string} options.className control class name
* @param {string | undefined} options.apiKey the service api key.
* @param {string | undefined} [options.version] API version '2' to use geocodage-beta-2, default v1.
* @param {string | undefined} options.authentication: basic authentication for the service API as btoa("login:pwd")
* @param {Element | string | undefined} options.target Specify a target if you want the control to be rendered outside of the map's viewport.
* @param {string | undefined} options.label Text label to use for the search button, default "search"
Expand Down
28 changes: 28 additions & 0 deletions @types/ol-ext/geom/Simplificator.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type Feature from 'ol/Feature'
import ol_Object from 'ol/Object'

export interface Options {
[key: string]: any;
}

export default class Simplificator extends ol_Object {
constructor(options?: Options);

getEdges(): any[]

/** Set the features to process
* @param {Array<Feature>} features
* @param {number} [round] round features
*/
setFeatures(features: Feature[], round: number): void;

/** Get the simplified features
* @returns {Array<Feature>}
*/
getFeatures(): Feature[];

/** Simplify edges using Douglas Peucker algorithm
* @param {number} tolerance
*/
simplify(tolerance: number): void
}
25 changes: 25 additions & 0 deletions @types/ol-ext/geom/visvalingam.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type LineString from 'ol/geom/LineString'

export interface Options {
area?: number;
dist?: number;
ratio?: number;
minPoints?: number
keepEnds?: number;
}

declare module 'ol/geom/LineString' {
/**
* Visvalingam polyline simplification algorithm, adapted from http://bost.ocks.org/mike/simplify/simplify.js
* This uses the [Visvalingam–Whyatt](https://en.wikipedia.org/wiki/Visvalingam%E2%80%93Whyatt_algorithm) algorithm.
* @param {Object} options
* @param {number} [area] the tolerance area for simplification
* @param {number} [dist] a tolerance distance for simplification
* @param {number} [ratio=.8] a ratio of points to keep
* @param {number} [minPoints=2] minimum number of points to keep
* @param {boolean} [keepEnds] keep line ends
* @return { LineString } A new, simplified version of the original geometry.
* @api
*/
export function simplifyVisvalingam(options?: Options): LineString
}
6 changes: 3 additions & 3 deletions @types/ol-ext/interaction/DropFile.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type Projection from 'ol/proj/Projection'
import { DragAndDrop, Interaction } from 'ol/interaction'
import { Interaction } from 'ol/interaction'
import type FeatureFormat from 'ol/format/Feature'
import type { Map as _ol_Map_ } from 'ol'
import BaseEvent from 'ol/events/Event'
import type Feature from 'ol/Feature'
import type { EventsKey } from 'ol/events'
import type { DragAndDropEvent } from 'ol/interaction/DragAndDrop'
import type { ObjectEvent } from 'ol/Object'
import type { CombinedOnSignature, EventTypes, OnSignature } from 'ol/Observable'
import type { Types } from 'ol/ObjectEventType'
import type Feature from 'ol/Feature'

type DropFileOnSignature<Return> = OnSignature<EventTypes, Event, Return> &
OnSignature<Types | 'change' | 'change:active' | 'error' | 'propertychange', ObjectEvent, Return> &
Expand Down Expand Up @@ -42,7 +42,7 @@ export default class DropFile extends Interaction {
* @param {Array<function(new:ol.format.Feature)>|undefined} options.formatConstructors Format constructors, default [ ol.format.GPX, ol.format.GeoJSONX, ol.format.GeoJSONP, ol.format.GeoJSON, ol.format.IGC, ol.format.KML, ol.format.TopoJSON ]
* @param {Array<string>|undefined} options.accept list of accepted format, default ["gpx","json","geojsonx","geojsonp","geojson","igc","kml","topojson"]
*/
constructor(options: Options);
constructor(options?: Options);

/** Set the map
*/
Expand Down
26 changes: 13 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@siedlerchr/types-ol-ext",
"version": "3.0.9",
"version": "3.1.0",
"description": "Type definitions for ol-ext",
"main": "",
"types": "index.d.ts",
Expand Down Expand Up @@ -49,12 +49,12 @@
"fs-extra": "^10.1.0",
"jsdoc": "^4.0.2",
"node-html-parser": "^5.4.2",
"ol": "^7.2.2",
"ol-ext": "^4.0.4",
"ol": "^7.3.0",
"ol-ext": "^4.0.6",
"ts-loader": "^9.4.2",
"tsd": "^0.24.1",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"typescript": "^4.9.5",
"webpack": "^5.76.2",
"webpack-cli": "^4.10.0"
}
}

0 comments on commit ea3937f

Please sign in to comment.