Perforce JViews Framework Code Example: Z-Ordering
Description
This sample shows how to use Z-Ordering inside a manager layer.
How to Use the Code Example
- The application displays a manager containing graphic objects within one manager layer.
- The quadtree and Z-ordering can be switched on or off.
- If the quadtree is enabled and you switch Z-ordering on, you can see how the drawing order changes.
- The labels of the objects show the index (or Z-order value) of the object within the manager layer.
- Right-click an object to open the object menu. You can move the object backward or forward in the Z-order, overlapped by more or by fewer objects. The menu operations have no effect if the Z-Ordering is disabled while the quadtree is enabled.
- If Z-Ordering is disabled and the quadtree is enabled, the drawing order of overlapping objects is undefined and it is impossible to specify which object is drawn on top of other objects. However, the drawing of objects is very fast.
- If Z-Ordering is enabled and the quadtree is enabled, the drawing order of overlapping objects is specified. Operations that influence the drawing order are fast. Drawing the objects is still fast, but not as fast as when Z-Ordering is disabled.
- If Z-Ordering is disabled and the quadtree is disabled, the drawing order of overlapping objects is specified, but all operations that influence the drawing order are relatively slow, and drawing a region of objects is relatively slow.
-
Buttons on the top of the application are used for the following:
- Sets the view in Pan mode. Pan the view by dragging the image.
- Sets Selection mode. Select, move, and edit objects.
- Zoom by selecting an area that should be magnified.
- Zoom in.
- Zoom out.
- Make the entire image visible.
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,
zordering.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
- Changing the drawing order by using Z-Ordering
- Enabling and disabling the quadtree
Installation Directory
The Z-Ordering code example is installed here.
Classes Involved
- ilog.views.IlvManagerLayer
- ilog.views.IlvIndexedSet
- ilog.views.IlvGraphic
- ilog.views.IlvGraphicEnumeration
- ilog.views.IlvApplyObject
- ilog.views.IlvManager
- ilog.views.IlvManagerView
- ilog.views.graphic.IlvZoomableLabel
- ilog.views.swing.IlvJScrollManagerView
- ilog.views.swing.IlvJManagerViewControlBar
- ilog.views.swing.IlvPopupMenuManager
- ilog.views.swing.IlvPopupMenuContext
- ilog.views.swing.IlvSimplePopupMenu