ArcGIS SDK  

Extending ArcObjects

About Map Grids

In this section:

  1. Creating a subtype of MapGrid
  2. Design issues for a custom grid coclass

Creating a subtype of MapGrid

By reviewing the ArcMap object model diagram, you can see that all the standard grid coclasses available in ArcGISCustomOverlayGrid, Graticule, IndexGrid, and MeasuredGridare subtypes of the MapGrid abstract class.

Looking at the MapGrid abstract class, you can see a custom map grid must implement IMapGrid. You also need to implement IClone and either IPersist and IPersistStream or IPersistVariant, (depending on your development environment), as grids must be clonable and persistable.

The existing map grids also implement IGraphicsComposite. This interface can be used programmatically to access the graphic elements that compose the displayed map grid. You will also implement IGraphicsComposite.


The MapGrid abstract class represents a grid of reference points or lines over a Map.
Refer to this abstract class as the starting point for any custom map grid class.


Design issues for a custom grid coclass

Before you actually start coding your custom grid coclass, ask yourself if the functionality you require is similar to that available in any of the standard ArcGIS grid coclasses.

IIndexGrid and IGraphicsComposite cannot be implemented in VB

IIndexGrid inherits from IMapGrid; therefore, you cannot implement this interface in VB. The VC++ implementation is described. VB programmers could create a basic map grid by implementing IMapGrid and adding their own custom implementation of index-type functionality including user interface.

The IIndexGrid and IGraphicsComposite interfaces cannot be implemented in VB.

Map grid factories

Having reviewed the ArcMap object model and the map grid classes, you may have noticed that the existing map grids are all associated with a factory object.

For more information about MapGridFactories, see the section 'Plugging your custom grid into ArcMap'.

 


Back to top

See Also Clippable Index Grid Example and Creating Cartography.