This document is archived and information here might be outdated.  Recommended version.

IMapContext Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Display > ESRI.ArcGIS.Display > Interfaces > IM > IMapContext Interface
ArcGIS Developer Help

IMapContext Interface

Provides access to the context in which geometric effects and marker placements work.

Product Availability

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


Name Description
Method FromGeographyToMap Converts geographic geometry to map context geometry.
Method FromMapToGeography Converts map context geometry to geographic geometry.
Method FromPoints Converts a distance expressed in points into a geographic distance.
Method Init Initializes the map context.
Method InitFromDisplay Initializes the map context using a display transformation.
Read-only property ReferenceScale The reference scale of the map.
Read-only property SpatialReference The spatial reference of the map.
Method ToPoints Converts a geographic distance into a distance expressed in points.

Classes that implement IMapContext

Classes Description
MapContext The context in which geometric effects and marker placement work.


Spatial Reference and Reference Scale information is used to define a Map Context.

A Feature Representation has to be initiated with a map context to make itself valid.

'How to initialize mapcontext
Dim pMapContext As IMapContext
Dim pGFClass As IGeoDataset
Set pMapContext = New MapContext
Set pGFClass = pFClass
pMapContext.Init pGFClass.SpatialReference, 25000, pGFClass.Extent
Set pRepresentation = pRepClass.GetRepresentation(pFeat, pMapContext)
'where pFeat is reference to a Feature object and pFClass is reference to a FeatureClass object
  'How to Initialize a mapcontext using the DisplayTransformation 
Dim pMC As IMapContext
Set pMC = New MapContext
Dim pDisp As IDisplayTransformation
Dim pAV as IActiveView
Set pAV = pMxDoc.ActiveView
Set pDisp = pAV.ScreenDisplay.DisplayTransformation
pMC.InitFromDisplay pDisp