免费视频|新人指南|投诉删帖|广告合作|地信网APP下载

查看: 2107|回复: 1
收起左侧

[GIS资料] MapX4.5实现表紧缩

[复制链接]

2072

主题

100000万

铜板

363

好友

地信专家组

每一次的分离都是为了下一次的相聚

Rank: 14Rank: 14Rank: 14Rank: 14

积分
17622

精华勋章宣传勋章爱心勋章组织勋章地信元老灌水勋章荣誉会员勋章活跃勋章贡献勋章

发表于 2009-11-15 16:38 | 显示全部楼层 |阅读模式
[GIS资料] MapX4.5实现表紧缩
年做了MapX方面的毕业设计,现在找到这个方面的资料,和大家共享。下面是转贴。
MapX4.5实现表紧缩
CMapXLayer layer = m_ctrlMapX.GetLayers().Item(m_ctrlMapX.GetLayers().GetCount());
VARIANT vtLayer;
vtLayer.vt = VT_DISPATCH;
vtLayer.pdispVal = layer.m_lpDispatch;
CMapXDataset dataSet = m_ctrlMapX.GetDatasets().Add(miDataSetLayer, vtLayer,"pack");
CString dsname = m_ctrlMapX.GetDatasets().Item(1).GetName();
CString layername = layer.GetName();
CString layerFilespec = layer.GetFilespec();
//将layer上的内容复制到临时表中
CMapXLayerInfo m_LayerInfo;
m_LayerInfo.CreateDispatch(m_LayerInfo.GetClsid());
m_LayerInfo.SetType(6); //临时表(miLayerInfoTypeTemp)
VARIANT vtparam1;
vtparam1.vt = VT_BSTR;
vtparam1.bstrVal = CString("MemTable").AllocSysString();
m_LayerInfo.AddParameter("TableStorageType", vtparam1);
VARIANT vtparam2;
vtparam2.vt = VT_BSTR;
vtparam2.bstrVal = CString("lyrpack").AllocSysString();
m_LayerInfo.AddParameter("Name", vtparam2);

VARIANT m_Fields;
CMapXFields n_Fields;
n_Fields.CreateDispatch(n_Fields.GetClsid());
n_Fields=dataSet.GetFields();
m_Fields.vt = VT_DISPATCH;
m_Fields.pdispVal = n_Fields.m_lpDispatch;
m_LayerInfo.AddParameter("Fields", m_Fields);

VARIANT m_Features;
CMapXFeatures n_Features=layer.AllFeatures();
m_Features.vt = VT_DISPATCH;
m_Features.pdispVal=n_Features.m_lpDispatch;
m_LayerInfo.AddParameter("Features", m_Features);
CMapXLayer packlyr = m_ctrlMapX.GetLayers().Add(m_LayerInfo);
//已将layer复制到临时表中
//从地图窗口
m_ctrlMapX.GetDatasets().Remove("pack");
m_ctrlMapX.GetLayers().Remove(layername);

//创建dataset for packlyr
vtLayer.vt = VT_DISPATCH;
vtLayer.pdispVal = packlyr.m_lpDispatch;
dataSet = m_ctrlMapX.GetDatasets().Add(miDataSetLayer, vtLayer,"pack");
//创建新表
CMapXLayerInfo newlayerInfo;
newlayerInfo.CreateDispatch(newlayerInfo.GetClsid());
newlayerInfo.SetType(7); //新表(miLayerInfoTypeNewTalbe)
newlayerInfo.AddParameter("filespec",COleVariant(layerFilespec));
newlayerInfo.AddParameter("Name", COleVariant(layername));
n_Fields=dataSet.GetFields();
m_Fields.vt = VT_DISPATCH;
m_Fields.pdispVal = n_Fields.m_lpDispatch;
newlayerInfo.AddParameter("Fields", m_Fields);
CMapXFeatures features = packlyr.AllFeatures();
VARIANT fs;
fs.vt = VT_DISPATCH;
fs.pdispVal=features.m_lpDispatch;
newlayerInfo.AddParameter("features",fs);
newlayerInfo.AddParameter("OverwriteFile",COleVariant("1"));
long lPosition = 4;//m_ctrlMapX.GetLayers().GetCount();
VARIANT newlyr;
newlyr.vt=VT_DISPATCH;
newlyr.pdispVal=newlayerInfo.m_lpDispatch;
VARIANT lp;
lp.vt = VT_I4;
lp.lVal = lPosition;
m_ctrlMapX.GetLayers().Add(newlayerInfo.m_lpDispatch);
m_ctrlMapX.GetLayers().Move(2,(short)m_ctrlMapX.GetLayers().GetCount());
//删除临时表
m_ctrlMapX.GetDatasets().Remove("pack");
m_ctrlMapX.GetLayers().Remove("lyrpack");

0

主题

2632

铜板

0

好友

教授级高工

Rank: 12Rank: 12Rank: 12

积分
1542
发表于 2025-1-9 16:01 | 显示全部楼层
探矿者软件可以提高矿体的命中率,减少找矿的成本和难度,主要功能:数据管理、二维制图、三维建模、储量估算、三维立体预测等,有需要免费试用可以联系负责人邓帅15377311476(微信同号),软件针对单位或者企业试用,不面向个人试用
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

在线客服
快速回复 返回顶部 返回列表