|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.arcgis.carto.MapDocument
public class MapDocument
The MapDocument coclass is used to read and write map document files.
The MapDocument CoClass encapsulates map document files (*.mxd, *mxt, *.pmf) and layer files (*.lyr) and provides properties and methods for: accessing and updating the contents of a document; determining document properties; and reading, writing and saving map documents files (*.mxd).
When opening or creating a map document with the IMapDocument Open() or New() methods, you should always make subsequent calls to IActiveView::Activate() in order to properly initialize the display of the PageLayout and Map objects. Call Activate() once for the PageLayout and once for each Map you will be working with. If your application has a user interface, you should call Activate() with the hWnd of the application's client area. If your application runs in the background and has no windows, you can always get a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.
Constructor Summary | |
---|---|
MapDocument()
Constructs a MapDocument using ArcGIS Engine. |
|
MapDocument(Object obj)
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts. MapDocument theMapDocument = (MapDocument) obj; |
Method Summary | |
---|---|
void |
close()
Close the map document. |
void |
createPreview()
Creates a thumbnail preview of the document. |
void |
deletePreview()
Deletes the thumbnail preview of the document. |
boolean |
equals(Object o)
Compare this object with another |
void |
esri_new(String sDocument)
Creates and opens a new map document in preparation for the contents to be retrieve or updated. |
IActiveView |
getActiveView()
The ActiveView of the map document. |
String |
getAuthor()
The author of the document. |
String |
getCategory()
The category of the document. |
static String |
getClsid()
getClsid. |
String |
getComments()
Comments for the document. |
String |
getCredits()
The credits of the document. |
Object |
getDateExported()
Date the document was last exported. |
Object |
getDatePrinted()
Date the document was last printed. |
Object |
getDateSaved()
Date the document was last saved. |
String |
getDocumentFilename()
The map document filename that the MapDocument coclass is linked to. |
String |
getDocumentTitle()
The title of the document. |
int |
getDocumentType()
The type of map document currently loaded in the object. |
int |
getDocumentVersion()
Indicates if the version of the map document is compatible with the current version of software. |
String |
getFolder()
The folder of the document. |
String |
getHyperlinkBase()
The hyperlink base of the document. |
String |
getKeywords()
The keywords for the document. |
ILayer |
getLayer(int mapIndex,
int layerIndex)
The Layer object at the specified index for the specified map. |
IMap |
getMap(int mapIndex)
The Map object at the specified index. |
int |
getMapCount()
The number of Map objects contained within the map document. |
String |
getName()
The name of the document. |
IPageLayout |
getPageLayout()
The PageLayout object. |
String |
getPath()
The path of the document. |
IPrinter |
getPrinter()
The printer object. |
String |
getSubject()
The subject of the document. |
IPicture |
getThumbnail()
The thumbnail stored in the map document. |
void |
getVersionInfo(boolean[] versionInfoMissing,
int[] lMajor,
int[] lMinor,
int[] lRevision,
int[] lBuild)
Retrieve the detailed version information of the map document. |
int |
hashCode()
the hashcode for this object |
boolean |
isHasPreviewSaved()
Indicates the presence of a thumbnail preview in the document. |
boolean |
isHasPreviewToSave()
Indicates the presence of a thumbnail preview to be saved with the document. |
boolean |
isMapDocument(String sDocument)
Indicates if the map document is a valid map document. |
boolean |
isPasswordProtected(String sDocument)
Indicates if the map document is protected by a passsword. |
boolean |
isPresent(String sDocument)
Indicates if the map document is present. |
boolean |
isReadOnly(String sDocument)
Indicates if the map document is read only. |
boolean |
isRelativePaths()
Indicates if relative path is used when the document is saved. |
boolean |
isRestricted(String sDocument)
Indicates if the use of the map document is restricted to certain applications. |
boolean |
isSavePreview()
Indicates if a preview of the document is saved when the document is saved. |
boolean |
isUsesRelativePaths()
Indicates if the data in the map document is referenced using relative paths. |
void |
open(String sDocument,
String bsPassword)
Open the map document in preparation for the contents to be retrieve or updated. |
void |
replaceContents(IMxdContents pObject)
Replace the contents of the map document. |
void |
save(boolean bUseRelativePaths,
boolean bCreateThumnbail)
Save the contents of the map document to the bound file. |
void |
saveAs(String sDocument,
boolean bUseRelativePaths,
boolean bCreateThumnbail)
Save the contents of the map document to the specified file name. |
void |
setActiveView(IActiveView pActiveView)
Set the ActiveView content of the map document. |
void |
setAuthor(String author)
The author of the document. |
void |
setCategory(String category)
The category of the document. |
void |
setComments(String comments)
Comments for the document. |
void |
setCredits(String credits)
The credits of the document. |
void |
setDocumentTitle(String title)
The title of the document. |
void |
setDocumentVersion(int docVersion)
The version of the document to save. |
void |
setHyperlinkBase(String path)
The hyperlink base of the document. |
void |
setKeywords(String keywords)
The keywords for the document. |
void |
setRelativePaths(boolean useRelativePaths)
Indicates if relative path is used when the document is saved. |
void |
setSavePreview(boolean savePreview)
Indicates if a preview of the document is saved when the document is saved. |
void |
setSubject(String subject)
The subject of the document. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef |
---|
getJintegraDispatch, release |
Constructor Detail |
---|
public MapDocument() throws IOException, UnknownHostException
IOException
- if there are interop problems
UnknownHostException
- if there are interop problemspublic MapDocument(Object obj) throws IOException
MapDocument theMapDocument = (MapDocument) obj;
obj
to MapDocument
.
obj
- an object returned from ArcGIS Engine or Server
IOException
- if there are interop problemsMethod Detail |
---|
public static String getClsid()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public boolean isMapDocument(String sDocument) throws IOException, AutomationException
isMapDocument
in interface IMapDocument
sDocument
- The sDocument (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isPresent(String sDocument) throws IOException, AutomationException
isPresent
in interface IMapDocument
sDocument
- The sDocument (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isReadOnly(String sDocument) throws IOException, AutomationException
isReadOnly
in interface IMapDocument
sDocument
- The sDocument (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isRestricted(String sDocument) throws IOException, AutomationException
isRestricted
in interface IMapDocument
sDocument
- The sDocument (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isPasswordProtected(String sDocument) throws IOException, AutomationException
isPasswordProtected
in interface IMapDocument
sDocument
- The sDocument (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void esri_new(String sDocument) throws IOException, AutomationException
esri_new
in interface IMapDocument
sDocument
- The sDocument (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void open(String sDocument, String bsPassword) throws IOException, AutomationException
Opens the specified MapDocument in preparation for reading it. The MapDocument can be an an ArcMap document (*.mxd), ArcMap template (*.mxt), Published Map File (*.pmf) or Layer File (*.lyr). The MapDocument will be cached so no other users will be able to access the MapDocument until it has been closed.
Before using the Open methods check whether the specified document IsPresent, IsRestricted, IsMapDocument and IsPasswordProtected. If the MapDocument is password protected, specify the password in the Open method.
If a Layer File (*.lyr) is opened a portriat PageLayout containing one Map with the layer added to it is created.
When opening or creating a map document with the IMapDocument Open() or New() methods, you should always make subsequent calls to IActiveView::Activate() in order to properly initialize the display of the PageLayout and Map objects. Call Activate() once for the PageLayout and once for each Map you will be working with. If your application has a user interface, you should call Activate() with the hWnd of the application's client area. If your application runs in the background and has no windows, you can always get a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.
open
in interface IMapDocument
sDocument
- The sDocument (in)bsPassword
- The bsPassword (in, optional, pass if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getDocumentFilename() throws IOException, AutomationException
Returns the DocumentFilename of the last map document that was successfully opened with the Open method. An empty string will be returned if no document has been opened.
getDocumentFilename
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getDocumentType() throws IOException, AutomationException
Returns the type of MapDocument that is open.
If a map template (*.mxt) is open esriMapDocumentTypeMxd will be returned.
getDocumentType
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isUsesRelativePaths() throws IOException, AutomationException
Determines whether the MapDocument that is open stores paths to data sources as relative path names (relative to the MapDocument) or absolute path names.
If a Published Map File (*.pmf) is Open that was published with ArcGIS 8.x or a Layer File (*.lyr) is Open the UsesRelativePaths will always return false.
isUsesRelativePaths
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getDocumentVersion() throws IOException, AutomationException
Returns whether the version of the MapDocument that is open is compatible with the current software accessing the document.
getDocumentVersion
in interface IMapDocument
getDocumentVersion
in interface IDocumentVersion
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IPageLayout getPageLayout() throws IOException, AutomationException
Returns the PageLayout of the MapDocument that is open.
getPageLayout
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IActiveView getActiveView() throws IOException, AutomationException
Returns the ActiveView of the MapDocument that is open. This can can be a PageLayout or a Map. If a map document (*.mxd) is Open the ActiveView will be the map or page layout that was the ActiveView when the document was last saved. If a Published Map File (*.pmf) is Open the ActivewView will be the default view specified at the time the document was published. If a layer file (*.lyr) is Open the ActiveView will be a map.
When working with the IActiveView interface on a MapDocument object, you should always first call IActiveView::Activate() in order to properly initialize the display of the PageLayout or Map object. If your application has a user interface, you should call Activate() with the hWnd of the application's client area. If your application runs in the background and has no windows, you can always get a valid hWnd from the GDI GetDesktopWindow() function, part of the Win32 API.
getActiveView
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public int getMapCount() throws IOException, AutomationException
Returns the number of map's within the PageLayout.
getMapCount
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IMap getMap(int mapIndex) throws IOException, AutomationException
getMap
in interface IMapDocument
mapIndex
- The mapIndex (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public ILayer getLayer(int mapIndex, int layerIndex) throws IOException, AutomationException
getLayer
in interface IMapDocument
mapIndex
- The mapIndex (in)layerIndex
- The layerIndex (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IPrinter getPrinter() throws IOException, AutomationException
The Printer stored in the MapDocument. If a map document (*.mxd) or map template (*.mxt) is Open the Printer returned will be the printer stored in the document when it was last saved. If no printer is saved in the document the Printer will be nothing. If a Published Map File (*.pmf) or layer file (*.lyr) is Open the Printer will be nothing. Creating a New MapDocument will set the Printer to nothing.
If the Printer cannot be found on the system, a message box will display indicating that the printer is not installed. The MessageLogger can be used to switch this message off.
getPrinter
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public IPicture getThumbnail() throws IOException, AutomationException
Returns the Thumbnail stored in the MapDocument that is open. Not every MapDocument has a thumbnail. The Thumnail is a small bitmap picture representation of the contents of the MapDocument.
getThumbnail
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void close() throws IOException, AutomationException
Closes the MapDocument. This sets the DocumentFilename property to an empty string and resets the ActiveView, PageLayout, Map, MapCount, Printer and Thumbnail properties.
close
in interface IMapDocument
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void getVersionInfo(boolean[] versionInfoMissing, int[] lMajor, int[] lMinor, int[] lRevision, int[] lBuild) throws IOException, AutomationException
Returns the major, minor, revision and build numbers of the MapDocument if the map document version information is present.
getVersionInfo
in interface IMapDocument
versionInfoMissing
- The versionInfoMissing (in/out: use single element array)lMajor
- The lMajor (in/out: use single element array)lMinor
- The lMinor (in/out: use single element array)lRevision
- The lRevision (in/out: use single element array)lBuild
- The lBuild (in/out: use single element array)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void replaceContents(IMxdContents pObject) throws IOException, AutomationException
Replaces the contents of the MapDocument with the contents of the specified Map, PageLayout, MapControl or PageLayoutControl. Before using the ReplaceContents method a New MapDocument must be created or an existing MapDocument must be Open.
If a MapControl is passed to the ReplaceContents method the MapDocument will be replaced with the IMapControl2::Map. Likewise, if a PageLayoutControl is passed to the ReplaceContents method the MapDocument will be replaced with the IPageLayoutControl::PageLayout.
If the MapDocument contents is replaced with the contents of a Map or MapControl a portriat PageLayout containing the map will be created.
replaceContents
in interface IMapDocument
pObject
- A reference to a com.esri.arcgis.carto.IMxdContents (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setActiveView(IActiveView pActiveView) throws IOException, AutomationException
Use this method to set the ActiveView of the MapDocument. Use the PageLayout and Map properties to specify the ActiveView.
setActiveView
in interface IMapDocument
pActiveView
- 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 void save(boolean bUseRelativePaths, boolean bCreateThumnbail) throws IOException, AutomationException
Saves the MapDocument that is Open and any changes that have been made to it. Before using the Save method check whether the document IsReadOnly. If a MapDocument is read only use the SaveAs method to create a new MapDocument. By default MapDocuments are saved without relative paths and thumbnails.
Specifying thumbnails as True can delay saving complex map documents as the view of the document is generated for the thumbnail. However, thumbnails are guides for users browsing map documents using ArcCatalog and Windows Explorer.
If a Published Map File (*.pmf) or Layer File (*.lyr) is Open use the SaveAs method to create a new Map Document (*.mxd), as attempting to use the Save method will return an error.
save
in interface IMapDocument
bUseRelativePaths
- The bUseRelativePaths (in, optional, pass true if not required)bCreateThumnbail
- The bCreateThumnbail (in, optional, pass true if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void saveAs(String sDocument, boolean bUseRelativePaths, boolean bCreateThumnbail) throws IOException, AutomationException
Saves the MapDocument that is Open and any changes that have been made to it to a new MapDocument with the specified filename. The filename that is supplied must be valid and inlcude the *.mxd extension. By default MapDocuments are saved without relative paths and thumbnails.
Specifying thumbnails as True can delay saving complex map documents as the view of the document is generated for the thumbnail. However, thumbnails are guides for users browsing map documents using ArcCatalog and Windows Explorer.
The SaveAs method cannot be used to save the MapDocument as an earlier ArcGIS 8.3 map document.
saveAs
in interface IMapDocument
sDocument
- The sDocument (in)bUseRelativePaths
- The bUseRelativePaths (in, optional, pass true if not required)bCreateThumnbail
- The bCreateThumnbail (in, optional, pass true if not required)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setDocumentVersion(int docVersion) throws IOException, AutomationException
setDocumentVersion
in interface IDocumentVersion
docVersion
- A com.esri.arcgis.system.esriArcGISVersion constant (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getDocumentTitle() throws IOException, AutomationException
getDocumentTitle
in interface IDocumentInfo
getDocumentTitle
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setDocumentTitle(String title) throws IOException, AutomationException
setDocumentTitle
in interface IDocumentInfo
setDocumentTitle
in interface IDocumentInfo2
title
- The title (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getSubject() throws IOException, AutomationException
getSubject
in interface IDocumentInfo
getSubject
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setSubject(String subject) throws IOException, AutomationException
setSubject
in interface IDocumentInfo
setSubject
in interface IDocumentInfo2
subject
- The subject (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getAuthor() throws IOException, AutomationException
getAuthor
in interface IDocumentInfo
getAuthor
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setAuthor(String author) throws IOException, AutomationException
setAuthor
in interface IDocumentInfo
setAuthor
in interface IDocumentInfo2
author
- The author (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getCategory() throws IOException, AutomationException
getCategory
in interface IDocumentInfo
getCategory
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCategory(String category) throws IOException, AutomationException
setCategory
in interface IDocumentInfo
setCategory
in interface IDocumentInfo2
category
- The category (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getComments() throws IOException, AutomationException
getComments
in interface IDocumentInfo
getComments
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setComments(String comments) throws IOException, AutomationException
setComments
in interface IDocumentInfo
setComments
in interface IDocumentInfo2
comments
- The comments (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getKeywords() throws IOException, AutomationException
getKeywords
in interface IDocumentInfo
getKeywords
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setKeywords(String keywords) throws IOException, AutomationException
setKeywords
in interface IDocumentInfo
setKeywords
in interface IDocumentInfo2
keywords
- The keywords (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getHyperlinkBase() throws IOException, AutomationException
getHyperlinkBase
in interface IDocumentInfo
getHyperlinkBase
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setHyperlinkBase(String path) throws IOException, AutomationException
setHyperlinkBase
in interface IDocumentInfo
setHyperlinkBase
in interface IDocumentInfo2
path
- The path (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isSavePreview() throws IOException, AutomationException
isSavePreview
in interface IDocumentInfo
isSavePreview
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setSavePreview(boolean savePreview) throws IOException, AutomationException
setSavePreview
in interface IDocumentInfo
setSavePreview
in interface IDocumentInfo2
savePreview
- The savePreview (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getCredits() throws IOException, AutomationException
getCredits
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setCredits(String credits) throws IOException, AutomationException
setCredits
in interface IDocumentInfo2
credits
- The credits (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isRelativePaths() throws IOException, AutomationException
isRelativePaths
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void setRelativePaths(boolean useRelativePaths) throws IOException, AutomationException
setRelativePaths
in interface IDocumentInfo2
useRelativePaths
- The useRelativePaths (in)
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getName() throws IOException, AutomationException
getName
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getPath() throws IOException, AutomationException
getPath
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public String getFolder() throws IOException, AutomationException
getFolder
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Object getDateSaved() throws IOException, AutomationException
getDateSaved
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Object getDatePrinted() throws IOException, AutomationException
getDatePrinted
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public Object getDateExported() throws IOException, AutomationException
getDateExported
in interface IDocumentInfo2
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void createPreview() throws IOException, AutomationException
createPreview
in interface IDocumentPreview
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public void deletePreview() throws IOException, AutomationException
deletePreview
in interface IDocumentPreview
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isHasPreviewSaved() throws IOException, AutomationException
isHasPreviewSaved
in interface IDocumentPreview
IOException
- If there are interop problems.
AutomationException
- If the ArcObject component throws an exception.public boolean isHasPreviewToSave() throws IOException, AutomationException
isHasPreviewToSave
in interface IDocumentPreview
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 |