Engine Viewer


Purpose
Engine Viewer is a stand-alone sample application that provides the following functionality:
  • Open a map document (.mxd file)
  • Zoom in
  • Zoom out
  • Pan
  • Identify
It uses Java Swing technology to provide a user interface (UI) framework and the Java Image I/O application programming interface (API) to render images.
 
This sample demonstrate how to use a map server in a stand-alone desktop Java application.

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. To compile and run this application, use Ant or an integrated development environment (IDE), or execute its Java Archive (.jar) file.
  2. Open a .mxd file, such as mxds/usa.mxd, in the samples data directory (installDir/java/samples/data).
  3. Zoom in, zoom out, pan, and identify features.

Additional information

Engine Viewer contains the following components:
  • MapComponent—Provides basic map functionality such as zoom in, zoom out, pan, and identify.
  • MapInfo—This class is used as a data handler for the application. It instantiates and maintains the current state of the map server. Any changes in the extent due to zoom in, zoom out, and so on, change the current extent of the map, resulting in MapInfo exporting an image. The image is then rendered on the MapComponent's display screen.
  • Toolbar—Contains a set of tool buttons and a drop-down list of the maps that are contained in the .mxd file. Each tool button can be defined by providing the custom image and an action command. The available actions are as follows:
    • Zoom in
    • Zoom out
    • Pan
    • Identify
These actions are defined in the MapActions class. When a .mxd file is opened, the map list (combo box) is populated with the available maps, and the selections are set to the default map (focus map). A map selection from the drop-down appears in the MapComponent.
  • TocControl—A tree-like structure that displays and changes the visibility of the layers. When a map is loaded, TocControl refreshes to display visibility of layers as defined in the .mxd file.

    The following node types can be added to TocControl:
    • MapFrame
    • Layer
These nodes are extended from an abstract base class called Node. The MapFrame node displays the name of the map, and the layers in the map are added as Layer nodes. A check box is provided to toggle the visibility of the layers.



Download the files for Java
scenario/toc/CheckBoxPanel.java Utility class
scenario/map/Display.java Utility class
scenario/map/DrawTool.java Utility class
scenario/EngineViewer.java Main class:
scenario/map/EnvelopeHelper.java Utility class
scenario/map/IdentifyDialog.java Utility class
scenario/map/IdentifyInfo.java Utility class
scenario/map/ImagePainter.java Utility class
scenario/toc/LabelPanel.java Utility class
scenario/map/LayerInfo.java Utility class
scenario/toc/LayerNode.java Utility class
scenario/MapActions.java Utility class
scenario/map/MapComponent.java Utility class
scenario/toc/MapFrameNode.java Utility class
scenario/map/MapInfo.java Utility class
scenario/toc/Node.java Utility class
scenario/toc/TocControl.java Utility class
scenario/toc/TocTreeRenderer.java Utility class
scenario/ToolBar.java Utility class




Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView
ArcEditor
ArcInfo