Exemple #1
0
    public void ShouldRoundTrip()
    {
        using (var tempFile = new TempFile())
        {
            EdgeSpanStream.Write(
                tempFile.Path,
                viewPort: new ViewPort(
                    new ComplexArea(new DoubleRange(-1, 1), new DoubleRange(-1, 1)),
                    new Size(3, 3)),
                computationType: ComputationType.ScalarDouble,
                spans: new[]
            {
                new LogicalEdgeSpan(new Point(1, 1), toOutside: Direction.Up),
            });

            using (var stream = EdgeSpanStream.Load(tempFile.Path))
            {
                var spans = stream.ToArray();

                Assert.That(spans, Has.Length.EqualTo(1), "Incorrect number of spans.");

                var span = spans.First();
                Assert.That(span.Location, Is.EqualTo(new Point(1, 1)), "Wrong location.");
                Assert.That(span.ToOutside, Is.EqualTo(Direction.Up), "Wrong direction.");
            }
        }
    }
 public static void FindEdgeSpans(
     string pointGridFilePath,
     string outputFilePath)
 {
     using var pointGrid = PointGrid.Load(pointGridFilePath);
     using var timer     = TimedOperation.Start("points", totalWork: pointGrid.ViewPort.Resolution.Height);
     EdgeSpanStream.Write(
         outputFilePath,
         pointGrid.ViewPort,
         pointGrid.ComputationType,
         GetEdgeSpans(pointGrid, timer));
 }