This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Create MARasterLayer Snippet (ArcObjects .NET 10.4 SDK) |
Returns an MARasterLayer from a RasterWorkspacEx and an RPF catalog name string.
///<summary>Returns an MARasterLayer from a RasterWorkspacEx and an RPF catalog name string.</summary> /// ///<param name="rasterWorkspaceEx">An IRasterWorkspaceEx interface</param> ///<param name="rasterCatalogName">A System.String of an existing RPF catalog. Example: "myRPFrasterCatalog".</param> /// ///<returns>An IMARasterLayer interface</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.DefenseSolutions.IMARasterLayer CreateMARasterLayer(ESRI.ArcGIS.Geodatabase.IRasterWorkspaceEx rasterWorkspaceEx, System.String rasterCatalogName) { // Open the raster catalog ESRI.ArcGIS.Geodatabase.IRasterCatalog rasterCatalog=rasterWorkspaceEx.OpenRasterCatalog(rasterCatalogName); // Create the MARasterLayer ESRI.ArcGIS.DefenseSolutions.IMARasterLayer maRasterLayer=new ESRI.ArcGIS.DefenseSolutions.MARasterLayerClass(); if (!(maRasterLayer.Setup((ESRI.ArcGIS.Geodatabase.ITable)rasterCatalog) == true)) // Explicit Cast { return null; } else { return maRasterLayer; } }
'''<summary>Returns an MARasterLayer from a RasterWorkspacEx and an RPF catalog name string.</summary> ''' '''<param name="rasterWorkspaceEx">An IRasterWorkspaceEx interface</param> '''<param name="rasterCatalogName">A System.String of an existing RPF catalog. Example: "myRPFrasterCatalog".</param> ''' '''<returns>An IMARasterLayer interface</returns> ''' '''<remarks></remarks> Public Function CreateMARasterLayer(ByVal rasterWorkspaceEx As ESRI.ArcGIS.Geodatabase.IRasterWorkspaceEx, ByVal rasterCatalogName As System.String) As ESRI.ArcGIS.DefenseSolutions.IMARasterLayer 'Open the raster catalog Dim rasterCatalog As ESRI.ArcGIS.Geodatabase.IRasterCatalog=rasterWorkspaceEx.OpenRasterCatalog(rasterCatalogName) 'Create the MARasterLayer Dim maRasterLayer As ESRI.ArcGIS.DefenseSolutions.IMARasterLayer=New ESRI.ArcGIS.DefenseSolutions.MARasterLayerClass If Not maRasterLayer.Setup(CType(rasterCatalog, ESRI.ArcGIS.Geodatabase.ITable))=True Then Return Nothing Else Return maRasterLayer End If End Function