Graphics Renderer


Purpose
This sample shows how to use WebGraphics to add point, line and polygon to the map and how to use WebUniqueValueRenderer to render data. A graphicRenderer bean is registered with the web context. This bean is used to add the WebGraphic to the map and renders the data in various renderers. The bean has two methods, addWebGraphics and addRenderGraphics, they both take a MapEvent argument. To add any web graphic, you first create a GraphicElement, assemble a symbol and geometry, and assign them to the graphic element.
When run the sample, click the 'Add Point', 'Add Polyline' and 'Add Polygon' buttons to add graphic to the map, 'Clear' button to remove them. Click the 'Add Renderer' then click few points on the map, each point clicked is renderered as a unique value indicating by a dot of various color and size.

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.

Graphics Renderer
  1. This sample shows how to use WebGraphics to add point, line and polygon to the map and how to use WebUniqueValueRenderer to render data. A graphicRenderer bean is registered with the web context. This bean is used to add the WebGraphic to the map and renders the data in various renderers. The bean has two methods, addWebGraphics and addRenderGraphics, they both take a MapEvent argument. To add any web graphic, you first create a GraphicElement, assemble a symbol and geometry, and assign them to the graphic element. When run the sample, click the 'Add Point', 'Add Polyline' and 'Add Polygon' buttons to add graphic to the map, 'Clear' button to remove them. Click the 'Add Renderer' then click few points on the map, each point clicked is renderered as a unique value indicating by a dot of various color and size.
  2. Create and start an ArcGIS map server object. You may use any data, map configuration file, and server object name. If you wish to match the Web application in the Developer Help, create a server object named 'usa' from the map configuration file at %AGSDEVKITJAVA%\java\samples\data\mxds\usa.mxd. (This difference is seen in the faces-config.xml file and the map's appearance.)
  3. After deployment access the sample by typing the URL (e.g. http://[host]:[port]/[samplename]) in a web browser.
  4. There are two ways to build the sample. You can either use ArcGIS Ant or Eclipse plugin. To use Ant, at command line, browse to %AGSDEVKITJAVA%\java\samples\graphicRenderer, type arcgisant build, follow the command prompt to finish the build. There will be a directory called build under the sample root folder, inside there will be a war file. Deploy the war file into Tomcat.
  5. The other way to build the sample is to use Eclipse. Open Eclipse, File - New Project - ESRI Templates - Web ADF Samples.
  6. Choose the Graphics Renderer
  7. Go through the wizard to finish building the sample.
  8. Run the sample web application on server.
  9. You can also export the application as war file and deploy to other supported application server.
  10. Open http://<host>:<port>/<appname>/map.jsf
  11. Click the 'Add Point', 'Add Polyline' and 'Add Polygon' buttons to add graphic to the map, 'Clear' button to remove them.
  12. Click the 'Add Renderer' then click few points on the map, each point clicked is renderered as a unique value.


Download the files for Java
graphicRenderer.jsp Defines custom layout for html elements
fc-graphicrenderer.xml Declares graphicRenderer bean
JavaSource\com\esri\arcgis\sample\renderergraphics\RendererGraphics.java Class used to add the WebGraphic to the map and renderer the data in various renderers




Development licensing Deployment licensing
Server Server