116 lines
2.9 KiB
JavaScript
116 lines
2.9 KiB
JavaScript
import {
|
|
simplify_nth_point,
|
|
simplify_radial_distance,
|
|
simplify_perpendicular_distance,
|
|
simplify_reumann_witkam,
|
|
simplify_opheim,
|
|
simplify_lang,
|
|
simplify_douglas_peucker,
|
|
simplify_douglas_peucker_n
|
|
} from '../../../lib/psimpl-js/index.js'
|
|
import SimplifyJS from '../../../lib/simplify-js-alternative/simplify.js'
|
|
import { simplifyWasm } from '../../../lib/simplify-wasm/index.js'
|
|
|
|
import { Range, ToleranceRange, Checkbox } from './Field.js'
|
|
import { Algorithm } from './Algorithm.js'
|
|
|
|
class NthPoint extends Algorithm {
|
|
constructor() {
|
|
super('Nth Point', 'nth_point', simplify_nth_point)
|
|
this.addField(new Range('n', 'n', 1, 15, 1, 3))
|
|
}
|
|
}
|
|
|
|
class RadialDistance extends Algorithm {
|
|
constructor() {
|
|
super('RadialDistance', 'rad_dist', simplify_radial_distance)
|
|
this.addField(new ToleranceRange())
|
|
}
|
|
}
|
|
|
|
class PerpendicularDistance extends Algorithm {
|
|
constructor() {
|
|
super(
|
|
'Perpendicular Distance',
|
|
'perp_dist',
|
|
simplify_perpendicular_distance
|
|
)
|
|
this.addField(new ToleranceRange())
|
|
this.addField(new Range('Repeat', 'repeat', 1, 10, 1, 3))
|
|
}
|
|
}
|
|
|
|
class ReumannWitkam extends Algorithm {
|
|
constructor() {
|
|
super('Reuman-Witkam Algorithm', 'reumann_witkam', simplify_reumann_witkam)
|
|
this.addField(new ToleranceRange())
|
|
}
|
|
}
|
|
|
|
class Opheim extends Algorithm {
|
|
constructor() {
|
|
super('Opheim Algorithm', 'opheim', simplify_opheim)
|
|
this.addField(new ToleranceRange('Minimum Tolerance', 'minTol'))
|
|
this.addField(new ToleranceRange('Maximum Tolerance', 'maxTol'))
|
|
}
|
|
}
|
|
|
|
class Lang extends Algorithm {
|
|
constructor() {
|
|
super('Lang Algorithm', 'lang', simplify_lang)
|
|
this.addField(new ToleranceRange())
|
|
this.addField(new Range('Look ahead', 'lookAhead', 2, 100, 1, 5))
|
|
}
|
|
}
|
|
|
|
class DouglasPeucker extends Algorithm {
|
|
constructor() {
|
|
super(
|
|
'Douglas Peucker Algorithm',
|
|
'dougles_peucker',
|
|
simplify_douglas_peucker
|
|
)
|
|
this.addField(new ToleranceRange())
|
|
}
|
|
}
|
|
|
|
class DouglasPeuckerAlt extends Algorithm {
|
|
constructor() {
|
|
super(
|
|
'Douglas Peucker Alt. Algorithm',
|
|
'dougles_peucker_n',
|
|
simplify_douglas_peucker_n
|
|
)
|
|
this.addField(new Range('Count', 'count', 1, 2000, 1, 1000))
|
|
}
|
|
}
|
|
|
|
class SimplifyJSAlgo extends Algorithm {
|
|
constructor() {
|
|
super('Simplify.js', 'simplify_js', SimplifyJS)
|
|
this.addField(new ToleranceRange())
|
|
this.addField(new Checkbox('High Quality', 'highQual', false))
|
|
}
|
|
}
|
|
|
|
class SimplifyWASMAlgo extends Algorithm {
|
|
constructor() {
|
|
super('Simplify.wasm', 'simplify_wasm', simplifyWasm)
|
|
this.addField(new ToleranceRange())
|
|
this.addField(new Checkbox('High Quality', 'highQual', true))
|
|
}
|
|
}
|
|
|
|
export default [
|
|
new NthPoint(),
|
|
new RadialDistance(),
|
|
new PerpendicularDistance(),
|
|
new ReumannWitkam(),
|
|
new Opheim(),
|
|
new Lang(),
|
|
new DouglasPeucker(),
|
|
new DouglasPeuckerAlt(),
|
|
new SimplifyJSAlgo(),
|
|
new SimplifyWASMAlgo()
|
|
]
|