本文整理匯總了C#中BoundingBox.Grow方法的典型用法代碼示例。如果您正苦於以下問題:C# BoundingBox.Grow方法的具體用法?C# BoundingBox.Grow怎麽用?C# BoundingBox.Grow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BoundingBox
的用法示例。
在下文中一共展示了BoundingBox.Grow方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: GetFeaturesInView
public virtual IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
{
lock (_syncRoot)
{
var features = Features.ToList();
// Use a larger extent so that symbols partially outside of the extent are included
var grownBox = box.Grow(resolution*SymbolSize*0.5);
foreach (var feature in features)
{
if (feature.Geometry == null)
continue;
if (grownBox.Intersects(feature.Geometry.GetBoundingBox()))
{
yield return feature;
}
}
}
}
示例3: RenderBox
private static UIElement RenderBox(BoundingBox box, IViewport viewport)
{
const int symbolSize = 32; // todo: determine margin by symbol size
const int boxMargin = symbolSize / 2;
var path = new Path
{
Stroke = new SolidColorBrush(Colors.White),
StrokeThickness = 2,
Data = new RectangleGeometry()
};
// offset the bounding box left and up by the box margin
var offsetBox = box.Grow(boxMargin * viewport.Resolution);
GeometryRenderer.PositionRaster(path, offsetBox, viewport);
return path;
}
示例4: StartNewFetch
protected void StartNewFetch(BoundingBox extent, double resolution)
{
IsFetching = true;
NeedsUpdate = false;
extent = Transform(extent);
if (Enabled)
{
_fetched = true;
Overscan = Overscan > 1 ? Overscan : 1;
var fetcher = new FeatureFetcher(extent.Grow(extent.Width * Overscan, extent.Height * Overscan), resolution, DataSource, DataArrived);
Task.Factory.StartNew(() => fetcher.FetchOnThread(null));
}
}
示例5: GrowAndShrinkTest
public void GrowAndShrinkTest()
{
BoundingBox b1 = new BoundingBox(20, 30, 40, 55);
Assert.AreEqual(new BoundingBox(19, 29, 41, 56), b1.Grow(1));
}
示例6: GrowBox
private static BoundingBox GrowBox(BoundingBox box, double resolution)
{
const int symbolSize = 32; // todo: determine margin by symbol size
const int boxMargin = symbolSize/2;
return box.Grow(boxMargin*resolution);
}