Perforce JViews Diagrammer Code Example: Topological Mesh Layout (Java SDK Version)
Description
This sample shows how to use the Topological Mesh Layout algorithm
in a Java application.
It shows how to perform a Topological Mesh Layout and how to control its
layout parameters in Java code.
This sample uses the graphic framework, but it does not use
the IlvDiagrammer
component or CSS.
How to Use the Code Example
- The Topological Mesh Layout (TML) algorithm can be used to lay out cyclic graphs, both planar and non-planar. Most of the time, if the graph is topologically symmetric, TML produces a symmetric drawing. For details, see the corresponding section of the User's Manual.
-
This application shows a manager view that displays a grapher read from an
IVL
file. You may change the grapher sample using the Select Graph list at the top of the application. - The application also has interactor buttons on the top of the window. They are: pan, select, zoom box, zoom in, zoom out, and show all (fit to contents).
-
On the bottom of the window there are two buttons:
- Random which performs a Random Layout.
- Layout which uses the Topological Mesh Layout algorithm.
How to Run the Code Example as an Application
This code example can
be run as an application.
The installation directory contains
an executable JAR file,
topologicalmeshlayout.jar
,
that allows you to execute the code example 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 code example 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 Perforce JViews.
Then, go to the installation directory
of the code example and type:
ant run
Topics Covered
- Grapher
- Graph Layout
- Topological Mesh Layout in Java Code
- Topological Mesh Layout Parameters
Installation Directory
The Topological Mesh Layout (Java SDK Version) code example is installed here.
Classes Involved
- ilog.views.graphlayout.topologicalmesh.IlvTopologicalMeshLayout
- ilog.views.graphlayout.random.IlvRandomLayout
- ilog.views.IlvGrapher
- ilog.views.IlvManagerView