Compass

The Compass bean is represented by the IlvJCompass class. This bean displays a compass indicating the geographic or cartographic north of the map.
An example of the Compass is shown in Multithread Monitor .
compass.png
Compass

Including the bean in an application

To include the Compass bean in your application, write the following lines of code:
IlvJCompass compass = new IlvJCompass();
compass.setView(view);
The Compass bean then listens to view transformation changes, and check the rotation value to display north direction.

Customizing the appearance

You can customize many parts displayed on the compass such as:
  • The appearance of the compass needle:
    compass.setCartographicNeedleStyle(IlvCompass.NEEDLE_STYLE_CROSS);
    
  • The colors used:
    compass.setCartographicBackground(Color.blue);
    compass.setCartographicForeground(Color.gray);