|
复制表
'*******表复制********
Dim LayerInfo As New MapXLib.LayerInfo
Dim Lyr As MapXLib.Layer
Dim LyrTemp As MapXLib.Layer
Dim Flds As MapXLib.Fields
Dim Ds As MapXLib.Dataset
Dim ObjLayerName, LayerName, FilePath As String
ObjLayerName = "目标表"
'复制源表数据到目标表
Set Lyr = MainMap.Layers.Item(LayerName)
Set Ds = Lyr.Datasets.Item(LayerName)
Set Flds = Ds.Fields
LayerInfo.Type = miLayerInfoTypeNewTable
LayerInfo.AddParameter "FileSpec", FilePath + ObjLayerName + ".TAB"
LayerInfo.AddParameter "NAME", ObjLayerName
LayerInfo.AddParameter "Features", Lyr.AllFeatures
LayerInfo.AddParameter "Fields", Flds
LayerInfo.AddParameter "AutoCreateDataset", 1
LayerInfo.AddParameter "datasetname", ObjLayerName
Set LyrTemp = MapTemp.Layers.Add(LayerInfo, 1)
'删除临时表
MapTemp.Layers.Remove (MapTemp.Layers.Count)
MapTemp.Refresh
Set Lyr = Nothing
Set Ds = Nothing
Set Flds = Nothing
Set LayerInfo = Nothing |
|