當前位置: 首頁>>代碼示例>>C#>>正文


C# BoundingBox.Grow方法代碼示例

本文整理匯總了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)));
        }
開發者ID:lishxi,項目名稱:_SharpMap,代碼行數:31,代碼來源:BoundingBoxTests.cs

示例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;
                    }
                }
            }
        }
開發者ID:dobauer,項目名稱:Mapsui,代碼行數:21,代碼來源:MemoryProvider.cs

示例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;
        }
開發者ID:jdeksup,項目名稱:Mapsui.Net4,代碼行數:19,代碼來源:StackedLabelLayerRenderer.cs

示例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));
            }
        }
開發者ID:jdeksup,項目名稱:Mapsui.Net4,代碼行數:15,代碼來源:Layer.cs

示例5: GrowAndShrinkTest

        public void GrowAndShrinkTest()
        {
            BoundingBox b1 = new BoundingBox(20, 30, 40, 55);
            Assert.AreEqual(new BoundingBox(19, 29, 41, 56), b1.Grow(1));
        }
開發者ID:sridhar19091986,項目名稱:sharpmapcf,代碼行數:5,代碼來源:BoundingBoxTests.cs

示例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);
 }
開發者ID:pauldendulk,項目名稱:Mapsui,代碼行數:6,代碼來源:StackedLabelProvider.cs


注:本文中的BoundingBox.Grow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。