ArcObjects Library Reference  (EditorExt)    

IArcPadExtension Interface

Provides access to the ArcPad Extension.

Product Availability

Available with ArcGIS Desktop.

Members

Description
Method CreateAPL Create an APL file for a directory layer (i.e. shapefiles).
Read-only property Log Log of features checked out.

CoClasses that implement IArcPadExtension

CoClasses and Classes Description
ArcPadExtension The ArcPad Tools Extension.

Remarks

IArcPadExtension is the main interface to the ArcPad extension.  Use IArcPadExtension to write out ArcPad Layer files (*.apl) for shapefile layers or to access the ArcPad transaction log.

[C#]

This sample routine creates ArcPad Layer files for all the shapefiles in the current map using C#.

public void CreateArcPadLayer()
{
  //Get a reference to the ArcPad Extension
  UID extUid = new UIDClass();
  extUid.Value = "editorExt.ArcPadExtension";
  //You can get app from ICommand :: OnCreate() hook parameter
  IArcPadExtension arcpadExt = app.FindExtensionByCLSID(extUid) as IArcPadExtension;

  //Get a reference to the Map
  IMap map = (app.Document as IMxDocument).FocusMap;

  //Check each layer in the map to see if it is a shapefile.
  //If so, increment the shapefile counter and create an APL for it
  int shapefileCount = 0;
  for (int count = 0; count < map.LayerCount; count++)
  {
    ILayer layer = map.get_Layer(count);
    if (layer is IFeatureLayer)
    {
      IDataset dataset = ((IFeatureLayer)layer).FeatureClass as IDataset;
      if (dataset.Category == "Shapefile Feature Class")
      {
        shapefileCount++;
        //Create an .APL file for the shapefile
        arcpadExt.CreateAPL(layer);
      }
    } 
  }
  System.Windows.Forms.MessageBox.Show(shapefileCount + " .APL file(s) created.");
}
[Visual Basic 6.0]

This sample routine creates ArcPad Layer files for all the shapefiles in the current map.

Sub CreateAPL()
    'Get a reference to the ArcPad Extension
    Dim pAPExtension As IArcPadExtension
    Dim pID As New UID
    pID = "esriEditorExt.ArcPadExtension"
    Set pAPExtension = Application.FindExtensionByCLSID(pID)
    
    'Get a reference to the Map
    Dim pMxDoc As IMxDocument
    Dim pMap As IMap
    Set pMxDoc = ThisDocument
    Set pMap = pMxDoc.FocusMap
    'Check each layer in the map to see if it is a shapefile
    'If so, increment the shapefile counter and create an APL for it
    Dim pLayer As ILayer
    Dim pFLayer As IFeatureLayer
    Dim pFClass As IFeatureClass
    Dim pDataSet As IDataset
    Dim lCount As Long, lShapefileCount As Long
        
    For lCount = 0 To (pMap.LayerCount - 1)
        Set pLayer = pMap.Layer(lCount)
        If TypeOf pLayer Is IFeatureLayer Then
            Set pFLayer = pLayer    'QI
            Set pFClass = pFLayer.FeatureClass
            Set pDataSet = pFClass  'QI
            If pDataSet.Category = "Shapefile Feature Class" Then
                lShapefileCount = lShapefileCount + 1
                'Create an .APL file for the shapefile
                pAPExtension.CreateAPL pLayer
            End If
        End If
    Next
    
    MsgBox lShapefileCount & " .APL file(s) created."
End Sub