com.esri.arcgis.carto
Interface ILegend

All Superinterfaces:
IMapSurround, Serializable
All Known Implementing Classes:
Legend

public interface ILegend
extends IMapSurround, Serializable

Provides access to members that control a legend.

Superseded By

ILegend2

Remarks

Use this interface to modify a legend and access its subparts.

A legend is mostly a collection of legend items, one for each layer of the map. See the ILegendItem documentation for information about these. ILegend provides access to and manages the legend’s items with the Item and ItemCount properties as well as the AddItem, InsertItem, RemoveItem and ClearItems methods.

The format of the legend is managed by the LegendFormat object. The Format properties gives access to this object through the ILegendFormat interface. ILegend also manages a few of the legend properties such as the Title . When changing the properties of an existing legend, you must call Refresh to have the changes reflected in the layout.

Finally the AutoAdd, AutoReorder and AutoVisibility properties are used to synchronize the aspect and ordering of the legend with the TOC. The default value for this property is True.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Method Summary
 void addItem(ILegendItem item)
          Adds a new item to the legend (to the end of the list).
 void clearItems()
          Removes all items from the legend.
 ILegendFormat getFormat()
          The formatting options for the legend (can be stored in the style gallery).
 ILegendItem getItem(int index)
          The specified item from the legend.
 int getItemCount()
          Number of items in the legend.
 String getTitle()
          Title.
 void insertItem(int index, ILegendItem item)
          Inserts a new item into the legend (at the location specified by index).
 boolean isAutoAdd()
          Indicates if a new item should be added when a new layer is added to the map.
 boolean isAutoReorder()
          Indicates if the legend items should be kept in the same order as the layers.
 boolean isAutoVisibility()
          Indicates if items should be shown only when associated layers are visible.
 boolean isFlowRight()
          Reserved for future use.
 void removeItem(int index)
          Removes the specified item from the legend.
 void setAutoAdd(boolean autoAdd)
          Indicates if a new item should be added when a new layer is added to the map.
 void setAutoReorder(boolean autoReorder)
          Indicates if the legend items should be kept in the same order as the layers.
 void setAutoVisibility(boolean autoVisibility)
          Indicates if items should be shown only when associated layers are visible.
 void setFlowRight(boolean flag)
          Reserved for future use.
 void setFormatByRef(ILegendFormat legendFormat)
          The formatting options for the legend (can be stored in the style gallery).
 void setTitle(String title)
          Title.
 
Methods inherited from interface com.esri.arcgis.carto.IMapSurround
delayEvents, draw, fitToBounds, getIcon, getMap, getName, queryBounds, refresh, setMapByRef, setName
 

Method Detail

getFormat

ILegendFormat getFormat()
                        throws IOException,
                               AutomationException
The formatting options for the legend (can be stored in the style gallery).

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
A reference to a com.esri.arcgis.carto.ILegendFormat
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setFormatByRef

void setFormatByRef(ILegendFormat legendFormat)
                    throws IOException,
                           AutomationException
The formatting options for the legend (can be stored in the style gallery).

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
legendFormat - A reference to a com.esri.arcgis.carto.ILegendFormat (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getTitle

String getTitle()
                throws IOException,
                       AutomationException
Title.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The title
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setTitle

void setTitle(String title)
              throws IOException,
                     AutomationException
Title.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
title - The title (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isAutoAdd

boolean isAutoAdd()
                  throws IOException,
                         AutomationException
Indicates if a new item should be added when a new layer is added to the map.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The autoAdd
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setAutoAdd

void setAutoAdd(boolean autoAdd)
                throws IOException,
                       AutomationException
Indicates if a new item should be added when a new layer is added to the map.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
autoAdd - The autoAdd (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isAutoReorder

boolean isAutoReorder()
                      throws IOException,
                             AutomationException
Indicates if the legend items should be kept in the same order as the layers.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The autoReorder
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setAutoReorder

void setAutoReorder(boolean autoReorder)
                    throws IOException,
                           AutomationException
Indicates if the legend items should be kept in the same order as the layers.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
autoReorder - The autoReorder (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isAutoVisibility

boolean isAutoVisibility()
                         throws IOException,
                                AutomationException
Indicates if items should be shown only when associated layers are visible.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The autoVisibility
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setAutoVisibility

void setAutoVisibility(boolean autoVisibility)
                       throws IOException,
                              AutomationException
Indicates if items should be shown only when associated layers are visible.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
autoVisibility - The autoVisibility (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isFlowRight

boolean isFlowRight()
                    throws IOException,
                           AutomationException
Reserved for future use.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The flag
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setFlowRight

void setFlowRight(boolean flag)
                  throws IOException,
                         AutomationException
Reserved for future use.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
flag - The flag (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getItemCount

int getItemCount()
                 throws IOException,
                        AutomationException
Number of items in the legend.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Returns:
The numItems
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getItem

ILegendItem getItem(int index)
                    throws IOException,
                           AutomationException
The specified item from the legend.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Parameters:
index - The index (in)
Returns:
A reference to a com.esri.arcgis.carto.ILegendItem
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addItem

void addItem(ILegendItem item)
             throws IOException,
                    AutomationException
Adds a new item to the legend (to the end of the list).

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
item - A reference to a com.esri.arcgis.carto.ILegendItem (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

insertItem

void insertItem(int index,
                ILegendItem item)
                throws IOException,
                       AutomationException
Inserts a new item into the legend (at the location specified by index).

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
index - The index (in)
item - A reference to a com.esri.arcgis.carto.ILegendItem (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeItem

void removeItem(int index)
                throws IOException,
                       AutomationException
Removes the specified item from the legend.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Parameters:
index - The index (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

clearItems

void clearItems()
                throws IOException,
                       AutomationException
Removes all items from the legend.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.