![]() |
This document is archived and information here might be outdated. Recommended version. |
Add KML data to a globe
///<summary>Add KML data to a globe.</summary>
///
///<param name="theKmlFile">A System.String that is the path and filename to the KLM data. Example: "C:\YourFolder\abc.kml"</param>
///<param name="globe">An IGlobe interface</param>
///<param name="kmlLayerName">A System.String that is the display name of the new KML layer. Example: "TheKmlLayer"</param>
///
///<remarks></remarks>
public void AddKMLDataToGlobe(System.String theKmlFile, ESRI.ArcGIS.GlobeCore.IGlobe globe, System.String kmlLayerName)
{
System.Type kmlType=System.Type.GetTypeFromProgID("esriGlobeCore.KmlLayer");
ESRI.ArcGIS.GlobeCore.IKmlLayer kmlLayer=(ESRI.ArcGIS.GlobeCore.IKmlLayer)System.Activator.CreateInstance(kmlType); // Explicit cast
kmlLayer.DataPath=theKmlFile;
kmlLayer.Name=kmlLayerName;
ESRI.ArcGIS.Analyst3D.IScene scene=globe as ESRI.ArcGIS.Analyst3D.IScene; // Reference or Boxing Conversion
scene.AddLayer(kmlLayer as ESRI.ArcGIS.Carto.ILayer, true); // Reference or Boxing Conversion
}
'''<summary>Add KML data to a globe.</summary>
'''
'''<param name="theKmlFile">A System.String that is the path and filename to the KLM data. Example: "C:\YourFolder\abc.kml"</param>
'''<param name="globe">An IGlobe interface</param>
'''<param name="kmlLayerName">A System.String that is the display name of the new KML layer. Example: "TheKmlLayer"</param>
'''
'''<remarks></remarks>
Public Sub AddKMLDataToGlobe(ByVal theKmlFile As System.String, ByVal globe As ESRI.ArcGIS.GlobeCore.IGlobe, ByVal kmlLayerName As System.String)
Dim kmlType As System.Type=System.Type.GetTypeFromProgID("esriGlobeCore.KmlLayer")
Dim kmlLayer As ESRI.ArcGIS.GlobeCore.IKmlLayer=CType(System.Activator.CreateInstance(kmlType), ESRI.ArcGIS.GlobeCore.IKmlLayer) ' Explicit Cast
kmlLayer.DataPath=theKmlFile
kmlLayer.Name=kmlLayerName
Dim scene As ESRI.ArcGIS.Analyst3D.IScene=CType(globe, ESRI.ArcGIS.Analyst3D.IScene) ' Explicit Cast
scene.AddLayer(CType(kmlLayer, ESRI.ArcGIS.Carto.ILayer), True) ' Explicit Cast
End Sub