Documentation‎ > ‎

Lightweight or Heavyweight

JxMaps can work in two rendering modes: lightweight and heavyweight.

By default, heavyweight rendering mode is enabled, so when you create MapViewer instance using default constructor this mode is enabled automatically: 

MapView viewer = new MapView();

To create a new MapView instance with specified mode you have to use the MapViewOptions object: 

// Creates MapView instance with enabled lightweight rendering mode

MapViewOptions options = new MapViewOptions();

options.setComponentType(MapComponentType.LIGHTWEIGHT);

MapView mapView = new MapView(options);

 

// Creates MapView instance with enabled heavyweight rendering mode

MapViewOptions options = new MapViewOptions();

options.setComponentType(MapComponentType.HEAVYWEIGHT);

MapView mapView = new MapView(options);

Learn more about the differences between the lightweight and heavyweight rendering modes along with our recommendations about what rendering mode would fit your application better:

Lightweight

This mode indicates that MapView instance is working as a lightweight (off-screen) component. In this mode Chromium engine renders web page content off-screen and Java component just displays rendering results as an image, using standard Java Graphics API. In this mode GPU acceleration in Chromium engine isn't used. As a result, rendering performance isn't so good as with enabled GPU acceleration. It is recommended to configure MapView instance with this type in Java Swing/JavaFX applications where lightweight is the main requirement. For example, when transparent JPanel should be displayed over MapViewer component, or when MapView component is embedded into MapView or layered panels.

Heavyweight 

This mode indicates that MapView instance will be working as a heavyweight component. Heavyweight component represents a native window embedded into Java frame. In this mode, Chromium uses GPU acceleration to render web page content directly to native window embedded into Java frame window. Rendering performance, in this case, is the same as in Google Chrome. It is recommended to configure MapView instance with this type in Java applications where rendering performance is very critical. Since MapView represents a native heavyweight window embedded into Java application's frame, it's not recommended to display lightweight Swing/JavaFX components over heavyweight MapView component. The heavyweight MapView component will be always displayed over lightweight Swing/JavaFX components.