-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee68e8c
commit ea3937f
Showing
7 changed files
with
83 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters