Пример #1
0
        // Gets RasterInfo from a given table.
        // Each raster table has exactly one associated raster image, and thus only one record.
        // Reading that record with a data reader, we can get
        // a FeatureGeometry - a bounding rectangle,
        // a Style - the Raster style,
        // a key
        // a RasterInfo object.
        private MapInfo.Raster.RasterInfo GetRasterInfo(Table table)
        {
            MapInfo.Raster.RasterInfo rasterInfo = null;
            MIDataReader rdr            = null;
            string       projectionlist = "obj, MI_Key, MI_Raster, MI_Style";

            rdr = table.ExecuteReader(projectionlist);

            string name;
            string typename;
            int    n = rdr.FieldCount;

            MapInfo.Styles.Style             style;
            MapInfo.Geometry.FeatureGeometry featureGeometry;
            MapInfo.Data.Key key;
            if (rdr.Read())
            {
                for (int i = 0; i < rdr.FieldCount; i++)
                {
                    name     = rdr.GetName(i);
                    typename = rdr.GetDataTypeName(i);
                    if (typename == "MapInfo.Styles.Style")
                    {
                        style = rdr.GetStyle(i);
                    }
                    else if (typename == "MapInfo.Geometry.FeatureGeometry")
                    {
                        featureGeometry = rdr.GetFeatureGeometry(i);
                    }
                    else if (typename == "MapInfo.Data.Key")
                    {
                        key = rdr.GetKey(i);
                    }
                    else if (typename == "MapInfo.Raster.RasterInfo")
                    {
                        rasterInfo = rdr.GetRasterInfo(i);
                    }
                }
            }
            rdr.Close();
            rdr.Dispose();
            rdr = null;
            return(rasterInfo);
        }