当前位置: 首页>>代码示例>>C#>>正文


C# Envelope.Contains方法代码示例

本文整理汇总了C#中Envelope.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.Contains方法的具体用法?C# Envelope.Contains怎么用?C# Envelope.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Envelope的用法示例。


在下文中一共展示了Envelope.Contains方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClipGeometryCollection

        private static IGeometryCollection ClipGeometryCollection(IGeometryCollection geom, Envelope clipEnv)
        {
            var clipPoly = geom.Factory.ToGeometry(clipEnv);
            var clipped = new List<IGeometry>();
            for (var i = 0; i < geom.NumGeometries; i++)
            {
                var g = geom.GetGeometryN(i);
                IGeometry result = null;
                // don't clip unless necessary
                if (clipEnv.Contains(g.EnvelopeInternal))
                    result = g;
                else if (clipEnv.Intersects(g.EnvelopeInternal))
                {
                    result = clipPoly.Intersection(g);
                    // keep vertex key info
                    result.UserData = g.UserData;
                }

                if (result != null && !result.IsEmpty)
                {
                    clipped.Add(result);
                }
            }
            return geom.Factory.CreateGeometryCollection(GeometryFactory.ToGeometryArray(clipped));
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:25,代码来源:PolygonMap.cs

示例2: CheckPointInNode

        public static bool CheckPointInNode(Coordinate coord, Envelope box)
        {
            bool _isChecked;

            if (box.Contains(coord))
            {
                _isChecked = true;
            }
            else
            {
                _isChecked = false;
            }
            return _isChecked;
        }
开发者ID:haoye1985,项目名称:Oasis-V1.2,代码行数:14,代码来源:GeospatialHelper.cs

示例3: ExecuteIntersectionQueryReturnsExpectedFeatures

        public void ExecuteIntersectionQueryReturnsExpectedFeatures()
        {
            DataTable source = CreateDataTableSource();
            DataTablePoint provider = new DataTablePoint(source, "oid", "x", "y");

            var query = new Envelope(400, 600, 400, 600);

            FeatureDataTable expected = new FeatureDataTable();
            expected.TableName = "PointSource";

            foreach (DataColumn column in source.Columns)
            {
                expected.Columns.Add(column.ColumnName, column.DataType);
            }

            foreach (DataRowView rowView in source.DefaultView)
            {
                if (query.Contains(new Coordinate((double) rowView["x"], (double) rowView["y"])))
                {
                    expected.ImportRow(rowView.Row);
                }
            }

            FeatureDataSet dataSet = new FeatureDataSet();
            provider.ExecuteIntersectionQuery(query, dataSet);
            Assert.IsNotNull(dataSet);
            Assert.IsNotNull(dataSet.Tables);
            Assert.AreEqual(1, dataSet.Tables.Count);

            FeatureDataTable actual = dataSet.Tables[0];

            Assert.AreEqual(expected.Rows.Count, actual.Rows.Count);

            foreach (DataRowView expectedRowView in expected.DefaultView)
            {
                DataRow[] actualRows = actual.Select("oid = " + expectedRowView["oid"]);
                Assert.AreEqual(1, actualRows.Length);
                Assert.AreEqual(expectedRowView["oid"], actualRows[0]["oid"]);
                Assert.AreEqual(expectedRowView["x"], actualRows[0]["x"]);
                Assert.AreEqual(expectedRowView["y"], actualRows[0]["y"]);
            }
        }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:42,代码来源:DataTablePointTests.cs

示例4: TestEverything

        public void TestEverything()
        {
            Envelope e1 = new Envelope();
            Assert.IsTrue(e1.IsNull);
            Assert.AreEqual(0, e1.Width, 1E-3);
            Assert.AreEqual(0, e1.Height, 1E-3);
            e1.ExpandToInclude(100, 101);
            e1.ExpandToInclude(200, 202);
            e1.ExpandToInclude(150, 151);
            Assert.AreEqual(200, e1.MaxX, 1E-3);
            Assert.AreEqual(202, e1.MaxY, 1E-3);
            Assert.AreEqual(100, e1.MinX, 1E-3);
            Assert.AreEqual(101, e1.MinY, 1E-3);
            Assert.IsTrue(e1.Contains(120, 120));
            Assert.IsTrue(e1.Contains(120, 101));
            Assert.IsTrue(!e1.Contains(120, 100));
            Assert.AreEqual(101, e1.Height, 1E-3);
            Assert.AreEqual(100, e1.Width, 1E-3);
            Assert.IsTrue(!e1.IsNull);

            Envelope e2 = new Envelope(499, 500, 500, 501);
            Assert.IsTrue(!e1.Contains(e2));
            Assert.IsTrue(!e1.Intersects(e2));
            e1.ExpandToInclude(e2);
            Assert.IsTrue(e1.Contains(e2));
            Assert.IsTrue(e1.Intersects(e2));
            Assert.AreEqual(500, e1.MaxX, 1E-3);
            Assert.AreEqual(501, e1.MaxY, 1E-3);
            Assert.AreEqual(100, e1.MinX, 1E-3);
            Assert.AreEqual(101, e1.MinY, 1E-3);

            Envelope e3 = new Envelope(300, 700, 300, 700);
            Assert.IsTrue(!e1.Contains(e3));
            Assert.IsTrue(e1.Intersects(e3));

            Envelope e4 = new Envelope(300, 301, 300, 301);
            Assert.IsTrue(e1.Contains(e4));
            Assert.IsTrue(e1.Intersects(e4));
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:39,代码来源:EnvelopeTest.cs

示例5: ComputeKey

 /// <summary>
 /// Return a square envelope containing the argument envelope,
 /// whose extent is a power of two and which is based at a power of 2.
 /// </summary>
 /// <param name="itemEnv"></param>
 public void ComputeKey(Envelope itemEnv)
 {
     _level = ComputeQuadLevel(itemEnv);
     _env = new Envelope();
     ComputeKey(_level, itemEnv);
     // MD - would be nice to have a non-iterative form of this algorithm
     while (!_env.Contains(itemEnv))
     {
         _level += 1;
         ComputeKey(_level, itemEnv);
     }
 }
开发者ID:barentswatch,项目名称:NetTopologySuite,代码行数:17,代码来源:Key.cs

示例6: CheckEnvelope

        private void CheckEnvelope()
        {
            if (_distance < 0.0) return;

            double padding = _distance * MaxEnvDiffFrac;
            if (padding == 0.0) padding = 0.001;

            var expectedEnv = new Envelope(_input.EnvelopeInternal);
            expectedEnv.ExpandBy(_distance);

            var bufEnv = new Envelope(_result.EnvelopeInternal);
            bufEnv.ExpandBy(padding);

            if (!bufEnv.Contains(expectedEnv))
            {
                _isValid = false;
                _errorMsg = "Buffer envelope is incorrect";
                _errorIndicator = _result;
            }
            Report("Envelope");
        }
开发者ID:ste10k41,项目名称:nettopologysuite,代码行数:21,代码来源:BufferResultValidator.cs

示例7: IsInSegmentEnvelopes

        ///// <summary>
        /////
        ///// </summary>
        ///// <param name="x1"></param>
        ///// <param name="x2"></param>
        ///// <param name="x3"></param>
        ///// <param name="x4"></param>
        ///// <returns></returns>
        //private double SmallestInAbsValue(double x1, double x2, double x3, double x4)
        //{
        //    double x = x1;
        //    double xabs = Math.Abs(x);
        //    if (Math.Abs(x2) < xabs)
        //    {
        //        x = x2;
        //        xabs = Math.Abs(x2);
        //    }
        //    if (Math.Abs(x3) < xabs)
        //    {
        //        x = x3;
        //        xabs = Math.Abs(x3);
        //    }
        //    if (Math.Abs(x4) < xabs)
        //        x = x4;
        //    return x;
        //}

        /// <summary>
        /// Test whether a point lies in the envelopes of both input segments.
        /// A correctly computed intersection point should return <c>true</c>
        /// for this test.
        /// Since this test is for debugging purposes only, no attempt is
        /// made to optimize the envelope test.
        /// </summary>
        /// <param name="intPt"></param>
        /// <returns><c>true</c> if the input point lies within both input segment envelopes.</returns>
        private bool IsInSegmentEnvelopes(Coordinate intPt)
        {
            Envelope env0 = new Envelope(InputLines[0, 0], InputLines[0, 1]);
            Envelope env1 = new Envelope(InputLines[1, 0], InputLines[1, 1]);
            return env0.Contains(intPt) && env1.Contains(intPt);
        }
开发者ID:DIVEROVIEDO,项目名称:DotSpatial,代码行数:42,代码来源:RobustLineIntersector.cs


注:本文中的Envelope.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。