在MapXtreme2004 地图中创建一个显示小车的图层

None.gif private   void  btnInitializeObjects_Click( object  sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gifCatalog Cat 
= MapInfo.Engine.Session.Current.Catalog;
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
//创建临时层
InBlock.gif
TableInfoMemTable tblInfoTemp = new TableInfoMemTable("Animation");
InBlock.gifTable tblTemp 
= Cat.GetTable("Animation");
InBlock.gif
if (tblTemp != null//Table exists close it
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gifCat.CloseTable(
"Animation");
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
InBlock.gif
InBlock.giftblInfoTemp.Columns.Add(ColumnFactory.CreateFeatureGeometryColumn(mapControl1.Map.GetDisplayCoordSys()));
InBlock.giftblInfoTemp.Columns.Add(ColumnFactory.CreateStyleColumn());
InBlock.giftblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn(
"Name"40));
InBlock.giftblInfoTemp.Columns.Add(ColumnFactory.CreateStringColumn(
"Dept"15));
InBlock.giftblInfoTemp.Columns.Add(ColumnFactory.CreateIntColumn(
"Level"));
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.giftblTemp 
= Cat.CreateTable(tblInfoTemp);
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gifFeatureLayer lyr 
= new FeatureLayer(tblTemp);
InBlock.gifmapControl1.Map.Layers.Add(lyr);
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
//创建点-车
InBlock.gif
FeatureGeometry pt = new MapInfo.Geometry.Point(lyr.CoordSys, new DPoint(-7642)) as FeatureGeometry;
InBlock.gifCompositeStyle cs 
= new CompositeStyle(new SimpleVectorPointStyle(37, System.Drawing.Color.Red, 10));
InBlock.gifFeature ftr 
= new Feature(tblTemp.TableInfo.Columns);
InBlock.gifftr.Geometry 
= pt;
InBlock.gifftr.Style 
= cs;
InBlock.gifftr[
"Name"= "Kelly";
InBlock.gifftr[
"Dept"= "Sales";
InBlock.gifftr[
"Level"= 3;
InBlock.giftblTemp.InsertFeature(ftr);
InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gifFeatureGeometry pt2 
= new MapInfo.Geometry.Point(lyr.CoordSys, new DPoint(-11934)) as FeatureGeometry;
InBlock.gifCompositeStyle cs2 
= new CompositeStyle(new SimpleVectorPointStyle(44, System.Drawing.Color.Purple, 10));
InBlock.gifFeature ftr2 
= new Feature(tblTemp.TableInfo.Columns);
InBlock.gifftr2.Geometry 
= pt2;
InBlock.gifftr2.Style 
= cs2;
InBlock.gifftr2[
"Name"= "Greg";
InBlock.gifftr2[
"Dept"= "Marketing";
InBlock.gifftr2[
"Level"= 2;
InBlock.giftblTemp.InsertFeature(ftr2);
ExpandedBlockEnd.gif}

None.gif
None.gif
None.gif
None.gif
//  对于表中所有对象的移动
None.gif
private   void  timer1_Tick( object  sender, System.EventArgs e)
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
InBlock.gifCatalog cat 
= MapInfo.Engine.Session.Current.Catalog;
InBlock.gifTable tbl 
= cat.GetTable("Animation");
InBlock.gif
if (tbl != null
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.gif
//更新点的位置
InBlock.gif
tbl.BeginAccess (MapInfo.Data.TableAccessMode.Write );
InBlock.gif
foreach (Feature fcar in tbl)
ExpandedSubBlockStart.gifContractedSubBlock.gif
dot.gif{
InBlock.giffcar.Geometry.GeometryEditor.OffsetByXY(
0.5,0,MapInfo.Geometry.DistanceUnit.Degree,MapInfo.Geometry.DistanceType.Spherical);
InBlock.giffcar.Geometry.EditingComplete();
InBlock.giffcar.Update();
ExpandedSubBlockEnd.gif}

InBlock.giftbl.EndAccess ();
ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif

转载于:https://www.cnblogs.com/yuxon/archive/2006/07/06/443911.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值