com.esri.arcgis.controls
Class IMapControl2Proxy

java.lang.Object
  extended by com.esri.arcgis.interop.Dispatch
      extended by com.esri.arcgis.controls.IMapControl2Proxy
All Implemented Interfaces:
IMapControl2, Externalizable, Serializable
Direct Known Subclasses:
IMapControl3Proxy

public class IMapControl2Proxy
extends com.esri.arcgis.interop.Dispatch
implements IMapControl2, Serializable

Provides access to members that control the MapControl.

Superseded By

IMapControl4

Description

The IMapControl2 interface is a starting point for any tasks related to the MapControl, such as setting general appearance, setting map and display properties, adding and managing data layers and map documents, and drawing and tracking shapes.

Product Availability

Available with ArcGIS Engine.

See Also:
Serialized Form

Field Summary
 boolean noncastable
           
 
Fields inherited from class com.esri.arcgis.interop.Dispatch
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef
 
Constructor Summary
  IMapControl2Proxy()
           
  IMapControl2Proxy(Object obj)
           
protected IMapControl2Proxy(Object obj, String iid)
           
 
Method Summary
 void aboutBox()
          Displays a dialog of information about the MapControl.
 void addLayer(ILayer layer, int toIndex)
          Adds a layer to the Map's collection of layers at the specified index position.
 void addLayerFromFile(String lyrPath, int toIndex)
          Loads a layer file and adds it to the Map's collection of layers at the specified index position.
 void addListener(String iidStr, Object theListener, Object theSource)
           
 void addShapeFile(String path, String fileName)
          Adds a shapefile as a layer to the Map.
 void centerAt(IPoint centerPoint)
          Moves the center of the MapControl to the specified location.
 boolean checkMxFile(String fileName)
          Checks the specified filename to see if it is a map document that can be loaded into the MapControl.
 void clearLayers()
          Removes all layers from the Map.
 void deleteLayer(int index)
          Removes a Layer from the Map's collection of layers at the specified index position.
 void drawShape(IGeometry shape, Object symbol)
          Draws a geometry shape on the MapControl.
 void drawText(IGeometry pGeometry, String text, Object pSymbol)
          Draws text along the supplied geometry.
 boolean esri_isEnabled()
          Indicates whether the MapControl can respond to user generated events.
 void esri_setEnabled(boolean enabled)
          Indicates whether the MapControl can respond to user generated events.
 void flashShape(IGeometry pShape, int nFlashes, int flashInterval, Object symbol)
          Flashes a shape on the MapControl, duration is in milliseconds.
 void fromMapPoint(IPoint pt, int[] x, int[] y)
          Converts a point on the Map (in map units) to device co-ordinates (typically pixels).
 IActiveView getActiveView()
          The active view of the Map contained by the MapControl.
 int getAppearance()
          The appearance of the MapControl.
 int getBackColor()
          Background color of the MapControl.
 int getBorderStyle()
          The border style of the MapControl.
 ITool getCurrentTool()
          Current active tool for the MapControl.
 IEnvelope getExtent()
          Current extent of the Map in map units.
 IEnvelope getFullExtent()
          Rectangular shape that encloses all features of all layers in the Map.
 int getHWnd()
          Handle to the window associated with the MapControl.
 ILayer getLayer(int index)
          Layer at the supplied index.
 int getLayerCount()
          Number of layers in the Map.
 IMap getMap()
          The Map contained by the MapControl.
 double getMapScale()
          Scale of the map as a representative fraction.
 int getMapUnits()
          The geographical units of the map.
 Picture getMouseIcon()
          Custom mouse icon used if MousePointer is 99.
 int getMousePointer()
          The mouse pointer displayed over the MapControl.
 double getReferenceScale()
          Reference scale of the Map as a representative fraction.
 double getRotation()
          Determines how many degrees the map display is rotated.
 ISpatialReference getSpatialReference()
          Spatial reference of the Map.
 ITrackCancel getTrackCancel()
          The object used by the MapControl to check if drawing has been aborted.
 boolean isOleDropEnabled()
          Indicates if the MapControl will fire events when data is dragged over the control's window.
 boolean isShowScrollbars()
          Indicates whether or not the Map's scrollbars are visible.
 void loadMxFile(String mxPath, Object mapNameOrIndex, Object password)
          Loads the specified Map from the map document into the MapControl.
 void moveLayerTo(int fromIndex, int toIndex)
          Moves a layer within the Map's collection from its current index position to a new index position.
 void pan()
          Tracks the mouse while panning the MapControl.
 IArray readMxMaps(String fileName, Object password)
          Opens a map document specified by the supplied filename and reads the maps into an array object.
 void refresh(int phase, Object layerOrElement, Object envelope)
          Redraws the Map, optionally just redraw specified phases or envelope.
 void removeListener(String iidStr, Object theListener)
           
 void setAppearance(int appearance)
          The appearance of the MapControl.
 void setBackColor(int backColor)
          Background color of the MapControl.
 void setBorderStyle(int borderStyle)
          The border style of the MapControl.
 void setCurrentToolByRef(ITool pTool)
          Current active tool for the MapControl.
 void setExtent(IEnvelope extent)
          Current extent of the Map in map units.
 void setFullExtent(IEnvelope fullExtent)
          Rectangular shape that encloses all features of all layers in the Map.
 void setMapByRef(IMap pMap)
          The Map contained by the MapControl.
 void setMapScale(double mapScale)
          Scale of the map as a representative fraction.
 void setMapUnits(int units)
          The geographical units of the map.
 void setMouseIconByRef(Picture mouseIcon)
          Custom mouse icon used if MousePointer is 99.
 void setMousePointer(int mousePointer)
          The mouse pointer displayed over the MapControl.
 void setOleDropEnabled(boolean enabled)
          Indicates if the MapControl will fire events when data is dragged over the control's window.
 void setReferenceScale(double referenceScale)
          Reference scale of the Map as a representative fraction.
 void setRotation(double rotation)
          Determines how many degrees the map display is rotated.
 void setShowScrollbars(boolean showScrollbars)
          Indicates whether or not the Map's scrollbars are visible.
 void setSpatialReferenceByRef(ISpatialReference spRef)
          Spatial reference of the Map.
 void setTrackCancelByRef(ITrackCancel ppTrackCancel)
          The object used by the MapControl to check if drawing has been aborted.
 void setVisibleRegion(IGeometry rhs1)
          The geometry specifying the visible region of the Map.
 IPoint toMapPoint(int x, int y)
          Converts a point in device co-ordinates (typically pixels) to a point on the Map (in map units).
 IGeometry trackCircle()
          Rubber-bands a circle on the MapControl.
 IGeometry trackLine()
          Rubber-bands a polyline on the MapControl.
 IGeometry trackPolygon()
          Rubber-bands a polygon on the MapControl.
 IEnvelope trackRectangle()
          Rubber-bands a rectangle on the MapControl.
 
Methods inherited from class com.esri.arcgis.interop.Dispatch
bindUsingMoniker, constructVtblPosTable, convertToNative, cookieForListener, createDispatch, createObjrefMonikerDisplayName, equals, getActiveObject, getActiveObject, getDefaultProperty, getDispatchIdOfName, getLastErrorCode, getMtsObjectContext, getObjRef, getPropertyByName, getPropertyByName, getVtblPos, hashCode, initDispatch, invoke, invokeMethodByName, invokeMethodByName, invokeMethodByName, invokePropertyGetByName, invokePropertyPutByName, invokePropertyPutByRefByName, isNativeMode, isObjRef, optimizedVtblInvoke, queryInterface, readExternal, release, setNativeMode, setPropertyByName, toString, vtblInvoke, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noncastable

public boolean noncastable
Constructor Detail

IMapControl2Proxy

public IMapControl2Proxy()

IMapControl2Proxy

public IMapControl2Proxy(Object obj)
                  throws IOException
Throws:
IOException

IMapControl2Proxy

protected IMapControl2Proxy(Object obj,
                            String iid)
                     throws IOException
Throws:
IOException
Method Detail

addListener

public void addListener(String iidStr,
                        Object theListener,
                        Object theSource)
                 throws IOException
Overrides:
addListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

removeListener

public void removeListener(String iidStr,
                           Object theListener)
                    throws IOException
Overrides:
removeListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

getHWnd

public int getHWnd()
            throws IOException,
                   AutomationException
Handle to the window associated with the MapControl.

Description

The operating environment identifies each window, form and control in an application by assigning it a handle, or hWnd. Many ArcObjects methods and Windows API calls require the hWnd as an argument.

Product Availability

Available with ArcGIS Engine.

Specified by:
getHWnd in interface IMapControl2
Returns:
The hWnd
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setBackColor

public void setBackColor(int backColor)
                  throws IOException,
                         AutomationException
Background color of the MapControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setBackColor in interface IMapControl2
Parameters:
backColor - The backColor (A COM typedef) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBackColor

public int getBackColor()
                 throws IOException,
                        AutomationException
Background color of the MapControl.

Description

Returns or sets the Background Color of the MapControl. Internally the OLE_Color is stored as a long integer where the value may be calculated for any RGB combination as follows:

OLE_Color = (Red) + (Green * 256) + (Blue * 256 * 256)

Where Red, Green and Blue are Long Integers within the range 0 - 255.

Product Availability

Available with ArcGIS Engine.

Specified by:
getBackColor in interface IMapControl2
Returns:
The backColor (A COM typedef)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setMousePointer

public void setMousePointer(int mousePointer)
                     throws IOException,
                            AutomationException
The mouse pointer displayed over the MapControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMousePointer in interface IMapControl2
Parameters:
mousePointer - A com.esri.arcgis.controls.esriControlsMousePointer constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMousePointer

public int getMousePointer()
                    throws IOException,
                           AutomationException
The mouse pointer displayed over the MapControl.

Description

Use this property when you want to indicate changes in functionality as the mouse pointer passes over the MapControl. The esriPointerArrowHourglass setting (11) is useful for indicating that the user should wait for a process or operation to finish.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMousePointer in interface IMapControl2
Returns:
A com.esri.arcgis.controls.esriControlsMousePointer constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getMouseIcon(), IMapControl3, IMapControl4

setMouseIconByRef

public void setMouseIconByRef(Picture mouseIcon)
                       throws IOException,
                              AutomationException
Custom mouse icon used if MousePointer is 99.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMouseIconByRef in interface IMapControl2
Parameters:
mouseIcon - A reference to a com.esri.arcgis.support.ms.stdole.Picture (A com.esri.arcgis.support.ms.stdole.Picture COM typedef) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMouseIcon

public Picture getMouseIcon()
                     throws IOException,
                            AutomationException
Custom mouse icon used if MousePointer is 99.

Description

The MouseIcon property provides a custom icon that is used when the MousePointer property is set to esriPointerArrowHourglass (99).

Remarks

In most development evironments the control's property pages can be used to load either a cursor (.cur) or icon (.ico) file. A cursor contains a custom 'hotspot' location and can be any size. The 'hotspot' location for an icon file defaults to the center of the icon. This property cannot be used to load animated cursor (.ani) files.

To programatically create an object implementing IPictureDisp there is the win32 function OleLoadPicture or helper methods depending on the development environment.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMouseIcon in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.support.ms.stdole.Picture (A com.esri.arcgis.support.ms.stdole.Picture COM typedef)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getMousePointer(), IMapControl3, IMapControl4

setBorderStyle

public void setBorderStyle(int borderStyle)
                    throws IOException,
                           AutomationException
The border style of the MapControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setBorderStyle in interface IMapControl2
Parameters:
borderStyle - A com.esri.arcgis.controls.esriControlsBorderStyle constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getBorderStyle

public int getBorderStyle()
                   throws IOException,
                          AutomationException
