The ArcGIS libraries define many different types of layer classes to visually represent different sources of data (for example, FeatureLayer, TinLayer, CadLayer, and CoverageAnnotationLayer). These layers display geographic data stored in datasets, such as shapefiles, CAD files, image files, and feature classes, which are stored in a geodatabase.
Look at the Carto Layer Object Model Diagram to find out more about the existing layer classes. To begin, you can see that all layer objects are subtypes of the Layer abstract class. All layer objects implement the interfaces ILayer and IGeoDataset; therefore, any custom layer should implement at least these interfaces. The ILayer interface controls the drawing properties and actual drawing of the layer. The IGeoDataset interface defines the extent and spatial reference system for a layer so that it can be projected and georeferenced.
When you look further at the Carto Layer OMD, you will see that the class hierarchy for layers appears somewhat complex. This is because there are a wide range of different types of layers providing wide ranging functionality. You will find that the FeatureLayer class inherits from not only the Layer abstract class but also from the DataLater, DisplayLayer, TableLayer, and AnalysisLayer abstract classes. The RasterLayer inherits from all these except the AnalysisLayer abstract class because AnalysisLayer contains interfaces that work with a vector-based data model, which uses features (for example, IFeatureSelection); a raster layer, of course, does not use a vector data model. Many other classes that derive from these layer abstract classes can be found, via the indicated links on the diagrams of other areas of the ArcGIS object model.
You may have a custom or unsupported data format that you would like to display in a map without having to first convert it to a data format supported by ArcGIS. Perhaps you would to like to extend the way an existing layer class draws? Writing your own layer object enables you to support the drawing of new data formats and to customize how existing data formats are displayed.
A custom layer allows you to display an unsupported data source in a map. You could also change the way an existing layer class draws by using a custom layer.
If you have a custom data format you would like to support in ArcGIS there are a few different options you can implement. See 'Plug-in data sources' in Chapter 7 for more information on the different solutions for integrating custom data sources, in particular the table summarizing the benefits of each solution.
Custom layers are often used to accentuate a map so better spatial analysis and edits can be made to feature datasets already loaded in the map. Like annotation layers, custom layers can be used to display different geometric objects such as points and lines in a single layer. Custom layers can be used to display dynamic data as well. If your objective is to simply map your data by providing a custom visual representation and there are not any requirements to provide functionality, such as complex editing and data analysis, then a custom layer object is likely an excellent solution for you. Otherwise, you should consider the option of importing your data into a format supported by ArcGIS so you can take advantage of the many toolsets provided to work with your data.
If you would like to extend the way ArcGIS draws the currently supported data formats, there are a few different options you can implement. See 'Custom feature renderers' in Chapter 5 of Extending ArcObjects for more information. Extending the way an existing layer coclass (for example, FeatureLayer) draws requires the creation of a custom layer that aggregates this ArcGIS layer coclass. COM containment of the ILayer interface implementation would be required so that the Draw method could be overridden.
All layers must implement ILayer. For ArcMap to save a custom layer, the interface IPersistStream must be implemented. (Visual Basic developers need to implement IPersistVariant instead.) You may choose what custom layer properties to persist in addition to the ILayer member properties such as the minimum and maximum scales, the name of the layer and its visible state. For a layer to be included in the ArcMap table of contents window, it must implement the ILegendInfo interface. The implementation of the interfaces ILayer, IGeoDataset, IPersistStream and ILegendInfo will provide a basic level of integration with the ArcGIS framework.
To help you create a typical custom layer, an example is presented of a SimplePointLayer, which inherits from the Layer abstract class and also implements certain other typical layer interfaces. To keep the example simple enough to follow and understand, not all the numerous possible interfaces are implemented in the example.
See Also Creating Cartography and Simple Point Layer Example.