Ejemplo n.º 1
0
        // search through all tables to find objects that intersect
        // the states bordering KS
        private void menuItemSearchMultipleTables_Click(object sender, System.EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                // find states that intersect KS
                // then combine them and search all layers within
                // also uses search for feature
                Feature    fKS = _catalog.SearchForFeature("usa", MapInfo.Data.SearchInfoFactory.SearchWhere("State='KS'"));
                SearchInfo si  = MapInfo.Data.SearchInfoFactory.SearchIntersectsFeature(fKS, IntersectType.Geometry);
                IResultSetFeatureCollection fc = _catalog.Search("usa", si);

                MapInfo.FeatureProcessing.FeatureProcessor fp = new MapInfo.FeatureProcessing.FeatureProcessor();
                Feature f = fp.Combine(fc);

                si = MapInfo.Data.SearchInfoFactory.SearchWithinFeature(f, ContainsType.Centroid);
                MultiResultSetFeatureCollection mfc = _catalog.Search(_catalog.EnumerateTables(TableFilterFactory.FilterMappableTables()), si);

                // set map view to show search results
                _map.SetView(f);

                ShowSearchGeometry(f.Geometry);

                // show results as selection
                SelectFeatureCollection(fc);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Ejemplo n.º 2
0
        // search through all tables to find objects that intersect
        // the states bordering KS
        private void menuItemSearchMultipleTables_Click(object sender, System.EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                // find states that intersect KS
                // then combine them and search all layers within
                // also uses search for feature
                Feature fKS = _catalog.SearchForFeature("usa", MapInfo.Data.SearchInfoFactory.SearchWhere("State='KS'"));
                SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchIntersectsFeature(fKS, IntersectType.Geometry);
                IResultSetFeatureCollection fc = _catalog.Search("usa", si);

                MapInfo.FeatureProcessing.FeatureProcessor fp = new MapInfo.FeatureProcessing.FeatureProcessor();
                Feature f = fp.Combine(fc);

                si = MapInfo.Data.SearchInfoFactory.SearchWithinFeature(f, ContainsType.Centroid);
                MultiResultSetFeatureCollection mfc = _catalog.Search(_catalog.EnumerateTables(TableFilterFactory.FilterMappableTables()), si);

                // set map view to show search results
                _map.SetView(f);

                ShowSearchGeometry(f.Geometry);

                // show results as selection
                SelectFeatureCollection(fc);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }