Graphics Resource


Purpose
This sample shows how to use the Graphics Resource functionality.

How to use

See How to run the Java Server ADF 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.

Graphics Resource
  1. Create and start an ArcGIS map server object. You can use any data, map configuration file, and server object name. For example, create a server object named 'usa' from the map configuration file at %AGSDEVKITJAVA%\java\samples\data\mxds\usa.mxd.
  2. After deployment, access the sample by typing the uniform resource locator (URL) (for example, http://[host]:[port]/[samplename]) in a web browser.
  3. There are two ways to build the sample. You can either use ArcGIS Ant or the Eclipse plug-in. To use Ant, at the command line, browse to %AGSDEVKITJAVA%\java\samples\graphicsResource, type arcgisant build, and follow the command prompt to finish the build. There will be a directory called build under the sample root folder, and inside there will be a .war file. Deploy the .war file to Tomcat.
  4. The other way to build the sample is to use Eclipse. Open Eclipse>File>New Project>ESRI Templates>Web ADF Samples.
  5. Choose Graphics Resource.
  6. Use the wizard to finish building the sample.
  7. Run the sample web application on the server.
  8. You can also export the application as a .war file and deploy it to other supported application servers.
  9. Click the Point button and click a few points on the map. The point graphics are from C:/Program Files/ArcGIS/Desktop10.0/Styles/Pictures/z_flowmeter.bmp from an ArcGIS for Desktop install. To use other graphics, modify the markerSymbol URL in the addGraphicFeature.java file. You will see Graphics Layer 1 is added under the Graphics Resource node in the TOC.
  10. Click the Multipoint button and drag a rectangle on the map. The four corner point graphics are from C:/Program Files/ArcGIS/Desktop10.0/Styles/Pictures/z_fitting.bmp. Graphics Layer 2 is added under the Graphics Resource node in the TOC.
  11. Click the Polyline button, draw a line on the map, and double-click to finish. Graphics Layer 3 is added under the Graphics Resource node in the TOC.
  12. Click the Polygon button, draw a polygon on the map, and double-click to finish. The polygon filled image is from C:/Program Files/ArcGIS/Desktop10.0/Styles/Pictures/hacshd29.bmp. Graphics Layer 4 is added under the Graphics Resource node in the TOC.
  13. Click the I Point button, and click the point in Graphics Layer 1. The result is shown in the result panel.
  14. Click the I Extent button, and drag an extent that encloses the extent you made in Graphics Layer 2. The result is shown in the result panel.
  15. Click the I Polyline button, and drag a polyline that intersects the polyline in Graphics Layer 3. The result is shown in the result panel.
  16. Click the I Polygon button, and drag a polygon that overlaps the polygon in Graphics Layer 4. The result is shown in the result panel.


Download the files for Java
map.jsp Defines custom layout for HTML elements.
faces-config.xml Add the graphic resource to the web context resource, and adds myCustomAttribute as a mapContext attribute.
JavaSource\com\esri\adf\sample\graphics\MyGraphicsResource.java myCustomAttribute bean implementation.




Development licensing Deployment licensing
Server Server