MapXtreme2004 从Oracle空间数据库中导出图片
2006-01-07 12:47
513 查看
1 连接到Oracle空间数据库
TableInfoServer ti=new TableInfoServer("ZKT");
ti.Toolkit = MapInfo.Data.ServerToolkit.Oci;
ti.CacheSettings.CacheType = MapInfo.Data.CacheOption.All;
ti.MbrSearch = false;
ti.ConnectString = "SRVR=s1;UID=gis;PWD=gis;";
2 打开空间表
ti.Query = "SELECT * FROM T1 WHERE id1 = '" + strBuilderID + "'";
Table t = conn.Catalog.OpenTable(ti);
3 建立内存表,加快操作
c = MapInfo.Engine.Session.Current.Catalog;
TableInfoMemTable tiMem = new TableInfoMemTable("memZKT");
tiMem.CacheSettings.CacheType = MapInfo.Data.CacheOption.All;
tiMem.Temporary = true;
foreach(MapInfo.Data.Column c1 in t.TableInfo.Columns){
tiMem.Columns.Add(c1.Clone());
System.Diagnostics.Debug.Write(c1.Alias + "-" + c1.DataType.ToString());
}
tableMem = c.CreateTable(tiMem);
4 利用MapXtreme2004的ADO.Net从空间表导入内存表
MIConnection conn ;
MICommand miCommand;
conn = new MIConnection();
conn.Open();
miCommand = conn.CreateCommand();
miCommand.CommandText = "Insert into memZKT select * from zkt";
miCommand.ExecuteNonQuery();
5 更改图元样式
MapInfo.Styles.CompositeStyle myStyle = new MapInfo.Styles.CompositeStyle();
MapInfo.Styles.SimpleLineStyle regionBorder = new MapInfo.Styles.SimpleLineStyle();
regionBorder.Width = new MapInfo.Styles.LineWidth(1,MapInfo.Styles.LineWidthUnit.Pixel);
regionBorder.Color = System.Drawing.Color.Black;
MapInfo.Styles.SimpleInterior regionInterior = new MapInfo.Styles.SimpleInterior();
regionInterior.Pattern = (int)MapInfo.Styles.PatternStyle.None;
regionInterior.Transparent = true;
MapInfo.Styles.SimpleLineStyle lineStyle = new MapInfo.Styles.SimpleLineStyle();
lineStyle.Width = new MapInfo.Styles.LineWidth(1,MapInfo.Styles.LineWidthUnit.Pixel);
lineStyle.Color = System.Drawing.Color.Black;
myStyle.AreaStyle.Border = regionBorder;
myStyle.AreaStyle.Interior = regionInterior;
myStyle.LineStyle = lineStyle;
System.Windows.Forms.Application.DoEvents();
miCommand.CommandText = "Update memZKT Set MI_STYLE=@style ";
miCommand.Parameters.Add("@style",myStyle);
miCommand.ExecuteNonQuery();
miCommand.Parameters.Clear();
6 导出到文件
MapInfo.Mapping.MapExport exp = new MapInfo.Mapping.MapExport(_map);
exp.Format = MapInfo.Mapping.ExportFormat.Jpeg;
MapInfo.Geometry.DRect bounds = f.Geometry.Bounds;
newBounds.x1 = bounds.x2 + (bounds.Width() / 2);
newBounds.y1 = bounds.y2 + (bounds.Height() / 2);
newBounds.x2 = bounds.x1 - (bounds.Width() / 2);
newBounds.y2 = bounds.y1 - (bounds.Height() / 2);
_map.Center = f.Geometry.Centroid;
_map.Bounds = newBounds;
exp.Export(strDir + f["id"].ToString() + ".jpg");
TableInfoServer ti=new TableInfoServer("ZKT");
ti.Toolkit = MapInfo.Data.ServerToolkit.Oci;
ti.CacheSettings.CacheType = MapInfo.Data.CacheOption.All;
ti.MbrSearch = false;
ti.ConnectString = "SRVR=s1;UID=gis;PWD=gis;";
2 打开空间表
ti.Query = "SELECT * FROM T1 WHERE id1 = '" + strBuilderID + "'";
Table t = conn.Catalog.OpenTable(ti);
3 建立内存表,加快操作
c = MapInfo.Engine.Session.Current.Catalog;
TableInfoMemTable tiMem = new TableInfoMemTable("memZKT");
tiMem.CacheSettings.CacheType = MapInfo.Data.CacheOption.All;
tiMem.Temporary = true;
foreach(MapInfo.Data.Column c1 in t.TableInfo.Columns){
tiMem.Columns.Add(c1.Clone());
System.Diagnostics.Debug.Write(c1.Alias + "-" + c1.DataType.ToString());
}
tableMem = c.CreateTable(tiMem);
4 利用MapXtreme2004的ADO.Net从空间表导入内存表
MIConnection conn ;
MICommand miCommand;
conn = new MIConnection();
conn.Open();
miCommand = conn.CreateCommand();
miCommand.CommandText = "Insert into memZKT select * from zkt";
miCommand.ExecuteNonQuery();
5 更改图元样式
MapInfo.Styles.CompositeStyle myStyle = new MapInfo.Styles.CompositeStyle();
MapInfo.Styles.SimpleLineStyle regionBorder = new MapInfo.Styles.SimpleLineStyle();
regionBorder.Width = new MapInfo.Styles.LineWidth(1,MapInfo.Styles.LineWidthUnit.Pixel);
regionBorder.Color = System.Drawing.Color.Black;
MapInfo.Styles.SimpleInterior regionInterior = new MapInfo.Styles.SimpleInterior();
regionInterior.Pattern = (int)MapInfo.Styles.PatternStyle.None;
regionInterior.Transparent = true;
MapInfo.Styles.SimpleLineStyle lineStyle = new MapInfo.Styles.SimpleLineStyle();
lineStyle.Width = new MapInfo.Styles.LineWidth(1,MapInfo.Styles.LineWidthUnit.Pixel);
lineStyle.Color = System.Drawing.Color.Black;
myStyle.AreaStyle.Border = regionBorder;
myStyle.AreaStyle.Interior = regionInterior;
myStyle.LineStyle = lineStyle;
System.Windows.Forms.Application.DoEvents();
miCommand.CommandText = "Update memZKT Set MI_STYLE=@style ";
miCommand.Parameters.Add("@style",myStyle);
miCommand.ExecuteNonQuery();
miCommand.Parameters.Clear();
6 导出到文件
MapInfo.Mapping.MapExport exp = new MapInfo.Mapping.MapExport(_map);
exp.Format = MapInfo.Mapping.ExportFormat.Jpeg;
MapInfo.Geometry.DRect bounds = f.Geometry.Bounds;
newBounds.x1 = bounds.x2 + (bounds.Width() / 2);
newBounds.y1 = bounds.y2 + (bounds.Height() / 2);
newBounds.x2 = bounds.x1 - (bounds.Width() / 2);
newBounds.y2 = bounds.y1 - (bounds.Height() / 2);
_map.Center = f.Geometry.Centroid;
_map.Bounds = newBounds;
exp.Export(strDir + f["id"].ToString() + ".jpg");
相关文章推荐
- MapXtreme2004 从Oracle空间数据库中导出图片
- oracle 数据库表空间的导出
- [转]Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- Oracle 数据库操作 导入导出 删除用户 表空间
- oracle新建表空间和用户、导入导出数据库文件
- [转]Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- (转)Linux下Oracle启动、建立表空间、用户、授权、数据库导入导出
- Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- Oracle创建删除用户 角色 表空间 导入导出数据库
- Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- oracle 11g linux 建立表空间 用户 授权 数据库导入导出
- Linux下Oracle启动、建立表空间、用户、授权、数据库导入导出
- oracle 11g linux 建立表空间 用户 授权 数据库导入导出
- Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- Oracle创建删除用户,角色,表空间,导入导出数据库命令总结(转载)
- Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- Oracle创建删除用户、角色、表空间、导入导出数据库命令行方式总结
- oracle 创建数据库 表空间 用户 授权和toad导入导出数据库
- oracle创建表空间 用户 数据库导入和导出