Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static IntersectionMatrix Relate(IGeometry a, IGeometry b)
        {
            RelateOp           relOp = new RelateOp(a, b);
            IntersectionMatrix im    = relOp.IntersectionMatrix;

            return(im);
        }
Esempio n. 2
0
		///<summary>
		/// Returns the DE-9IM intersection matrix for the two Geometrys.  
		///</summary>
		///<param name="geometry">The Geometry with which to compare this Geometry.</param>
		///<returns>
		///Returns a matrix describing the intersections of the interiors,  boundaries and 
		///exteriors of the two Geometrys
		///</returns>
		public virtual IntersectionMatrix Relate(Geometry geometry) 
		{
			CheckNotGeometryCollection(this);
			CheckNotGeometryCollection(geometry);
			CheckEqualSRID(geometry);
			CheckEqualPrecisionModel(geometry);
			return RelateOp.Relate(this, geometry);
		}
        void RunRelateTest(string wkt1, string wkt2, IBoundaryNodeRule bnRule, string expectedIM)
        {
            var    g1    = _rdr.Read(wkt1);
            var    g2    = _rdr.Read(wkt2);
            var    im    = RelateOp.Relate(g1, g2, bnRule);
            string imStr = im.ToString();

            //TestContext.WriteLine(imStr);
            Assert.IsTrue(im.Matches(expectedIM));
        }
        void RunRelateTest(String wkt1, String wkt2, IBoundaryNodeRule bnRule, String expectedIM)
        {
            IGeometry          g1    = rdr.Read(wkt1);
            IGeometry          g2    = rdr.Read(wkt2);
            IntersectionMatrix im    = RelateOp.Relate(g1, g2, bnRule);
            String             imStr = im.ToString();

            Console.WriteLine(imStr);
            Assert.IsTrue(im.Matches(expectedIM));
        }
Esempio n. 5
0
        private static void RunRelateTest(string wkt1, string wkt2, string expectedIM)
        {
            var    g1    = Reader.Read(wkt1);
            var    g2    = Reader.Read(wkt2);
            var    im    = RelateOp.Relate(g1, g2);
            string imStr = im.ToString();

            //TestContext.WriteLine("expected: {0}", expectedIM);
            //TestContext.WriteLine("result:   {0}", imStr);
            Assert.IsTrue(im.Matches(expectedIM));
        }
Esempio n. 6
0
        /// <summary>
        /// Spatial filter using DotSpatial
        /// </summary>
        /// <param name="featureSet">FeatureSet</param>
        /// <param name="geometry">Spatial geometry</param>
        /// <returns>Indexs of selected features</returns>
        public static List <int> SpatialFilter(IFeatureSet featureSet, IGeometry geometry)
        {
            List <int> indexList = new List <int>();

            for (int i = 0; i < featureSet.Features.Count; i++)
            {
                if (RelateOp.Relate(featureSet.Features[i].Geometry, geometry).IsIntersects())
                {
                    indexList.Add(i);
                }
            }

            return(indexList);
        }
Esempio n. 7
0
        /// <summary>
        /// Spatial query using DotSpatial
        /// </summary>
        /// <param name="featureSet">FeatureSet</param>
        /// <param name="geometry">Spatial geometry</param>
        /// <returns>Selected features</returns>
        public static IFeatureSet SpatialQuery(IFeatureSet featureSet, IGeometry geometry)
        {
            List <IFeature> features = new List <IFeature>();

            for (int i = 0; i < featureSet.Features.Count; i++)
            {
                if (RelateOp.Relate(featureSet.Features[i].Geometry, geometry).IsIntersects())
                {
                    features.Add(featureSet.Features[i]);
                }
            }

            FeatureSet result = new FeatureSet(features);

            result.Projection = CloneableEM.Copy(featureSet.Projection);
            result.InvalidateEnvelope(); // the new set will likely have a different envelope bounds

            return(result);
        }
Esempio n. 8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 public static IntersectionMatrix Relate(IGeometry a, IGeometry b)
 {
     RelateOp relOp = new RelateOp(a, b);
     IntersectionMatrix im = relOp.IntersectionMatrix;
     return im;
 }