MapXtreme 2005学习(1):创建临时图层
2010-04-28 09:17
260 查看
首先说明一下创建临时图层的作用,当你需要在现有的地图上动态地添加一些点或线等图元时,就可以在临时
图层中进行。比如说在作动态轨迹跟踪时,通过读取数据库中的点坐标,不断地更新轨迹和图元的位置。代码如
下:
/// <summary>
/// 创建临时图层
/// Design by Glacier
/// 2008年8月6日
/// <param name="tempLayerTableName">表名</param>
/// <param name="tempLayerName">图层名</param>
/// </summary>
public static void CreateTempLayer(string tempLayerTableName, string tempLayerName)
{
MapInfo.Mapping.Map myMap = MapInfo.Engine.Session.Current.MapFactory
[MapControl1.MapAlias];
//指定表名建立表信息
MapInfo.Data.TableInfoMemTable tblInfoTemp = new MapInfo.Data.TableInfoMemTable
(tempLayerTableName);
//确保当前目录下不存在同名表
MapInfo.Data.Table tblTemp = MapInfo.Engine.Session.Current.Catalog.GetTable
(tempLayerTableName);
if (tblTemp != null)
{
MapInfo.Engine.Session.Current.Catalog.CloseTable(tempLayerTableName);
}
//向表信息中添加可绘图列
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateFeatureGeometryColumn
(myMap.GetDisplayCoordSys()));
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStyleColumn());
//向表信息中添加自定义列
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateIntColumn("index"));
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("name", 10));
//根据表信息创建临时表
tblTemp = MapInfo.Engine.Session.Current.Catalog.CreateTable(tblInfoTemp);
//指定表,图层名和图层别名创建临时图层
FeatureLayer tempLayer = new FeatureLayer(tblTemp, tempLayerName, tempLayerName);
myMap.Layers.Add(tempLayer);
}
引用自/article/6008007.html
http://www.cnblogs.com/glacierh/category/148898.html
http://hi.baidu.com/donghaibo010/blog/category/Mapxtreme
图层中进行。比如说在作动态轨迹跟踪时,通过读取数据库中的点坐标,不断地更新轨迹和图元的位置。代码如
下:
/// <summary>
/// 创建临时图层
/// Design by Glacier
/// 2008年8月6日
/// <param name="tempLayerTableName">表名</param>
/// <param name="tempLayerName">图层名</param>
/// </summary>
public static void CreateTempLayer(string tempLayerTableName, string tempLayerName)
{
MapInfo.Mapping.Map myMap = MapInfo.Engine.Session.Current.MapFactory
[MapControl1.MapAlias];
//指定表名建立表信息
MapInfo.Data.TableInfoMemTable tblInfoTemp = new MapInfo.Data.TableInfoMemTable
(tempLayerTableName);
//确保当前目录下不存在同名表
MapInfo.Data.Table tblTemp = MapInfo.Engine.Session.Current.Catalog.GetTable
(tempLayerTableName);
if (tblTemp != null)
{
MapInfo.Engine.Session.Current.Catalog.CloseTable(tempLayerTableName);
}
//向表信息中添加可绘图列
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateFeatureGeometryColumn
(myMap.GetDisplayCoordSys()));
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStyleColumn());
//向表信息中添加自定义列
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateIntColumn("index"));
tblInfoTemp.Columns.Add(MapInfo.Data.ColumnFactory.CreateStringColumn("name", 10));
//根据表信息创建临时表
tblTemp = MapInfo.Engine.Session.Current.Catalog.CreateTable(tblInfoTemp);
//指定表,图层名和图层别名创建临时图层
FeatureLayer tempLayer = new FeatureLayer(tblTemp, tempLayerName, tempLayerName);
myMap.Layers.Add(tempLayer);
}
引用自/article/6008007.html
http://www.cnblogs.com/glacierh/category/148898.html
http://hi.baidu.com/donghaibo010/blog/category/Mapxtreme
相关文章推荐
- MapXtreme 2005学习(1):创建临时图层
- MapXtreme 2005学习(1):创建临时图层
- MapXtreme 图层操作 创建临时图层-添加图元-加图层标注-清除图元
- MapXtreme 2005 学习心得 在地图上创建点/线并显示标注(五)
- MapXtreme 2005学习(3):向图层中添加线段
- MapXtreme 2005 学习心得 缩放比例下不显示图层(十一)
- MapXtreme 2005 学习心得 在地图上创建点/线并显示标注(五)
- MapXtreme 2005 学习心得 缩放比例下不显示图层(十一)
- MapXtreme 2005 学习心得 在地图上创建点/线并显示标注(五)
- MapXtreme 2005学习(2):向图层中添加点
- MapXtreme 2005 学习心得 缩放比例下不显示图层(十一)
- MapXtreme 2005学习(4):添加标注图层
- MapXtreme 2005 学习心得 关于地图投影坐标问题的解决方式(十四)
- SQL Server 2005存储过程学习笔记——创建、修改存储过程
- MapXtreme 2005 学习心得 将wor格式转wms格式(十)
- MapXtreme 2005 学习心得 概述(一)
- MapXtreme 2005 学习心得 第八节Session问题澄清-两种配置方式致开发方式不同(九)
- MapXtreme 2005 学习心得 关于地图投影坐标问题的解决方式(十四)
- asp+mapxtreme的示例代码-通过layerinfo创建图层并画矩形
- MapXtreme 2005 学习心得 第八节Session问题澄清-两种配置方式致开发方式不同(九)