Rogue Wave JViews Diagrammer Sample: Working with JViews Maps
Description
This sample shows how to use the Rogue Wave JViews Maps product together with Rogue Wave JViews Diagrammer to display a diagram on top of a background map.
How to Use the Sample
- Note: You must have the Rogue Wave JViews Maps product installed to run this example, and you must have a valid license for that product.
- Double-click a node to display its properties. You see that nodes have latitude and longitude properties instead of x and y.
- Click other nodes or links to see their properties.
- Use the check boxes of the legend to hide or show some of the nodes or links.
- Use the Zoom In and Zoom Out icons and see how the resolution of the map changes.
How to Run the Sample as an Application
This sample can also be run as an application. The installation directory contains an executable JAR file, diagrammer-map.jar
, that allows you to execute the sample with a double click from a file browser. Note that if you are using Internet Explorer, you can open the installation directory and execute the JAR file from the browser. This technique may not work in other Web browsers.
Alternatively, you can run the sample application from the command line. First check that the Ant utility is properly configured. If not, see the instructions on how to configure Ant for Rogue Wave JViews.
Then, go to the installation directory of the sample and type:
ant run
Topics Covered
- Display a georeferenced diagram on top of a map using Rogue Wave JViews Maps together with Rogue Wave JViews Diagrammer.
Detailed Description
This sample shows how to use the Rogue Wave JViews Maps product together with Rogue Wave JViews Diagrammer to display a diagram on top of a background map.
The diagram represents assets in various towns, connected by links. It could represent factories, power supplies, internet nodes, or any other georeferenced objects.
The background is a tiled, multiresolution map of the USA: it consists of many small bitmap files covering a region of the world. The tiles are loaded using the load-on-demand feature of Rogue Wave JViews Maps: when you zoom the diagram in or out, more or less detailed bitmaps are loaded as needed according to the visible region.
The nodes of the diagram are georeferenced. That is, their positions are defined by the latitude and longitude properties instead of x and y. Rogue Wave JViews Maps is used to project these geographic locations onto coordinates on the screen.
The bridge between Rogue Wave JViews Diagrammer and Rogue Wave JViews Maps is the Map pluggable renderer provided by the SDM engine. To use a background map, all you have to do is activate this renderer (using the Designer is the easiest way), and specify the file that contains the map definition.
Instead of using the example map that is provided with this example, you can build your own map using the Map Builder application of Rogue Wave JViews Maps.
Note: You must have the Rogue Wave JViews Maps product installed to run this example, and you must have a valid license for that product.
Installation Directory
The Working with JViews Maps sample is installed here.
Classes Involved
-
ilog.views.sdm.renderer.maps.IlvMapRenderer
The pluggable renderer object that is the bridge between Rogue Wave JViews Diagrammer and Rogue Wave JViews Maps.
-
ilog.views.diagrammer.IlvDiagrammer
The main class of the diagram component.
-
ilog.views.diagrammer.application.IlvDiagrammerApplication
The predefined applet class for displaying diagrams.
Source Files
-
MapDiagrammerDemo
The entry point of the sample.