打开SHP、CAD文件、栅格文件的源代码.pdf
打开SHP、CAD文件、栅格文件的源代码--第1页
PublicSubOpenShpFile(strFnameAsString,strLyrNameAsString,pMapcontrolAs
MapControl)
OnErrorGoTohandle
DimiAsLong
DimpLayerAsILayer
DimpCompLayerAsICompositeLayer
DimpConAsNewCollection
DimpGroupLayerAsIGroupLayer
DimpFeatureLayerAsIFeatureLayer
DimpFeatureClassAsIFeatureClass
DimpShapeFilesAsCollection
SetpShapeFiles=SelectShapeFiles(strFname)
If(pShapeFilesIsNothing)ThenExitSub
SetpLayer=ModlayerSQL.GetLayer(strLyrName,pMapcontrol.Map)
IfTypeOfpLayerIsICompositeLayerThen
SetpCompLayer=pLayer
Fori=0TopCompLayer.Count-1
pCon.AddpCompLayer.Layer(i),CStr(i)
Nexti
Fori=1TopShapeFiles.Count
SetpFeatureLayer=NewFeatureLayer
SetpFeatureClass=pShapeFiles.Item(i)
SetpFeatureLayer.FeatureClass=pFeatureClass
pFeatureLayer.Name=pFeatureClass.AliasName
pCon.AddpFeatureLayer,CStr(pCompLayer.Count-1+i)
Nexti
SetpGroupLayer=pCompLayer
打开SHP、CAD文件、栅格文件的源代码--第1页
打开SHP、CAD文件、栅格文件的源代码--第2页
pGroupLayer.Clear
Fori=0TopCon.Count-1
pGroupLayer.AddpCon.Item(CStr(i))
Nexti
Else
所要加入的图组不是CompositeLayer!信息提示
frmMapControl.arcMapControl.MousePointer=1
ExitSub
EndIf
Else
Fori=1TopShapeFiles.Count
SetpFeatureLayer=NewFeatureLayer