public void TestReadLineStringWithZ() { var oldGeometry = ReadWkt("LINESTRING(0 0 0, 2 2 1, 3 3, 4 4)"); var newGeometry = ReadWkt("LINESTRING(0 0 1, 2 2 2, 3 3, 4 4)"); var diff = GeometryDifferBinary.Diff(oldGeometry, newGeometry); var patched = GeometryDifferBinary.Patch(oldGeometry, diff); var a = WriteWkt(newGeometry, 3); var b = WriteWkt(patched, 3); Assert.AreEqual(a, b); }
public void TestBinaryDiffer() { foreach (var geomPair in pairs) { var oldGeom = geomPair.OldGeometry; var newGeom = geomPair.NewGeometry; var diff = GeometryDifferBinary.Diff(oldGeom, newGeom); var patched = GeometryDifferBinary.Patch(oldGeom, diff); Assert.AreEqual(WriteWkt(newGeom, 3), WriteWkt(patched, 3), $"Patch {geomPair.Name}"); var unpatched = GeometryDifferBinary.UnPatch(newGeom, diff); Assert.AreEqual(WriteWkt(oldGeom, 3), WriteWkt(unpatched, 3), $"UnPatch {geomPair.Name}"); } }
private static TGeometry PatchGeometry(TGeometry v1, byte[] diff) => (TGeometry)GeometryDifferBinary.Patch(v1, diff);