本文整理汇总了C#中BoundingBox.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# BoundingBox.ToString方法的具体用法?C# BoundingBox.ToString怎么用?C# BoundingBox.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestVarious
public void TestVarious()
{
BoundingBox b1 = new BoundingBox(20, 30, 40, 55);
Assert.AreEqual(20, b1.Left);
Assert.AreEqual(20, b1.Min.X);
Assert.AreEqual(40, b1.Right);
Assert.AreEqual(40, b1.Max.X);
Assert.AreEqual(30, b1.Bottom);
Assert.AreEqual(30, b1.Min.Y);
Assert.AreEqual(55, b1.Top);
Assert.AreEqual(55, b1.Max.Y);
Assert.AreEqual(20, b1.Width);
Assert.AreEqual(25, b1.Height);
Assert.AreNotSame(b1, b1.Clone());
Assert.IsTrue(b1.Contains(new Point(30, 40)));
Assert.IsTrue(b1.Contains(new Point(20, 40)));
Assert.IsFalse(b1.Contains(new Point(10, 10)));
Assert.IsFalse(b1.Contains(new Point(50, 60)));
Assert.IsFalse(b1.Contains(new Point(30, 60)));
Assert.IsFalse(b1.Contains(new Point(50, 40)));
Assert.IsFalse(b1.Contains(new Point(30, 15)));
Assert.IsTrue(b1.Equals(new BoundingBox(20, 30, 40, 55)));
Assert.AreEqual(new Point(30, 42.5), b1.GetCentroid());
Assert.AreEqual(1, b1.LongestAxis);
Assert.AreEqual(new BoundingBox(19, 29, 41, 56), b1.Grow(1));
Assert.IsFalse(b1.Equals(null));
Assert.IsFalse(b1.Equals((object)new Polygon()));
Assert.AreEqual("20,30 40,55", b1.ToString());
Assert.AreEqual(b1,new BoundingBox(40,55,20,30));
Assert.AreEqual(Math.Sqrt(200), b1.Distance(new BoundingBox(50,65,60,75)));
}
示例2: DownloadAndZoomToBbox
void DownloadAndZoomToBbox(BoundingBox bbox)
{
currentCity = bbox;
string packaged = bbox.ToString();
// Package version has no use here, can be anything
if (manager.GetLocalPackageStatus(packaged, 1) == null)
{
manager.StartPackageDownload(packaged);
Alert("Downloading " + bbox.Name);
}
else {
UpdateStatusLabel("Download complete");
Alert(bbox.Name + " already downloaded. Zooming");
ContentView.ZoomTo(bbox.Center);
}
}
示例3: ToStringTest
public void ToStringTest()
{
BoundingBox b1 = new BoundingBox(20, 30, 40, 55);
Assert.AreEqual("[BoundingBox] Lower Left: (20.00, 30.00) Upper Right: (40.00, 55.00)", b1.ToString());
Assert.AreEqual("[BoundingBox] Empty", BoundingBox.Empty.ToString());
}
示例4: Validate
unsafe void Validate(int nodeIndex, int expectedParentIndex, int expectedIndexInParent, ref BoundingBox expectedBoundingBox, out int foundLeafCount)
{
var node = nodes + nodeIndex;
if (node->Parent != expectedParentIndex)
throw new Exception($"Bad parent index on node {nodeIndex}");
if (node->IndexInParent != expectedIndexInParent)
throw new Exception($"Bad index in parent on node {nodeIndex}");
var children = &node->ChildA;
var leafCounts = &node->LeafCountA;
var bounds = &node->A;
foundLeafCount = 0;
if ((expectedParentIndex >= 0 && node->ChildCount < 2) || node->ChildCount < 0 || node->ChildCount > ChildrenCapacity)
{
throw new Exception($"Internal node with {node->ChildCount} children.");
}
var badMinValue = new Vector3(float.MaxValue);
var badMaxValue = new Vector3(float.MinValue);
BoundingBox merged = new BoundingBox { Min = badMinValue, Max = badMaxValue };
for (int i = 0; i < node->ChildCount; ++i)
{
BoundingBox.Merge(ref merged, ref bounds[i], out merged);
if (bounds[i].Min == badMinValue || bounds[i].Max == badMaxValue)
throw new Exception($"Node {nodeIndex} child {i} has a bad bounding box.");
if (children[i] >= 0)
{
int childFoundLeafCount;
if (children[i] < 0 || children[i] >= nodeCount)
throw new Exception($"Implied existence of node {children[i]} is outside of count {nodeCount}.");
Validate(children[i], nodeIndex, i, ref bounds[i], out childFoundLeafCount);
if (childFoundLeafCount != leafCounts[i])
throw new Exception($"Bad leaf count for child {i} of node {nodeIndex}.");
foundLeafCount += childFoundLeafCount;
}
else
{
++foundLeafCount;
if (leafCounts[i] != 1)
{
throw new Exception($"Bad leaf count on {nodeIndex} child {i}, it's a leaf but leafCount is {leafCounts[i]}.");
}
}
}
if (expectedParentIndex >= 0 && (merged.Min != expectedBoundingBox.Min || merged.Max != expectedBoundingBox.Max))
{
throw new Exception($"Bounds {merged.ToString()}, expected {expectedBoundingBox.ToString()}.");
}
}