|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IMapContext
Provides access to the context in which geometric effects and marker placements 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
Method Summary | |
---|---|
IGeometry |
fromGeographyToMap(IGeometry ingeom)
Converts geographic geometry to map context geometry. |
IGeometry |
fromMapToGeography(IGeometry ingeom)
Converts map context geometry to geographic geometry. |
double |
fromPoints(double ptDist)
Converts a distance expressed in points into a geographic distance. |
double |
getReferenceScale()
The reference scale of the map. |
ISpatialReference |
getSpatialReference()
The spatial reference of the map. |
void |
init(ISpatialReference mapProj,
double mapRefScale,
IEnvelope mapExtent)
Initializes the map context. |
void |
initFromDisplay(IDisplayTransformation displayTransform)
Initializes the map context using a display transformation. |
double |
toPoints(double mapDist)
Converts a geographic distance into a distance expressed in points. |
Method Detail |
---|
void initFromDisplay(IDisplayTransformation displayTransform) throws IOException, AutomationException
Use this method when you create a reference to a new MapContext object to initialize the mapcontext using a DisplayTransformation that exists. If a reference to a DisplayTransformation does not exist, then use IMapContext::Init method to initialize the map context. It is important to initialize the map context as this will help in getting correct context for displaying and drawing geometric effects and marker placements.
Use the following code snippet to initialize a MapContext using display settings from a map document
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap
'set the MapContext object from current display settings
Dim pMapContext As IMapContext
Dim pMxApp As IMxApplication
Set pMxApp = Application 'QI
Set pMapContext = New MapContext
pMapContext.InitFromDisplay pMxApp.Display.DisplayTransformation
displayTransform
- A reference to a com.esri.arcgis.display.IDisplayTransformation (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.void init(ISpatialReference mapProj, double mapRefScale, IEnvelope mapExtent) throws IOException, AutomationException
Use this method when you create a reference to a new MapContext object to initialize the mapcontext. If a reference to a DisplayTransformation exists, then use IMapContext::InitFromDisplay method to initialize the map context. It is important to initialize the map context as this will help in getting correct context for displaying and drawing geometric effects and marker placements.
'initialize new mapcontext using a feature class's spatial reference and extent
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
mapProj
- A reference to a com.esri.arcgis.geometry.ISpatialReference (in)mapRefScale
- The mapRefScale (in)mapExtent
- A reference to a com.esri.arcgis.geometry.IEnvelope (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IGeometry fromGeographyToMap(IGeometry ingeom) throws IOException, AutomationException
ingeom
- A reference to a com.esri.arcgis.geometry.IGeometry (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IGeometry fromMapToGeography(IGeometry ingeom) throws IOException, AutomationException
ingeom
- A reference to a com.esri.arcgis.geometry.IGeometry (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.double getReferenceScale() throws IOException, AutomationException
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.ISpatialReference getSpatialReference() throws IOException, AutomationException
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.double fromPoints(double ptDist) throws IOException, AutomationException
ptDist
- The ptDist (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.double toPoints(double mapDist) throws IOException, AutomationException
mapDist
- The mapDist (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |