Ejemplo n.º 1
0
        private MapInfo.Styles.RasterStyle GetRasterStyle(Table table)
        {
            MapInfo.Styles.RasterStyle rasterStyle = null;
            MIDataReader rdr            = null;
            string       projectionlist = "MI_Style";

            rdr = table.ExecuteReader(projectionlist);

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

            MapInfo.Styles.Style style = null;
            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);
                    }
                }
            }
            rdr.Close();
            rdr.Dispose();
            rdr = null;
            if (style != null)
            {
                rasterStyle = style as RasterStyle;
            }
            return(rasterStyle);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
		public void SelectAllIndivColumns()
		{
			MIDataReader rdr = null;
			string projectionlist = "obj, MI_Key, MI_Grid, MI_Style";
			rdr = _miTable.ExecuteReader(projectionlist);
			
			string name;
			string typename;
			int n = rdr.FieldCount;
			if(rdr.Read())
			{
				n = rdr.FieldCount;//shouldn't change
				for(int i =0; i <n; i++)
				{
					name = rdr.GetName(i);
					typename = rdr.GetDataTypeName(i);
					if(typename == "MapInfo.Styles.Style")
					{
						_mStyle = rdr.GetStyle(i) as GridStyle; 
					}
					else if(typename == "MapInfo.Geometry.FeatureGeometry")
					{
						_mObject = rdr.GetFeatureGeometry(i);
					}
					else if(typename == "MapInfo.Data.Key")
					{
						_mKey = rdr.GetKey(i);
					}
					else if (typename == "MapInfo.Raster.GridInfo")
					{
						_mGridInfo = rdr.GetGridInfo(i);
					}
				}
			}

			rdr.Close();
			rdr.Dispose();
			rdr = null;
		}
Ejemplo n.º 4
0
        private string DetermineRemoteGeomType(FeatureLayer layer)
        {
            MapInfo.Data.Table   t     = layer.Table;
            MapInfo.Styles.Style style = null;

            MIConnection con = null;
            MICommand    cmd = null;
            MIDataReader dr  = null;

            try {
                con = new MIConnection();
                con.Open();
                cmd             = con.CreateCommand();
                cmd.CommandText = "select mi_style from \"" + t.Alias + "\"";
                cmd.CommandType = System.Data.CommandType.Text;
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    if (!dr.IsDBNull(0))
                    {
                        style = dr.GetStyle(0);
                        break;
                    }
                }
            }
            catch (MIException) {
                // e.g. if there is no mi_style column
            }
            finally {
                if (cmd != null)
                {
                    cmd.Dispose();
                    cmd = null;
                }
                if (dr != null)
                {
                    dr.Close();
                }
                if (con != null)
                {
                    con.Close();
                    con = null;
                }
            }

            if (style != null)
            {
                if (style is SimpleLineStyle)
                {
                    return("lclayerline.bmp");
                }
                else if (style is SimpleInterior || style is AreaStyle)
                {
                    return("lclayerregion.bmp");
                }
                else if (style is BasePointStyle)
                {
                    return("lclayerpoint.bmp");
                }
                else
                {
                    return("lclayer.bmp");
                }
            }
            else
            {
                return(null);
            }
        }