finer tolerances for minify tool, closes #150
This commit is contained in:
parent
23c41f18de
commit
b841326e19
1 changed files with 6 additions and 3 deletions
|
@ -18,10 +18,13 @@
|
||||||
let sliderValue = [50];
|
let sliderValue = [50];
|
||||||
let maxPoints = 0;
|
let maxPoints = 0;
|
||||||
let currentPoints = 0;
|
let currentPoints = 0;
|
||||||
|
const minTolerance = 0.1;
|
||||||
|
const maxTolerance = 10000;
|
||||||
|
|
||||||
$: validSelection = $selection.hasAnyChildren(new ListRootItem(), true, ['waypoints']);
|
$: validSelection = $selection.hasAnyChildren(new ListRootItem(), true, ['waypoints']);
|
||||||
|
|
||||||
$: tolerance = 2 ** (sliderValue[0] / (100 / Math.log2(10000)));
|
$: tolerance =
|
||||||
|
minTolerance * 2 ** (sliderValue[0] / (100 / Math.log2(maxTolerance / minTolerance)));
|
||||||
|
|
||||||
let simplified = new Map<string, [ListItem, number, SimplifiedTrackPoint[]]>();
|
let simplified = new Map<string, [ListItem, number, SimplifiedTrackPoint[]]>();
|
||||||
let unsubscribes = new Map<string, () => void>();
|
let unsubscribes = new Map<string, () => void>();
|
||||||
|
@ -101,7 +104,7 @@
|
||||||
simplified.set(segmentItem.getFullId(), [
|
simplified.set(segmentItem.getFullId(), [
|
||||||
segmentItem,
|
segmentItem,
|
||||||
statistics.local.points.length,
|
statistics.local.points.length,
|
||||||
ramerDouglasPeucker(statistics.local.points, 1)
|
ramerDouglasPeucker(statistics.local.points, minTolerance)
|
||||||
]);
|
]);
|
||||||
update();
|
update();
|
||||||
} else if (simplified.has(segmentItem.getFullId())) {
|
} else if (simplified.has(segmentItem.getFullId())) {
|
||||||
|
@ -154,7 +157,7 @@
|
||||||
</div>
|
</div>
|
||||||
<Label class="flex flex-row justify-between">
|
<Label class="flex flex-row justify-between">
|
||||||
<span>{$_('toolbar.reduce.tolerance')}</span>
|
<span>{$_('toolbar.reduce.tolerance')}</span>
|
||||||
<WithUnits value={tolerance / 1000} type="distance" decimals={3} class="font-normal" />
|
<WithUnits value={tolerance / 1000} type="distance" decimals={4} class="font-normal" />
|
||||||
</Label>
|
</Label>
|
||||||
<Label class="flex flex-row justify-between">
|
<Label class="flex flex-row justify-between">
|
||||||
<span>{$_('toolbar.reduce.number_of_points')}</span>
|
<span>{$_('toolbar.reduce.number_of_points')}</span>
|
||||||
|
|
Loading…
Reference in a new issue