com.esri.arcgis.carto
Interface IMapServerObjects2

All Superinterfaces:
Serializable
All Known Implementing Classes:
MapServer

public interface IMapServerObjects2
extends Serializable

Provides access to core objects contained within the map document.

Superseded By

IMapServerObjects2

Remarks

Though the methods and properties available through MapServer and its associated objects offer important mapping functionality, they cannot possibly encapsulate all that ArcObjects offers. In many cases you may want to use other, finer-grained, ArcObjects in conjunction with MapServer. You can do this using the IMapServerObjects2 interface. Through this interface you can access ILayer, IMap and IPageLayout. For example, you can make changes to the map, such as adding a new layer, using IMap.

It is very important to distinguish between temporary and permanent changes to the MapServer object. A temporary change would include changes to the MapDescription or LayerDescription using IMapDescription2 and ILayerDescription3. For example, you might change the geographic extent of a map (MapArea) or change the visibility of a layer (Visible). These changes can be temporary and valid for the duration of the call. Once the call has ended the MapServer object returns to it's default state.

Permanent changes to the MapServer object can be done in two ways. The first is by changing MapServer properties using such interfaces as IMapDescription and ILayerDescription and then calling the IMapServerObjects method ApplyMapDescription. This will update the state of the MapServer object. Another way to change the MapServer object is to access the underlaying fine-grained ArcObjects directly using the methods on IMapServerObjects, make a change such as adding a new layer or changing a layer's rendering, and then calling RefreshServerObjects. This refreshes the MapServer object with the current state held by the fine-grained ArcObjects.

If the underlying fine-grained ArcObjects are to be changed, MapServer objects should be in a non-pooled configuration.

When To Use

Use IMapServerObjects to access fine-grained ArcObjects. Through this interface you can access ILayer, IMap and IPageLayout. For example, you can make changes to the map, such as adding a new layer, using the IMap object.

This interface is not supported by optimized MapServer

Product Availability

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


Method Summary
 void applyMapDescription(IMapDescription mapDescription, IImageDisplay mapDisplay)
          Applies the current state of the map description to the map server object.
 ILayer getLayer(String mapName, int layerID)
          The layer specified by the map name and layer ID.
 int getLayerID(String mapName, ILayer pLayer)
          The layer specified by the map name and layer ID.
 IMap getMap(String mapName)
          The map corresponding to the specified map name.
 IPageLayout getPageLayout()
          The page layout object for the current map document.
 Picture getThumbnail()
          The thumbnail stored in the map document.
 void refreshServerObjects()
          Updates the server info based on the current state of the underlying fine-grained objects.
 

Method Detail

getLayerID

int getLayerID(String mapName,
               ILayer pLayer)
               throws IOException,
                      AutomationException
The layer specified by the map name and layer ID. If the mapName is blank, the default map (active data frame) will be assumed.

Product Availability

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

Parameters:
mapName - The mapName (in)
pLayer - A reference to a com.esri.arcgis.carto.ILayer (in)
Returns:
The iD
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getMap

IMap getMap(String mapName)
            throws IOException,
                   AutomationException
The map corresponding to the specified map name. Pass in a blank string for mapName to get the default map (active data frame).

Product Availability

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

Parameters:
mapName - The mapName (in)
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.

getLayer

ILayer getLayer(String mapName,
                int layerID)
                throws IOException,
                       AutomationException
The layer specified by the map name and layer ID. If the mapName is blank, the default map (active data frame) will be assumed.

Product Availability

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

Parameters:
mapName - The mapName (in)
layerID - The layerID (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.

getPageLayout

IPageLayout getPageLayout()
                          throws IOException,
                                 AutomationException
The page layout object for the current map document.

Remarks

Use PageLayout to access the members of IPageLayout.

Product Availability

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

Returns:
A reference to a com.esri.arcgis.carto.IPageLayout
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getThumbnail

Picture getThumbnail()
                     throws IOException,
                            AutomationException
The thumbnail stored in the map document.

Remarks

You cannot access the Thumbnail though DCOM.

Product Availability

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

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.

refreshServerObjects

void refreshServerObjects()
                          throws IOException,
                                 AutomationException
Updates the server info based on the current state of the underlying fine-grained objects.

Remarks

Use RefreshServerObjects when you have made changes to the fine-grained ArcObjects and want to apply them to the MapServer object. Keep in mind that this will change the default state of the MapServer object. In order to get the updated MapDescription, you have to call GetServerInfo on IMapServer2 again.

Any custom graphics (IMapDescription2 or IPageDescription) set previous to the RefreshServerObjects call will be lost. You will need to repeat the code for the custom graphics.

RefreshServerObjects does not refresh the extent on IPageDescription . Therefore, if you have zoomed to a particular extent of the page layout using the fine-grained ArcObjects (IActiveView) and you want to apply this extent to the PageDescription, you have to do this manually.

Product Availability

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

Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

applyMapDescription

void applyMapDescription(IMapDescription mapDescription,
                         IImageDisplay mapDisplay)
                         throws IOException,
                                AutomationException
Applies the current state of the map description to the map server object.

Remarks

Use ApplyMapDescription to apply changes made in IMapDescription2 to the map server object. ApplyMapDescription will not apply any custom graphics (IMapDescription2 or IPageDescription) to the map server object. See the following example on how to apply custom graphics to the map server object.

Product Availability

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

Parameters:
mapDescription - A reference to a com.esri.arcgis.carto.IMapDescription (in)
mapDisplay - A reference to a com.esri.arcgis.carto.IImageDisplay (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.