mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
Finish line simplification support
This commit is contained in:
parent
d9ce6387a3
commit
b35445fda9
4 changed files with 15 additions and 1193 deletions
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Nibriboard.RippleSpace;
|
using Nibriboard.RippleSpace;
|
||||||
|
using Nibriboard.Utilities;
|
||||||
using SBRL.Utilities;
|
using SBRL.Utilities;
|
||||||
|
|
||||||
namespace Nibriboard.Client
|
namespace Nibriboard.Client
|
||||||
|
@ -84,10 +85,19 @@ namespace Nibriboard.Client
|
||||||
if(!currentLines.ContainsKey(lineId))
|
if(!currentLines.ContainsKey(lineId))
|
||||||
throw new KeyNotFoundException("Error: A line with that id wasn't found in this LineIncubator.");
|
throw new KeyNotFoundException("Error: A line with that id wasn't found in this LineIncubator.");
|
||||||
|
|
||||||
Log.WriteLine("[LineIncubator] Completing line #{0}", lineId);
|
DrawnLine completedLine = currentLines[lineId];
|
||||||
|
currentLines.Remove(lineId);
|
||||||
|
|
||||||
DrawnLine completedLine = currentLines[lineId];
|
int originalPointCount = completedLine.Points.Count;
|
||||||
currentLines.Remove(lineId);
|
completedLine.Points = LineSimplifier.SimplifyLine(completedLine.Points, 6);
|
||||||
|
|
||||||
|
Log.WriteLine(
|
||||||
|
"[LineIncubator] [LineComplete] #{0}: {1} -> {2} points ({3:0.00}% reduction)",
|
||||||
|
lineId,
|
||||||
|
originalPointCount,
|
||||||
|
completedLine.Points.Count,
|
||||||
|
((float)completedLine.Points.Count / (float)originalPointCount) * 100f
|
||||||
|
);
|
||||||
|
|
||||||
return completedLine;
|
return completedLine;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,7 +180,7 @@ class Pencil
|
||||||
*/
|
*/
|
||||||
recalculateSimplifiedLine()
|
recalculateSimplifiedLine()
|
||||||
{
|
{
|
||||||
this.currentSimplifiedLineSegments = simplify_line(this.currentLineSegments);
|
this.currentSimplifiedLineSegments = simplify_line(this.currentLineSegments, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
1188
Nibriboard/ClientFiles/package-lock.json
generated
1188
Nibriboard/ClientFiles/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -17,7 +17,7 @@ namespace Nibriboard.RippleSpace
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Addition,
|
Addition,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Something was deleted form the chunk.
|
/// Something was deleted from the chunk.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Deletion,
|
Deletion,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue