|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.interop.Dispatch com.esri.arcgis.arcmapui.IMxDocumentProxy
public class IMxDocumentProxy
Provides access to members that control the Mx Document.
This interface is a starting point for much of the other objects in ArcMap. For example, this interface provides access to the current active view, the currently selected map, all of the maps, and the style gallery. This interface also has many properties reflected in the running application including: the text font, the text size, and the search tolerance. Almost every ArcMap customization uses IMxDocument one way or another.
Obtain a reference to this interface via IApplication::Document.
To edit the contents of a map document saved to a file (*.mxd) outside of an ArcMap session or without instantiating a new Application (ArcMap process), see IMapDocument. IMapDocument provides the ability to edit and save the contents of a map document.
Field Summary | |
---|---|
boolean |
noncastable
|
Fields inherited from class com.esri.arcgis.interop.Dispatch |
---|
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef |
Constructor Summary | |
---|---|
|
IMxDocumentProxy()
|
|
IMxDocumentProxy(Object obj)
|
protected |
IMxDocumentProxy(Object obj,
String iid)
|
Method Summary | |
---|---|
void |
addLayer(ILayer layer)
Adds a layer to the current focus map. |
void |
addListener(String iidStr,
Object theListener,
Object theSource)
|
void |
canInsertObject(boolean[] pEnabled)
Indicates if the document allows objects to be inserted. |
IActiveView |
getActivatedView()
The activated view. |
IActiveView |
getActiveView()
The active view. |
ICommand |
getActiveViewCommand()
The command associated with the active view. |
IContentsView |
getContentsView(int index)
The contents view at the specified index. |
int |
getContentsViewCount()
The number of contents views in the document. |
Object |
getContextItem()
The last item that was right-clicked. |
IContentsView |
getCurrentContentsView()
The current contents view of the document. |
IPoint |
getCurrentLocation()
The current mouse location in map units. |
IColor |
getDefaultColor(int type)
The default color for the given type. |
Font |
getDefaultTextFont()
The default font for text. |
IFontSize |
getDefaultTextFontSize()
The default font size for text. |
IMap |
getFocusMap()
The current focus map. |
IMaps |
getMaps()
The collection of maps in the document. |
IOperationStack |
getOperationStack()
The operation stack. |
IPageLayout |
getPageLayout()
The page layout. |
double |
getSearchTolerance()
The global search tolerance in geographic units for selection. |
int |
getSearchTolerancePixels()
The global search tolerance in pixels for selection. |
Object |
getSelectedItem()
The selected item in the layer control. |
ILayer |
getSelectedLayer()
The selected layer in the layer control. |
IStyleGallery |
getStyleGallery()
Reference to the document's Style Gallery. |
ITableProperties |
getTableProperties()
Table properties, for Layers and Tables in ArcMap. |
void |
insertObject()
Inserts an object into the document. |
boolean |
isRelativePaths()
Indicates if path names are stored relative to the document. |
void |
removeListener(String iidStr,
Object theListener)
|
void |
setActiveViewByRef(IActiveView activeView)
The active view. |
void |
setContextItem(Object item)
The last item that was right-clicked. |
void |
setCurrentContentsViewByRef(IContentsView view)
The current contents view of the document. |
void |
setCurrentLocation(IPoint mouseLoc)
The current mouse location in map units. |
void |
setDefaultColor(int type,
IColor color)
The default color for the given type. |
void |
setDefaultTextFont(Font fontDisp)
The default font for text. |
void |
setDefaultTextFontSize(IFontSize fontSize)
The default font size for text. |
void |
setDelayUpdateContents(boolean rhs1)
Indicates document update notifications should be ignored. |
void |
setPageLayoutByRef(IPageLayout pageLayout)
The page layout. |
void |
setRelativePaths(boolean relPaths)
Indicates if path names are stored relative to the document. |
void |
setSearchTolerancePixels(int tol)
The global search tolerance in pixels for selection. |
void |
updateContents()
Notifies the document that the contents have been updated. |
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 |
---|
public boolean noncastable
Constructor Detail |
---|
public IMxDocumentProxy()
public IMxDocumentProxy(Object obj) throws IOException
IOException
protected IMxDocumentProxy(Object obj, String iid) throws IOException
IOException
Method Detail |
---|
public void addListener(String iidStr, Object theListener, Object theSource) throws IOException
addListener
in class com.esri.arcgis.interop.Dispatch
IOException
public void removeListener(String iidStr, Object theListener) throws IOException
removeListener
in class com.esri.arcgis.interop.Dispatch
IOException
public void setPageLayoutByRef(IPageLayout pageLayout) throws IOException, AutomationException
setPageLayoutByRef
in interface IMxDocument
pageLayout
- A reference to a com.esri.arcgis.carto.IPageLayout (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IPageLayout getPageLayout() throws IOException, AutomationException
This method returns an IPageLayout reference to the PageLayout object. The page layout is the visual representation of a map. A typical page layout is composed of a page and many elements including data, graphics, and text.
From an object point of view, the PageLayout object has a Page object and a collection of Element objects. The page is used to manage page size and printing. Element objects include MapFrames, GraphicElements, and TextElements. Anything that can be placed on a map is a type of element.
Athough, you can programmatically create your own page layout and assign it to the map document, the general practice is to modify the existing one.
getPageLayout
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IPageLayout
public IActiveView getActiveView() throws IOException, AutomationException
This method provides access to the active view. ArcMap currently supports two types of views, layout view and data view; the view with focus is the active view. If ArcMap is in layout view, this property returns an IActiveView reference to the PageLayout object. Alternatively, if ArcMap is in data view, the returned IActiveView reference is to a Map object. Both the PageLayout and Map objects implement the IActiveView interface.
Note, an ArcMap document may have multiple maps (data frames) in it. Multiple maps means multiple Map objects. Any Map in this collection may be set as the active view. There is typically only one PageLayout object per session of ArcMap.
To determine if the returned reference is to a PageLayout object or a Map, attempt a query interface (QI) to either IPageLayout or IMap. If you know you want a reference to the focus map, use IMxDocument::FocusMap instead. Similarly, if you know you want a reference to the page layout, use IMxDocument::PageLayout instead. This is often the case when you need to refresh the display. For example, if someone has panned the map and you now need to refresh it, explicitly use IMxDocument::FocusMap which returns a reference to the Map with focus, and then QI for IActiveView.
Use this property to also set the active view programmatically.
getActiveView
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IActiveView
public void setActiveViewByRef(IActiveView activeView) throws IOException, AutomationException
setActiveViewByRef
in interface IMxDocument
activeView
- A reference to a com.esri.arcgis.carto.IActiveView (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IActiveView getActivatedView() throws IOException, AutomationException
This property is primarily used when adding graphics as it conveniently gives a reference to the object set as the target graphics container.
In ArcMap's layout view, graphics can either be added to the PageLayout's graphics container or the focus Map's graphics container if the Map has been activated by double-clicking on it. In this case, IMxDocument::ActiveView differs from IMxDocument::ActivatedView in that the ActiveView property may pass a reference to the PageLayout object while the ActivatedView property may pass a reference to the focus Map object if that Map has been activated. In data view, both ActiveView and ActivatedView return a reference to the focus Map.
getActivatedView
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.arcmapUI.IActiveView
public ICommand getActiveViewCommand() throws IOException, AutomationException
The command associated with the current active view.
In ArcMap the active view can be either a Map (corresponding to Data view in ArcMap) or a PageLayout (corresponding to Layout view in ArcMap). To switch between these different views, ArcMap has two active view commands: GeographicViewCommand and LayoutViewCommand. These commands are the tiny globe and page buttons on the scroll bar and also appear in the View menu. GeographicViewCommand sets the focus Map as the ActiveView and LayoutViewCommand sets the PageLayout as the ActiveView.
getActiveViewCommand
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IMap getFocusMap() throws IOException, AutomationException
This property is a short-cut to IActiveView::FocusMap and is read-only. To programmatically change the FocusMap use IActiveView::FocusMap.
A user's map may comprise one or more Map objects. Each Map object typically holds layers of data as well as several MapSurround objects such as a Legend. This property returns an IMap reference to the Map object that currently has focus. In ArcMap, the focus map is the one visible in data view and the one selected in layout view.
getFocusMap
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.arcmapUI.IActiveView
public ILayer getSelectedLayer() throws IOException, AutomationException
Returns the currently selected layer in the table of contents.
To select a layer in the table of contents, obtain an IContentsView reference via IMxDocument::ContentsView, then use either IContentsView::AddToSelectedItems or IContentsView::SelectedItem. To learn more, read the help for IContentsView.
getSelectedLayer
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Object getSelectedItem() throws IOException, AutomationException
This property returns a reference to the currently selected item in the table of contents. The return is an IUnknown because there are several possbile objects the selected item can be.
When working in the Display tab, the reference could be to a Map object if you have a data frame selected, one of the Layer objects (FeatureLayer, FDOGraphicsLayer, etc) if you have a layer selected, or a LegendGroup if you have a unique value or heading selected.
In the Source tab, the reference can be to any of the above objects plus a Table, FeatureDataset, or Workspace.
In the case where more than one item is selected, the reference is to a Set object.
getSelectedItem
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Object getContextItem() throws IOException, AutomationException
This property returns the item that was last right-clicked in the table of contents. Use this property when creating a custom context menu. For example, after right-clicking on a layer in the table of contents, a context menu appears which has several commands including Copy and Remove.
getContextItem
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setContextItem(Object item) throws IOException, AutomationException
setContextItem
in interface IMxDocument
item
- A reference to another Object (IUnknown) (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IStyleGallery getStyleGallery() throws IOException, AutomationException
The StyleGallery is an object that manages styles. Styles are a collection of predefined colors, symbols, properties of symbols, and map elements that are used to create maps. Styles help organizations follow a mapping standard and help promote consistency in mapping products.
The StyleGallery is the object underlying the Style Manager window in ArcMap. There is one StyleGallery object per application and it is global. Instantiating a new StyleGallery object really finds the one created by the application.
getStyleGallery
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void addLayer(ILayer layer) throws IOException, AutomationException
This method is a shortcut to the AddLayer method on the focus map (IMap::Addlayer).
addLayer
in interface IMxDocument
layer
- A reference to a com.esri.arcgis.carto.ILayer (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.com.esri.arcgis.arcmapUI.IMap
public void updateContents() throws IOException, AutomationException
Refreshes the current view in the table of contents. UpdateContents is a shortcut - it calls Refresh on the current contents view (IContentsView::Refresh). Access to the current view is provided through IMxDocument::CurrentContentsView.
updateContents
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public double getSearchTolerance() throws IOException, AutomationException
The application's search tolerance is measured and set using pixel units. This property automatically converts the size of the pixels to map units. The example shows how this conversion is done.
getSearchTolerance
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getSearchTolerancePixels() throws IOException, AutomationException
This property controls the application's search tolerance. The search tolerance is measured in pixel units. Use IMxDocument::SearchTolerance to check the search tolerance in map units.
getSearchTolerancePixels
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setSearchTolerancePixels(int tol) throws IOException, AutomationException
setSearchTolerancePixels
in interface IMxDocument
tol
- The tol (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void insertObject() throws IOException, AutomationException
insertObject
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void canInsertObject(boolean[] pEnabled) throws IOException, AutomationException
canInsertObject
in interface IMxDocument
pEnabled
- The pEnabled (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IMaps getMaps() throws IOException, AutomationException
The map document has a collection of Map objects which are accessible through this property. The reference IMaps is typically used to add and delete maps from the collection.
See the FocusMap property on this interface for accessing just the one map with focus.
getMaps
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IMaps
public IOperationStack getOperationStack() throws IOException, AutomationException
The map document manages an operation stack which provides undo/redo functionality. Modifications, including those to elements and features, are typically wrapped inside an operation. Operations are added to the operation stack so the modification can be rolled out and then rolled back if desired. For example, when a graphic element is moved, the operation can be undone moving the graphic back to its original location.
Depending on your scenario, there are different methodologies for creating an operation and adding it to the OperationStack.
getOperationStack
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.IOperationStack
public Font getDefaultTextFont() throws IOException, AutomationException
This property conveniently stores a default font for any tool requiring one. For example, the New Text tool adds text graphics to an active view and initially uses the font stored in this property.
getDefaultTextFont
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setDefaultTextFontSize(IFontSize fontSize) throws IOException, AutomationException
setDefaultTextFontSize
in interface IMxDocument
fontSize
- A reference to a com.esri.arcgis.display.IFontSize (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IFontSize getDefaultTextFontSize() throws IOException, AutomationException
This property conveniently stores a default font size for any tool requiring one. For example, the New Text tool on ArcMap's Draw toolbar, adds text graphics to an active view and initially uses the font size stored in this property.
getDefaultTextFontSize
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setDefaultTextFont(Font fontDisp) throws IOException, AutomationException
setDefaultTextFont
in interface IMxDocument
fontDisp
- A reference to a com.esri.arcgis.support.ms.stdole.Font (A com.esri.arcgis.support.ms.stdole.Font COM typedef) (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IColor getDefaultColor(int type) throws IOException, AutomationException
getDefaultColor
in interface IMxDocument
type
- A com.esri.arcgis.arcmapui.esriMxDefaultColorTypes constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setDefaultColor(int type, IColor color) throws IOException, AutomationException
setDefaultColor
in interface IMxDocument
type
- A com.esri.arcgis.arcmapui.esriMxDefaultColorTypes constant (in)color
- A reference to a com.esri.arcgis.display.IColor (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IPoint getCurrentLocation() throws IOException, AutomationException
A lot of tools require the current mouse location in order to perform an operation. This property provides a short-cut alternative to having to manually calculate the current mouse location in map units. For example, a typical pan tool needs the current mouse location in three different places: when the mouse if first clicked, while the mouse drags, and when the button is released. Although ITool provides the mouse location for each of these events, the location is given in x,y device units. Rather than writing a function that uses something like IDisplayTransformation::ToMapPoint to calculate the location in map units, the Location property does this automatically behind the scenes.
getCurrentLocation
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCurrentLocation(IPoint mouseLoc) throws IOException, AutomationException
setCurrentLocation
in interface IMxDocument
mouseLoc
- A reference to a com.esri.arcgis.geometry.IPoint (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setDelayUpdateContents(boolean rhs1) throws IOException, AutomationException
Delays calling refresh of the current contents view. For example, after loading a layer you should call UpdateContents to refresh the contents view (table on contents). When loading several layers, there is no need to refresh the contents view after each layer is loaded; instead, delay refreshing the contents view until all the layers have been loaded.
All calls to UpdateContents are ignored when DelayUpdateContents is set to TRUE. To ensure the contents view is ultimately refreshed, UpdateContents is automatically called when DelayUpdateContents is set back to FALSE.
setDelayUpdateContents
in interface IMxDocument
rhs1
- The rhs1 (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isRelativePaths() throws IOException, AutomationException
isRelativePaths
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setRelativePaths(boolean relPaths) throws IOException, AutomationException
setRelativePaths
in interface IMxDocument
relPaths
- The relPaths (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IContentsView getCurrentContentsView() throws IOException, AutomationException
A contents view is a tab in the table of contents. ArcMap ships with two contents views, Display and Source. The object behind Display is TOCDisplayView and TOCCatalogView is behind the Source view. Custom contents views can be created by implementing the IContentsView interface. Only one contents view can be active at a time. Use this property to set the current contents view and to get a reference to the current contents view. Setting the current contents view automatically calls IContentsView::Refresh.
getCurrentContentsView
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCurrentContentsViewByRef(IContentsView view) throws IOException, AutomationException
setCurrentContentsViewByRef
in interface IMxDocument
view
- A reference to a com.esri.arcgis.arcmapui.IContentsView (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getContentsViewCount() throws IOException, AutomationException
A contents view is a tab in the table of contents. ArcMap ships with two contents views: Display (TOCDisplayView) and Source (TOCCatalogView). Create custom contents views by implementing the IContentsView interface. Only one contents view can be active at a time. This property returns the number of contents views registered in the ESRI Contents Views component category. The Display contents view is not listed here as it is the default.
getContentsViewCount
in interface IMxDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IContentsView getContentsView(int index) throws IOException, AutomationException
getContentsView
in interface IMxDocument
index
- The index (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public ITableProperties getTableProperties() throws IOException, AutomationException
getTableProperties
in interface IMxDocument
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 |