The border style of the MapControl.

Description

Returns or sets the border style of a MapControl. By default a border is drawn.

Product Availability

Available with ArcGIS Engine.

Specified by:
getBorderStyle in interface IMapControl2
Returns:
A com.esri.arcgis.controls.esriControlsBorderStyle constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

esri_setEnabled

public void esri_setEnabled(boolean enabled)
                     throws IOException,
                            AutomationException
Indicates whether the MapControl can respond to user generated events.

Product Availability

Available with ArcGIS Engine.

Specified by:
esri_setEnabled in interface IMapControl2
Parameters:
enabled - The enabled (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

esri_isEnabled

public boolean esri_isEnabled()
                       throws IOException,
                              AutomationException
Indicates whether the MapControl can respond to user generated events.

Product Availability

Available with ArcGIS Engine.

Specified by:
esri_isEnabled in interface IMapControl2
Returns:
The enabled
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setAppearance

public void setAppearance(int appearance)
                   throws IOException,
                          AutomationException
The appearance of the MapControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setAppearance in interface IMapControl2
Parameters:
appearance - A com.esri.arcgis.controls.esriControlsAppearance constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getAppearance

public int getAppearance()
                  throws IOException,
                         AutomationException
The appearance of the MapControl.

Description

Returns or sets the paint style of a MapControl to either Flat or 3D. By default the appearance is flat.

Product Availability

Available with ArcGIS Engine.

Specified by:
getAppearance in interface IMapControl2
Returns:
A com.esri.arcgis.controls.esriControlsAppearance constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

aboutBox

public void aboutBox()
              throws IOException,
                     AutomationException
Displays a dialog of information about the MapControl.

Description

The AboutBox method causes a modal dialog box to display on top of the MapControl, containing information about the version and creation date of the MapControl as well as listing relevant legal and copyright information from ESRI.

Product Availability

Available with ArcGIS Engine.

Specified by:
aboutBox in interface IMapControl2
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setMapByRef

public void setMapByRef(IMap pMap)
                 throws IOException,
                        AutomationException
The Map contained by the MapControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMapByRef in interface IMapControl2
Parameters:
pMap - A reference to a com.esri.arcgis.carto.IMap (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMap

public IMap getMap()
            throws IOException,
                   AutomationException
The Map contained by the MapControl.

Description

This is the Map CoClass contained within the MapControl. If the Map is replaced the IMapControlEvents2::OnMapReplaced event is triggered.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMap in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.carto.IMap
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getMapScale(), IMapControl2.getReferenceScale(), IMapControl2.getSpatialReference(), IMapControl2.getMapUnits(), IMapControl3, IMapControl4

getActiveView

public IActiveView getActiveView()
                          throws IOException,
                                 AutomationException
The active view of the Map contained by the MapControl.

Description

This is the ActiveView on the Map contained within the MapControl.

Product Availability

Available with ArcGIS Engine.

Specified by:
getActiveView in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.carto.IActiveView
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLayerCount

public int getLayerCount()
                  throws IOException,
                         AutomationException
Number of layers in the Map.

Description

Returns the number of layers in the Map that implement IDataLayer. This does not include ICompositeLayer objects.

Product Availability

Available with ArcGIS Engine.

Specified by:
getLayerCount in interface IMapControl2
Returns:
The numLayers
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.clearLayers(), IMapControl2.moveLayerTo(int, int), IMapControl2.getLayer(int), IMapControl3, IMapControl4, IMapControl2.deleteLayer(int)

getLayer

public ILayer getLayer(int index)
                throws IOException,
                       AutomationException
Layer at the supplied index.

Product Availability

Available with ArcGIS Engine.

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

getExtent

public IEnvelope getExtent()
                    throws IOException,
                           AutomationException
Current extent of the Map in map units.

Description

Returns or sets a new envelope which is represents the visible extent of the Map. Setting the Extent property will automatically cause the MapControl to refresh its display.

Product Availability

Available with ArcGIS Engine.

Specified by:
getExtent in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.geometry.IEnvelope
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setExtent

public void setExtent(IEnvelope extent)
               throws IOException,
                      AutomationException
Current extent of the Map in map units.

Product Availability

Available with ArcGIS Engine.

Specified by:
setExtent in interface IMapControl2
Parameters:
extent - A reference to a com.esri.arcgis.geometry.IEnvelope (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getFullExtent

public IEnvelope getFullExtent()
                        throws IOException,
                               AutomationException
Rectangular shape that encloses all features of all layers in the Map.

Description

Returns or sets a new envelope object representing the full extent of all the data layers in the Map. The FullExtent property is a shortcut to IDisplayTransformation::Bounds. Setting the FullExtent triggers the IMapControlEvents2::OnFullExtentUpdated event.

Product Availability

Available with ArcGIS Engine.

Specified by:
getFullExtent in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.geometry.IEnvelope
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setFullExtent

public void setFullExtent(IEnvelope fullExtent)
                   throws IOException,
                          AutomationException
Rectangular shape that encloses all features of all layers in the Map.

Product Availability

Available with ArcGIS Engine.

Specified by:
setFullExtent in interface IMapControl2
Parameters:
fullExtent - A reference to a com.esri.arcgis.geometry.IEnvelope (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isShowScrollbars

public boolean isShowScrollbars()
                         throws IOException,
                                AutomationException
Indicates whether or not the Map's scrollbars are visible.

Description

If ShowScrollbars is true, the MapControl's internal scrollbars will appear when the Extent property is less than the FullExtent property.

Product Availability

Available with ArcGIS Engine.

Specified by:
isShowScrollbars in interface IMapControl2
Returns:
The showScrollbars
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setShowScrollbars

public void setShowScrollbars(boolean showScrollbars)
                       throws IOException,
                              AutomationException
Indicates whether or not the Map's scrollbars are visible.

Product Availability

Available with ArcGIS Engine.

Specified by:
setShowScrollbars in interface IMapControl2
Parameters:
showScrollbars - The showScrollbars (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setVisibleRegion

public void setVisibleRegion(IGeometry rhs1)
                      throws IOException,
                             AutomationException
The geometry specifying the visible region of the Map.

Description

Sets the MapControl's window to be the shape of the supplied geometry (in map units). Only the parts of the MapControl's layers that fall within the geometry specified will be seen.

Product Availability

Available with ArcGIS Engine.

Specified by:
setVisibleRegion in interface IMapControl2
Parameters:
rhs1 - A reference to a com.esri.arcgis.geometry.IGeometry (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getSpatialReference

public ISpatialReference getSpatialReference()
                                      throws IOException,
                                             AutomationException
Spatial reference of the Map.

Description

This property is a shortcut to IMap::SpatialReference. The Map's SpatialReference will be set automatically to match the SpatialReference of the first Layer added to its layer collection. If the first Layer added has no SpatialReference defined, the coordinates in the Layer will be analyzed. If the coordinates range from 0 - 180, the MapControl assumes the layers data is geographic (i.e. contains unprojected coordinates in latitude and longitude) and the SpatialReference will appear as "GCS_Assumed_Geographic_1". If the MapControl cannot determine that the data source is geographic, the current SpatialReference will be "Unknown". The SpatialReference is also "Unknown" if the MapControl contains no data.

Product Availability

Available with ArcGIS Engine.

Specified by:
getSpatialReference in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.geometry.ISpatialReference
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getMapScale(), IMapControl2.getReferenceScale(), IMapControl2.getMapUnits(), IMapControl2.getMap(), IMapControl3, IMapControl4

setSpatialReferenceByRef

public void setSpatialReferenceByRef(ISpatialReference spRef)
                              throws IOException,
                                     AutomationException
Spatial reference of the Map.

Product Availability

Available with ArcGIS Engine.

Specified by:
setSpatialReferenceByRef in interface IMapControl2
Parameters:
spRef - A reference to a com.esri.arcgis.geometry.ISpatialReference (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getReferenceScale

public double getReferenceScale()
                         throws IOException,
                                AutomationException
Reference scale of the Map as a representative fraction.

Description

This property is a shortcut to IMap::ReferenceScale and is the scale to which all symbol and text sizes used in the Map will be made relative.

Remarks

A ReferenceScale set to 0 indicates that no ReferenceScale is set and is the default. When no ReferenceScale is set, the size of any symbols or text on the Map remains the same irrespective of MapScale. When a reference scale is set, the size of any symbols or text on the map changes as the MapScale changes. For example, text labels will get larger if you zoom in to a scale larger than the ReferenceScale and smaller if you zoom out to a scale smaller than the ReferenceScale.

Product Availability

Available with ArcGIS Engine.

Specified by:
getReferenceScale in interface IMapControl2
Returns:
The referenceScale
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getMapScale(), IMapControl2.getSpatialReference(), IMapControl2.getMapUnits(), IMapControl2.getMap(), IMapControl3, IMapControl4

setReferenceScale

public void setReferenceScale(double referenceScale)
                       throws IOException,
                              AutomationException
Reference scale of the Map as a representative fraction.

Product Availability

Available with ArcGIS Engine.

Specified by:
setReferenceScale in interface IMapControl2
Parameters:
referenceScale - The referenceScale (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMapScale

public double getMapScale()
                   throws IOException,
                          AutomationException
Scale of the map as a representative fraction.

Description

This property is a shortcut to IMap::MapScale which itself is a shortcut to IDisplayTransformation::ScaleRatio.

Remarks

MapScale is the relationship between the dimensions of features on a map and the geographic objects they represent on the earth, commonly expressed as a fraction or a ratio. A MapScale of 1/100,000 or 1:100,000 means that one unit of measure on the map equals 100,000 of the same units on the earth. Some common scales are as follows:

Product Availability

Available with ArcGIS Engine.

Specified by:
getMapScale in interface IMapControl2
Returns:
The mapScale
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getReferenceScale(), IMapControl2.getSpatialReference(), IMapControl2.getMapUnits(), IMapControl2.getMap(), IMapControl3, IMapControl4

setMapScale

public void setMapScale(double mapScale)
                 throws IOException,
                        AutomationException
Scale of the map as a representative fraction.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMapScale in interface IMapControl2
Parameters:
mapScale - The mapScale (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCurrentTool

public ITool getCurrentTool()
                     throws IOException,
                            AutomationException
Current active tool for the MapControl. Set to nothing to clear the tool.

Description

The CurrentTool is the Tool used to interact will the MapControl's display. Always check if a tool is enabled before setting it to the CurrentTool property, otherwise a user will be able to use a tool that is actually disabled.

Remarks

When the CurrentTool is set the following events occur:

  1. The ITool::Deactivate event is triggered on the 'old' CurrentTool if one was set. If this event returns false a trappable error ocurrs. If this event returns true the 'old' CurrentTool is removed and replaced.
  2. The ICommand::OnClick event is triggered on the 'new' CurrentTool and its cursor is picked up.

Within an ITool implementation it is recommended that the ITool::Deactivate event returns true. This allows a 'new' CurrentTool to be set, and allows the release of the CurrentTool when an application is shutting down.

Product Availability

Available with ArcGIS Engine.

Specified by:
getCurrentTool in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.systemUI.ITool
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setCurrentToolByRef

public void setCurrentToolByRef(ITool pTool)
                         throws IOException,
                                AutomationException
Current active tool for the MapControl. Set to nothing to clear the tool.

Remarks

Always check if a tool is enabled before setting it to the CurrentTool property, otherwise a user will be able to use a tool that is actually disabled.


If pCommand.Enabled = True Then

  Set PageLayoutControl1.CurrentTool = pCommand

End If

When the CurrentTool is set the following events occur:

  1. The ITool:: Deactivate event is triggered on the 'old' CurrentTool if one was set. If this event returns false a trappable error ocurrs. If this event returns true the 'old' CurrentTool is removed and replaced.
  2. The ICommand:: OnClick event is triggered on the 'new' CurrentTool and its cursor is picked up.

Note that if the CurrentTool is set to Nothing, the ITool::Deactivate event is not triggered on the 'old' CurrentTool, instead it is forcibly removed. The same behaviour occurs if the PageLayoutControl is killed.


Set PageLayoutControl1.CurrentTool = Nothing

Product Availability

Available with ArcGIS Engine.

Specified by:
setCurrentToolByRef in interface IMapControl2
Parameters:
pTool - A reference to a com.esri.arcgis.systemUI.ITool (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

addLayer

public void addLayer(ILayer layer,
                     int toIndex)
              throws IOException,
                     AutomationException
Adds a layer to the Map's collection of layers at the specified index position.

Description

When a Layer is added to the MapControl's layer collection and no index is specified, it is added to the beginning or top of the collection with an index of 0. The numeric index of any other layers in the layer collection increments by one.

When a Layer is added and an index is specified, the numeric index of any other layers in the layer collection will increment by one, except for those layers with an index less than the specified index. The index of these layers will remain the same.

Remarks

The Layer at the beginning or top of the collection with an index of 0 will be drawn last, whilst the Layer at the bottom of the collection will be drawn first.

Use the MoveLayerTo method to change the position of a Layer within the layer collection.

Product Availability

Available with ArcGIS Engine.

Specified by:
addLayer in interface IMapControl2
Parameters:
layer - A reference to a com.esri.arcgis.carto.ILayer (in)
toIndex - The toIndex (in, optional, pass 0 if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.addLayerFromFile(String, int), IMapControl2.addShapeFile(String, String), IMapControl3, IMapControl4

addLayerFromFile

public void addLayerFromFile(String lyrPath,
                             int toIndex)
                      throws IOException,
                             AutomationException
Loads a layer file and adds it to the Map's collection of layers at the specified index position.

Description

When a layer file is added to the MapControl's layer collection and no index is specified, it is added to the beginning or top of the collection with an index of 0. The numeric index of any other layers in the layer collection increments by one.

When a layer file is added and an index is specified, the numeric index of any other layers in the layer collection will increment by one, except for those layers with an index less than the specified index. The index of these layers will remain the same.

Remarks

The Layer at the beginning or top of the collection with an index of 0 will be drawn last, whilst the Layer at the bottom of the collection will be drawn first.

Use the MoveLayerTo method to change the position of a Layer within the layer collection.

Product Availability

Available with ArcGIS Engine.

Specified by:
addLayerFromFile in interface IMapControl2
Parameters:
lyrPath - The lyrPath (in)
toIndex - The toIndex (in, optional, pass 0 if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.addLayer(com.esri.arcgis.carto.ILayer, int), IMapControl2.addShapeFile(String, String), IMapControl3, IMapControl4

clearLayers

public void clearLayers()
                 throws IOException,
                        AutomationException
Removes all layers from the Map.

Description

The method is a shortcut to IMap::ClearLayers and removes all layers from the Map. ClearLayers does not change or reset the map's SpatialReference.

Product Availability

Available with ArcGIS Engine.

Specified by:
clearLayers in interface IMapControl2
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getLayerCount(), IMapControl2.moveLayerTo(int, int), IMapControl2.getLayer(int), IMapControl3, IMapControl4, IMapControl2.deleteLayer(int)

deleteLayer

public void deleteLayer(int index)
                 throws IOException,
                        AutomationException
Removes a Layer from the Map's collection of layers at the specified index position.

Description

This method is a shortcut to IMap::DeleteLayer.

Product Availability

Available with ArcGIS Engine.

Specified by:
deleteLayer in interface IMapControl2
Parameters:
index - The index (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.clearLayers(), IMapControl2.getLayerCount(), IMapControl2.moveLayerTo(int, int), IMapControl2.getLayer(int), IMapControl3, IMapControl4

moveLayerTo

public void moveLayerTo(int fromIndex,
                        int toIndex)
                 throws IOException,
                        AutomationException
Moves a layer within the Map's collection from its current index position to a new index position.

Description

The Layer at the beginning or top of the collection with an index of 0 will be drawn last, whilst the Layer at the bottom of the collection will be drawn first.

Product Availability

Available with ArcGIS Engine.

Specified by:
moveLayerTo in interface IMapControl2
Parameters:
fromIndex - The fromIndex (in)
toIndex - The toIndex (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.clearLayers(), IMapControl2.getLayerCount(), IMapControl2.getLayer(int), IMapControl3, IMapControl4, IMapControl2.deleteLayer(int)

loadMxFile

public void loadMxFile(String mxPath,
                       Object mapNameOrIndex,
                       Object password)
                throws IOException,
                       AutomationException
Loads the specified Map from the map document into the MapControl. The Map can be an index or a name, if it is not supplied the focus map is used.

Description

Loads an map document into the MapControl. The map document can be an ArcMap document, an ArcMap template or an ArcReader document. Use the CheckMxFile method to determine if the specified map document is a valid map document.

Remarks

When LoadMXfile is used the user may be prompted for a password; refer to the tables below to determine when this may occur. Additionally, password prompts may be given if accessing MapDocuments using either the MapControl's PropertyPage, ArcMap or ArcReader; the tables also show in what circumstances this will occur.

Loading Map Documents (*.mxd, *.mxt, *.pmf) which reference IMS Services (with and without security)

Application No Secure Services MXD/ MXT/ PMF files Secure Servcies MXD/ MXT/ PMF files Secure Servcies (password cached) MXD/ MXT files Secure Servcies (password cached) PMF files
MapControl (programmatically) No Prompt Prompt No Prompt Prompt
MapControl (property pages) No Prompt Prompt No Prompt Prompt
ArcMap No Prompt Prompt No Prompt Prompt
ArcReader (PMF files only) No Prompt Prompt N/A No Prompt

* The Connection to the Internet server must have the Save User/ Password setting enabled. This can be set, for example, when using Add Internet Server in the Add Layers Dialog. Additionally, in the case of PMF files the ArcPublisher Cache password in PMF file setting must be enabled.

Loading Published Map Files (*.pmf) (with and without password protection)

Application PMF with No Password PMF with Password
MapControl (programmatically) No Prompt Supply in Code
MapControl (property pages) No Prompt Prompt
ArcMap No Prompt Prompt
ArcReader No Prompt Prompt

Product Availability

Available with ArcGIS Engine.

Specified by:
loadMxFile in interface IMapControl2
Parameters:
mxPath - The mxPath (in)
mapNameOrIndex - A Variant (in, optional, pass null if not required)
password - A Variant (in, optional, pass null if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.readMxMaps(String, java.lang.Object), IMapControl2.checkMxFile(String), IMapControl3, IMapControl4

refresh

public void refresh(int phase,
                    Object layerOrElement,
                    Object envelope)
             throws IOException,
                    AutomationException
Redraws the Map, optionally just redraw specified phases or envelope.

Description

Use the Refresh method to redraw the display. If the Refresh method is used and no arguments are supplied the refresh is based upon the IActiveView::Refresh method.

In all other cases the refresh is based upon the IActiveView::PartialRefresh method. The Refresh method supports the esriViewDrawPhases given below:

0 :esriViewNone

1 :esriViewBackground

2 :esriViewGeography

4 :esriViewGeoSelection

8 :esriViewGraphics

16 :esriViewSelection

32 :esriViewForeground

If the Refresh method is used and no phase argument is supplied, but one of the other arguments is supplied then all phases will be refreshed and the phase value will be 65535. Always supply a phase whenever possible to increase efficiency.

Use the layerOrElement argument to refresh a particular layer or graphic element. Use the envelope argument to refresh only a particular region. For example, if a new graphic is added you may only want to refresh the area surrounding the graphic.

Remarks

Use the TrackCancel object to set whether users can stop drawing processes by using the escape or spacebar keys or by clicking the mouse.

When selecting features, Refresh must be called twice, once before and once after the selection operation.

Product Availability

Available with ArcGIS Engine.

Specified by:
refresh in interface IMapControl2
Parameters:
phase - A com.esri.arcgis.carto.esriViewDrawPhase constant (in, optional, pass 65535 if not required)
layerOrElement - A Variant (in, optional, pass null if not required)
envelope - A Variant (in, optional, pass null if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

pan

public void pan()
         throws IOException,
                AutomationException
Tracks the mouse while panning the MapControl.

Description

Pan preserves the MapScale property, but changes the Extent property.

Remarks

Use the Pan method within the IMapControlEvents2::OnMouseDown event to allow the user to pan contents of the MapControl. The IMapControlEvents2::OnMouseMove event will be triggered during the pan, but no IMapControlEvents2::OnMouseUp event will occur. The ESC key on the keyboard can be used during panning to cancel the Pan.

Product Availability

Available with ArcGIS Engine.

Specified by:
pan in interface IMapControl2
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

centerAt

public void centerAt(IPoint centerPoint)
              throws IOException,
                     AutomationException
Moves the center of the MapControl to the specified location.

Description

The CenterAt method positions the supplied point in the center of the MapControl. The Extent of the MapControl will change, but the scale will remain the same.

Product Availability

Available with ArcGIS Engine.

Specified by:
centerAt in interface IMapControl2
Parameters:
centerPoint - A reference to a com.esri.arcgis.geometry.IPoint (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

trackRectangle

public IEnvelope trackRectangle()
                         throws IOException,
                                AutomationException
Rubber-bands a rectangle on the MapControl.

Description

Use the TrackRectangle method within the IMapControlEvents2::OnMouseDown event to rubberband a user defined rectangle. The IMapControlEvents2::OnMouseMove event will be triggered during the track, but no IMapControlEvents2::OnMouseUp event will occur. The ESC key on the keyboard can be used during the track to cancel the TrackRectangle.

Product Availability

Available with ArcGIS Engine.

Specified by:
trackRectangle in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.geometry.IEnvelope
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.trackLine(), IMapControl2.trackPolygon(), IMapControl3, IMapControl2.trackCircle(), IMapControl4

trackPolygon

public IGeometry trackPolygon()
                       throws IOException,
                              AutomationException
Rubber-bands a polygon on the MapControl.

Description

TrackPolygon returns a geometry object that implements IPolygon.

Remarks

Use the TrackPolygon method within the IMapControlEvents2::OnMouseDown event to rubberband a user defined polygon. The IMapControlEvents2::OnMouseMove event will be triggered during the track, but no IMapControlEvents2::OnMouseUp event will occur. The ESC key on the keyboard can be used during the track to cancel the TrackPolygon.

Calling ITopologicalOperator::Simplify on the digitized polygon will ensure that it is topologically correct.

Product Availability

Available with ArcGIS Engine.

Specified by:
trackPolygon in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.geometry.IGeometry
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.trackRectangle(), IMapControl2.trackLine(), IMapControl3, IMapControl2.trackCircle(), IMapControl4

trackLine

public IGeometry trackLine()
                    throws IOException,
                           AutomationException
Rubber-bands a polyline on the MapControl.

Description

TrackLine returns a geometry object that implements IPolyline.

Remarks

Use the TrackLine method within the IMapControlEvents2::OnMouseDown event to rubberband a user defined line. The IMapControlEvents2::OnMouseMove event will be triggered during the track, but no IMapControlEvents2::OnMouseUp event will occur. The ESC key on the keyboard can be used during the track to cancel the TrackLine.

Calling ITopologicalOperator::Simplify on the digitized line will ensure that it is topologically correct.

Product Availability

Available with ArcGIS Engine.

Specified by:
trackLine in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.geometry.IGeometry
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.trackRectangle(), IMapControl2.trackPolygon(), IMapControl3, IMapControl2.trackCircle(), IMapControl4

trackCircle

public IGeometry trackCircle()
                      throws IOException,
                             AutomationException
Rubber-bands a circle on the MapControl.

Description

TrackCircle returns a geometry object that implements IPolygon.

Remarks

Use the TrackCircle method within the IMapControlEvents2::OnMouseDown event to rubberband a user defined Circle. The IMapControlEvents2::OnMouseMove event will be triggered during the track, but no IMapControlEvents2::OnMouseUp event will occur. The ESC key on the keyboard can be used during the track to cancel the TrackCircle.

Product Availability

Available with ArcGIS Engine.

Specified by:
trackCircle in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.geometry.IGeometry
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.trackRectangle(), IMapControl2.trackLine(), IMapControl2.trackPolygon(), IMapControl3, IMapControl4

drawShape

public void drawShape(IGeometry shape,
                      Object symbol)
               throws IOException,
                      AutomationException
Draws a geometry shape on the MapControl.

Description

DrawShape draws the supplied geometry onto the display. Use the DrawShape method within the esriViewForeground phase of the IMapControlEvents2::OnAfterDraw event.

Remarks

Geometry objects implementing IEnvelope, IMultiPatch, IMultiPoint, IPoint, IPolygon and IPolyline are supported.

Product Availability

Available with ArcGIS Engine.

Specified by:
drawShape in interface IMapControl2
Parameters:
shape - A reference to a com.esri.arcgis.geometry.IGeometry (in)
symbol - A Variant (in, optional, pass null if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.flashShape(com.esri.arcgis.geometry.IGeometry, int, int, java.lang.Object), IMapControl2.drawText(com.esri.arcgis.geometry.IGeometry, String, java.lang.Object), IMapControl3, IMapControl4

flashShape

public void flashShape(IGeometry pShape,
                       int nFlashes,
                       int flashInterval,
                       Object symbol)
                throws IOException,
                       AutomationException
Flashes a shape on the MapControl, duration is in milliseconds.

Description

FlashShape flashes the supplied geometry onto the display.

Remarks

Geometry objects implementing IEnvelope, IMultiPatch, IMultiPoint, IPoint, IPolygon and IPolyline are supported.

Product Availability

Available with ArcGIS Engine.

Specified by:
flashShape in interface IMapControl2
Parameters:
pShape - A reference to a com.esri.arcgis.geometry.IGeometry (in)
nFlashes - The nFlashes (in, optional, pass 3 if not required)
flashInterval - The flashInterval (in, optional, pass 300 if not required)
symbol - A Variant (in, optional, pass null if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.drawText(com.esri.arcgis.geometry.IGeometry, String, java.lang.Object), IMapControl3, IMapControl4, IMapControl2.drawShape(com.esri.arcgis.geometry.IGeometry, java.lang.Object)

fromMapPoint

public void fromMapPoint(IPoint pt,
                         int[] x,
                         int[] y)
                  throws IOException,
                         AutomationException
Converts a point on the Map (in map units) to device co-ordinates (typically pixels).

Description

The FromMapPoint method takes an input point in MapUnits, and populates two variables with the equivalent control coordinates in pixels.

Product Availability

Available with ArcGIS Engine.

Specified by:
fromMapPoint in interface IMapControl2
Parameters:
pt - A reference to a com.esri.arcgis.geometry.IPoint (in)
x - The x (in/out: use single element array)
y - The y (in/out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.toMapPoint(int, int), IMapControl3, IMapControl4

toMapPoint

public IPoint toMapPoint(int x,
                         int y)
                  throws IOException,
                         AutomationException
Converts a point in device co-ordinates (typically pixels) to a point on the Map (in map units).

Description

ToMapPoint converts a (X,Y) location in pixels to MapUnits.

Product Availability

Available with ArcGIS Engine.

Specified by:
toMapPoint in interface IMapControl2
Parameters:
x - The x (in)
y - The y (in)
Returns:
A reference to a com.esri.arcgis.geometry.IPoint
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl3, IMapControl4, IMapControl2.fromMapPoint(com.esri.arcgis.geometry.IPoint, int[], int[])

addShapeFile

public void addShapeFile(String path,
                         String fileName)
                  throws IOException,
                         AutomationException
Adds a shapefile as a layer to the Map.

Description

When a shapefile is added to the MapControl's layer collection it is added to the beginning or top of the collection with an index of 0. The numeric index of any other layers in the layer collection increments by one.

Remarks

The Layer at the beginning or top of the collection with an index of 0 will be drawn last, whilst the Layer at the bottom of the collection will be drawn first.

Use the MoveLayerTo method to change the position of a Layer within the layer collection.

Product Availability

Available with ArcGIS Engine.

Specified by:
addShapeFile in interface IMapControl2
Parameters:
path - The path (in)
fileName - The fileName (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.addLayer(com.esri.arcgis.carto.ILayer, int), IMapControl2.addLayerFromFile(String, int), IMapControl3, IMapControl4

drawText

public void drawText(IGeometry pGeometry,
                     String text,
                     Object pSymbol)
              throws IOException,
                     AutomationException
Draws text along the supplied geometry.

Description

DrawText draws a text string around a specified geometry. Use the DrawText method within the esriViewForeground phase of the IMapControlEvents2::OnAfterDraw event.

Product Availability

Available with ArcGIS Engine.

Specified by:
drawText in interface IMapControl2
Parameters:
pGeometry - A reference to a com.esri.arcgis.geometry.IGeometry (in)
text - The text (in)
pSymbol - A Variant (in, optional, pass null if not required)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.flashShape(com.esri.arcgis.geometry.IGeometry, int, int, java.lang.Object), IMapControl3, IMapControl4, IMapControl2.drawShape(com.esri.arcgis.geometry.IGeometry, java.lang.Object)

checkMxFile

public boolean checkMxFile(String fileName)
                    throws IOException,
                           AutomationException
Checks the specified filename to see if it is a map document that can be loaded into the MapControl.

Description

Determines whether the specified map document (*.mxd, *.mxt, *.pmf) is a valid map document and can be loaded into the MapControl. The method verifies the file exists and verifies the file internals conform to an expected storage format. The method does not read and validate the entire contents of the file; use the LoadMxFile to do this.

Product Availability

Available with ArcGIS Engine.

Specified by:
checkMxFile in interface IMapControl2
Parameters:
fileName - The fileName (in)
Returns:
The result
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.readMxMaps(String, java.lang.Object), IMapControl2.loadMxFile(String, java.lang.Object, java.lang.Object), IMapControl3, IMapControl4

readMxMaps

public IArray readMxMaps(String fileName,
                         Object password)
                  throws IOException,
                         AutomationException
Opens a map document specified by the supplied filename and reads the maps into an array object.

Description

ReadMxMaps creates an array of Map objects from the specified Map Document (ArcMap document, ArcMap template or ArcReader document).

Remarks

When ReadMXMaps is used the user may be prompted for a password; refer to the tables below to determine when this may occur. Additionally, password prompts may be given if accessing MapDocuments using either the MapControl's PropertyPage, ArcMap or ArcReader; the tables also show in what circumstances this will occur.

Reading Map Documents (*.mxd, *.mxt, *.pmf) which reference IMS Services (with and without security)

Application No Secure Services MXD/ MXT/ PMF files Secure Servcies MXD/ MXT/ PMF files Secure Servcies (password cached) MXD/ MXT files Secure Servcies (password cached) PMF files
MapControl (programmatically) No Prompt Prompt No Prompt Prompt
MapControl (property pages) No Prompt Prompt No Prompt Prompt
ArcMap No Prompt Prompt No Prompt Prompt
ArcReader (PMF files only) No Prompt Prompt N/A No Prompt

* The Connection to the Internet server must have the Save User/ Password setting enabled. This can be set, for example, when using Add Internet Server in the Add Layers Dialog. Additionally, in the case of PMF files the ArcPublisher Cache password in PMF file setting must be enabled.

Reading Published Map Files (*.pmf) (with and without password protection)

Application PMF with No Password PMF with Password
MapControl (programmatically) No Prompt Supply in Code
MapControl (property pages) No Prompt Prompt
ArcMap No Prompt Prompt
ArcReader No Prompt Prompt

Product Availability

Available with ArcGIS Engine.

Specified by:
readMxMaps in interface IMapControl2
Parameters:
fileName - The fileName (in)
password - A Variant (in, optional, pass null if not required)
Returns:
A reference to a com.esri.arcgis.system.IArray
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.checkMxFile(String), IMapControl2.loadMxFile(String, java.lang.Object, java.lang.Object), IMapControl3, IMapControl4

setOleDropEnabled

public void setOleDropEnabled(boolean enabled)
                       throws IOException,
                              AutomationException
Indicates if the MapControl will fire events when data is dragged over the control's window.

Product Availability

Available with ArcGIS Engine.

Specified by:
setOleDropEnabled in interface IMapControl2
Parameters:
enabled - The enabled (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isOleDropEnabled

public boolean isOleDropEnabled()
                         throws IOException,
                                AutomationException
Indicates if the MapControl will fire events when data is dragged over the control's window.

Description

Indicates if the MapControl will accept data dragged from another application and fire the IMapControlEvents2::OnOleDrop event. By default the OleDropEnabled property is set to false.

Product Availability

Available with ArcGIS Engine.

Specified by:
isOleDropEnabled in interface IMapControl2
Returns:
The enabled
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setRotation

public void setRotation(double rotation)
                 throws IOException,
                        AutomationException
Determines how many degrees the map display is rotated.

Product Availability

Available with ArcGIS Engine.

Specified by:
setRotation in interface IMapControl2
Parameters:
rotation - The rotation (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getRotation

public double getRotation()
                   throws IOException,
                          AutomationException
Determines how many degrees the map display is rotated.

Description

This property is a shortcut to IDisplayTransformation::Rotation. The Rotation property controls the rotation of the display, and so the angle data appears inside the Map. The angle of the rotation is measured in degrees. Positive numbers rotate the display counter clockwise and negative numbers clockwise.

Product Availability

Available with ArcGIS Engine.

Specified by:
getRotation in interface IMapControl2
Returns:
The rotation
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMapUnits

public int getMapUnits()
                throws IOException,
                       AutomationException
The geographical units of the map.

Description

This property is a shortcut to IMap::MapUnits.

Product Availability

Available with ArcGIS Engine.

Specified by:
getMapUnits in interface IMapControl2
Returns:
A com.esri.arcgis.system.esriUnits constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IMapControl2.getMapScale(), IMapControl2.getReferenceScale(), IMapControl2.getSpatialReference(), IMapControl2.getMap(), IMapControl3, IMapControl4

setMapUnits

public void setMapUnits(int units)
                 throws IOException,
                        AutomationException
The geographical units of the map.

Product Availability

Available with ArcGIS Engine.

Specified by:
setMapUnits in interface IMapControl2
Parameters:
units - A com.esri.arcgis.system.esriUnits constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getTrackCancel

public ITrackCancel getTrackCancel()
                            throws IOException,
                                   AutomationException
The object used by the MapControl to check if drawing has been aborted.

Description

Use the TrackCancel object to enable users to stop drawing processes by using the escape or spacebar keys.

Product Availability

Available with ArcGIS Engine.

Specified by:
getTrackCancel in interface IMapControl2
Returns:
A reference to a com.esri.arcgis.system.ITrackCancel
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setTrackCancelByRef

public void setTrackCancelByRef(ITrackCancel ppTrackCancel)
                         throws IOException,
                                AutomationException
The object used by the MapControl to check if drawing has been aborted.

Product Availability

Available with ArcGIS Engine.

Specified by:
setTrackCancelByRef in interface IMapControl2
Parameters:
ppTrackCancel - A reference to a com.esri.arcgis.system.ITrackCancel (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.