IMap interface of ArcEngine
Use the IMap interface to display data from various data sources.
IMap interface member
ActiveGraphicsLayer: Specifies an active graphic layer. If not, a basic memory graphics layer is created.
AddLayer: add a single layer to the map.
AddLayers: add multiple layers to the map.
AddMapSurround: Add map surround to the map.
AnnotationEngine: The annotation (TAG) engine used by the map.
AreaOfInterest: the area of interest in the map.
Barriers: List of barriers and label weight.
BasicGraphicsLayer: basic graphics layer.
ClearLayers: removes all layers from the map.
ClearMapSurrounds: removes all side notes from the map.
ClearSelection: clear map selection.
ClipBorder: an optional boundary around ClipGeometry.
ClipGeometry: A cut shape in the map layer.
ComputeDistance: calculates the distance between two points on the map and returns the result.
CreateMapSurround: Creates and initializes a map surround. Specify an optional style from the style set.
DelayDrawing: Pause painting.
DelayEvents: reduces the number of notifications by batch.
DeletLayer: deletes a layer from the map.
DeleteMapSurround: deletes map surround from a map.
Description: Map Description.
DistanceUnits: the distance unit of the map.
Expanded: Specifies whether a map can expand.
FeatureSelection: The selected element in the map.
GetPageSize: Get the page size of the map.
IsFramed: Specifies whether a map is drawn within a frame rather than in the entire window.
Layer: layer with a given serial number.
LayerCount: number of layers in a map.
Layers: map Layers of the uid type. If recursive is true, layers is returned as layers.
MapScale: a digital map scale.
MapSurroundCount: Number of Map-related side notes.
MapUnits: Map unit.
MoveLayer: Move a layer to another location.
Name: Map Name.
RecalcFullExtent: recalculates the full range.
ReferenceScale: The reference scale of a fractional map.
SelectByShape: select a element in the map with a geometric shape and an optional environment.
SelectFeature: select a factor.
SelectionCount: number of selected elements.
SetPageSize: Set the page size of the map (optional.
SpatialReference: spatial reference of a map.
SpatialReferenceLocked: Specifies whether to allow space change reference.
UseSymbolLevels: Specifies whether to use symbol levels to draw a map.
AnnotationEngine: The annotion (label) engine used by map.
AreaOfInterest: the area of interest in the map.
Class Map implementation interface IMap.
Each Map file contains at least one Map object. However, only one Map can obtain the focus. This Map is called the focus map ). You can use IMxDocument to access all map objects in the document. IMxDocument: FocusMap returns a map reference with the current focus. IMxDocument: Maps returns a reference (IMaps) pointing to all map objects ). A Map document can contain any number of Map objects-only focus maps are displayed in the data view.
Map object, manage a series of layer objects. Each layer has a space reference. A spatial reference defines a resolution (1/precision) and a coordinate system. The map coordinate system is automatically set to the coordinate system of the first layer, and the resolution is calculated based on the range of all layers.
Several common attributes and methods:
IMap. AddLayer Method (add layer to map)
[Visual Basic. NET] Public Sub AddLayer (ByVal Layer as ILayer)
[C #] public void AddLayer (Ilayer Layer)
The AddLayer method adds a layer to the map. Use the LayerCount attribute to obtain the total number of layers in the map. If the map does not have a coordinate system, AddLayer automatically sets the SpatialReference attribute of the map. When the map space reference attribute is set, the MapUnits and DistanceUnits attributes of the map are also set. AddLayer also sets the layer Space reference.
IMap. DeleteLayer Method (delete layer from Map)
[Visual Basic. NET] Public Sub DeleteLayer (ByVal Layer as ILayer)
[C #] public void DeleteLayer (ILayer Layer)
If a layer is selected in the TOC window (IMxDocument: SelectedLayer), you can pass it to the DeleteLayer method. When you delete a layer that references a feature class, such as FeatureLayer, execute IDataLayer2: Disconnect to clearly reference the feature class.
IMap. FeatureSelection Property (IMap. FeatureSelection attribute)
[Visual Basic. NET] Public Property FeatureSelection as Iselection
[C #] public ISelection FeatureSelection {get; set ;}
ArcMap has two different selection sets: feature selection and element selection. Two different objects indicate these choices and all implement the ISelection interface. The feature selection object also implements the IEnumFeature interface, and the element selection also implements IEnumElement. The ISelection interface is used for clipboard operations, and the IEnum interface is used for items in the set.
When you access FeatureSelection from IMap, an ISelection is returned. When you use the IActiveView: Selection method, you can select either an element or an element, depending on which one is active-only one is active at a time. Use element selection to make sure that the selection is correct.
IEnumFeature works on all element layers. Each FeatureLayer has an ISelectionSet and IEnumFeature. IEnumFeature works on all featurelayers and cannot be used to traverse the elements of a layer.
Note that only the shape field can be selected. The IMap: FeatureSelection attribute is used to draw the map selection, rather than the access element attribute. Pay attention to shapefiles, coverage, and geodatabases. If you want to traverse the map and select to perform an operation, you 'd better access the selection set of each layer rather than the entire map.
IMap. Layer Property (IMap. Layer attribute)
[Visual Basic. NET] Public Function get_Layer (ByVal Index As Integer) As ILayer
[C #] Public ILayer get_Layer (int Index );
Maps is composed of countless layers in various data sources. Use the Layer attribute to access a specific Layer of the map. The layer set starts from 0. Use the Layer attribute and the LayerCount attribute to traverse each Layer in the map.
The Layer attribute returns an ILayer reference. If (player is IFeatureLayer. For example, do not think that all layers in the map are FeatureLayers. The layers that implement the ILayer and IDataLayer interfaces are valid layers.
Each map also has a basic graphics layer, which is not included in the layer set returned by this attribute. You can use the BasicGraphicsLayer attribute to obtain references to this layer.
IMap. SelectByShape Method
Selecting elements through ry and selection environment (optional)
[Visual Basic. NET] Public Sub SelectByShape (ByVal Shape As IGeometry, ByVal env As ISelectionEnviroment, Byval justOne as Boolean)
[C #] public void SelectByShape (IGeometry Shape, ISelectionEnvironment env, bool justOne );
SelectByShape searches all ifeaturelayers for elements that intersect the input image. This layer can be searched only when the IFeatureLayer: Selectable attribute is set to TRUE.
ISelectionEnvironment determines the selection result. For example, create a new selection or add elements to an existing selection set. Use IMxApplication: SelectionEnviroment to use the application's selection environment.
The justOne variable controls whether to stop searching after an element is found.
After the search is complete, call IActiveViewEvents: SelectionChanged. The notification selection has changed.
Reprinted from http://www.cnblogs.com/hehewoya/archive/2009/11/29/1613250.html