本文整理汇总了C#中IPoint.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# IPoint.Cast方法的具体用法?C# IPoint.Cast怎么用?C# IPoint.Cast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPoint
的用法示例。
在下文中一共展示了IPoint.Cast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public void Create()
{
var points = new IPoint[,]
{
{new Point(0, 0), new Point(1, 0)},
{new Point(2, 1), new Point(3, 1.5)},
{new Point(1, 2), new Point(3, 3)}
};
var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());
var values = new[,]
{
{1.0, 2.0},
{3.0, 4.0},
{5.0, 6.0}
};
coverage.SetValues(values);
var value = coverage.Evaluate(points[1, 1].Coordinate);
const double expectedValue = 4.0;
Assert.AreEqual(expectedValue, value);
Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }));
Assert.AreEqual("new grid point coverage", coverage.Name);
}
示例2: Create
public void Create()
{
var points = new IPoint[,]
{
{new Point(0.0, 1.0), new Point(0.0, 0.0)},
{new Point(0.5, 1.5), new Point(1.0, 0.0)},
{new Point(1.0, 2.0), new Point(2.0, 2.0)}
};
var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());
var values = new[,]
{
{1.0, 2.0},
{3.0, 4.0},
{5.0, 6.0}
};
coverage.SetValues(values);
/*
var coverageLayer = new DiscreteGridPointCoverageLayer { Coverage = coverage, ShowFaces = true };
var map = new Map { Layers = { coverageLayer } };
MapTestHelper.Show(map);
*/
var value = coverage.Evaluate(points[1, 1].Coordinate);
const double expectedValue = 4.0;
Assert.AreEqual(expectedValue, value);
Assert.IsTrue(coverage.Components[0].Values.Cast<double>().SequenceEqual(new [] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 }));
Assert.AreEqual("new grid point coverage", coverage.Name);
}
示例3: Faces
public void Faces()
{
// create coverage
var points = new IPoint[,]
{
{new Point(0, 0), new Point(1, 0)},
{new Point(2, 1), new Point(3, 1.5)},
{new Point(1, 2), new Point(3, 3)}
};
var coverage = new DiscreteGridPointCoverage(3, 2, points.Cast<IPoint>());
var values = new[,]
{
{1.0, 2.0},
{3.0, 4.0},
{5.0, 6.0}
};
coverage.SetValues(values);
// check faces
coverage.Faces.Count
.Should().Be.EqualTo(2);
var geometry = coverage.Faces.First().Geometry;
geometry.Coordinates[0]
.Should().Be.EqualTo(points[0, 0].Coordinate);
geometry.Coordinates[3]
.Should().Be.EqualTo(points[1, 0].Coordinate);
geometry.Coordinates[2]
.Should().Be.EqualTo(points[1, 1].Coordinate);
geometry.Coordinates[1]
.Should().Be.EqualTo(points[0, 1].Coordinate);
geometry.Coordinates[4]
.Should().Be.EqualTo(points[0, 0].Coordinate);
}