JMap Server Lima
JMap Server SDK
JMap Server SDK
  • Welcome to JMap Server SDK
  • General Concepts
  • JMap Pro and JMap Server Development
    • JMap Pro
      • Class Model
      • Map Elements
      • Coordinate Systems
      • Views and View Manager
      • Layers and Layer Manager
      • JMap Pro Application
      • Client-Server Communication
      • List of GUI Components
      • JMap Tools
      • JMap Pro Extensions
      • Integrating JMap Pro With Other Applications
      • References
    • JMap Server
      • JMap Server Extensions
    • JMap 7 API
    • JMap Pro Extension Builder
  • JMap Web Development
    • JMap Web Extensions
      • Programming JMap Web extensions
      • Sending Server Requests and Custom Actions
      • Default JMap Web Actions
      • Deploying JMap Web Extensions
    • Embedding a JMap Web Deployment Into Your own Application
Propulsé par GitBook

K2 Geospatial 2024

Sur cette page
  • View class
  • Events of the View class
  • ViewState class
  • ViewManager class
  • Events of the ViewManager class
  • ViewUtil class
Exporter en PDF
  1. JMap Pro and JMap Server Development
  2. JMap Pro

Views and View Manager

PrécédentCoordinate SystemsSuivantLayers and Layer Manager

Dernière mise à jour il y a 7 mois

View class

In JMap, the class is the main GUI component responsible for displaying the map. The methods of this class allow you to control the map (zoom, pan, etc.), to refresh it, to get information on the scale, etc.

The table below shows the main methods of the class.

Navigation

Performs a zoom at the map centre using the specified magnifying factor. For example, a factor of 2 will display a map that is two times closer. A value of 0.5 will produce a map that is two times farther. The map must be refreshed afterwards.

Pans and zooms the map around the specified rectangle. The map must be refreshed afterwards.

Pans and zooms the map to show the entire area covered by the data. The map must be refreshed afterwards.

Makes the specified coordinates the new centre of the map view. The scale is not affected.The map must be refreshed afterwards.

Makes the specified coordinates the new centre of the map view. The scale is not affected. The map must be refreshed afterwards.

Moves the map based on the x and y values specified in screen coordinates (DC). The map must be refreshed afterwards.

Modifies the map scale based on the specified value. The map must be refreshed afterwards.

Display

Refreshes the map. After any method modifying the state of the map is called, the map must be refreshed in order to display the changes.

Adds a marker (symbol indicating a location) at the specified coordinates with the specified message and style.

Removes the specified marker from the map.

Removes all markers from the map.

Returns the view bounds to screen coordinates (DC).

Returns the view bounds to world coordinates (WC).

Returns the view transformation. This is the transformation used to convert Screen Cooordinates (DC) to World Coordinates (WC) and vice-versa.

Returns the view overlay. The overlay is a special layer designed to display volatile data. It is often used to create smooth animations (moving objects, drawing, etc.).

Returns the current scale factor of the view as the denominator (1: denominator).

Returns the current horizontal distance of the view in world coordinates (WC).

Other

Removes an action from the view’s pop-up menu.

Removes an item from the view’s pop-up menu.

Adds an action to the view’s pop-up menu.

Adds an item to the view’s pop-up menu.

Registers a listener to the events generated by the view.

Removes a listener from the events generated by the view.

Replaces the active tool of the view with the tool specified as a parameter.

Events of the View class

In JMap, a view generates events in several situations. To get these events, you must register a listener to the view. To get events generated by all open views, it is recommended to register a listener on the View Manager. Read below for more information on this subject.

View view = ...

view.addViewEventListener(new ViewEventListener()

{

@Override

public void viewToolChangedOccurred(ViewToolChangedEvent e)

{

}

...

});

Launched after the view's state changes following a navigation operation (zoom, pan, etc.).

Launched when the active tool of the view is replaced by another tool.

Launched when the view is redrawn, in whole or in part. The elements of the layers are redrawn.

Launched when the view is repainted, in whole or in part. The image of the map is simply refreshed; the elements of the layers are not redrawn.

Launched when static elements (north arrow, scale bar, etc.) are added to or removed from the view.

Launched just before the pop-up menu of the view is displayed. Allows you to change the contents of the menu before it is presented to the user.

Launched when the view becomes ready for use, i.e. after the first time it is displayed.

ViewState class

ViewManager class

Registers a listener to the events triggered by the active view.

Registers a listener to the events triggered by the view manager (see below).

Returns the active view (i.e. the view that is in focus).

Return the layer manager of the active view.

Returns the view with the name specified as a parameter.

Returns a list of all existing views in the view manager.

Performs a refresh action on all existing views in the view manager.

Removes a listener from the events triggered by the active view of the view manager.

Removes a listener from the events triggered by the view manager.

Replaces the active tool of the active view with the tool specified as a parameter.

Events of the ViewManager class

View view = ...

ViewManager viewManager = view.getLayerManager();

viewManager.addViewManagerEventListener(new ViewManagerEventListener()

{

@Override

public void viewAdded(ViewAddedEvent e)

{

}

...

});

Launched when a view is added to the View Manager.

Launched when a view is activated (i.e. comes into focus).

Launched when a view has been deactivated (i.e. it has lost focus in favour of another view).

Launched when a view is removed from the View Manager.

ViewUtil class

Produces and returns an image of the map as displayed in the view. The width (in pixels) of the image to be created is passed as a parameter.

Saves an image of the map on the hard drive. A window displays, allowing the user to select the location of the file.

Returns the instance of the class associated with this view. See below for more information on this topic.

Returns the instance associated with the view.

Returns the map projection () of the data on the map.

Returns the unit () of the data on the map.

To receive a view’s events, you must implement the interface and register it with the view using the method, as shown in the example below.

Note that the adapter can also be used to simplify the development of a listener.

The table below shows the events triggered by the class.

For more information on events in Java, see the .

The class contains some view properties that define its state at a given time (scale, scope, transformation, etc.). Several methods in the JMap API take an instance of ViewState as a parameter. It is possible to get the state of a view by calling the method of the class.

The view manager ( class) is responsible for managing one or more views that are present in the application. This class has methods that allow you to perform operations on all the views of the application and to know at any time which view is active (i.e. in focus).

The table below shows the main methods of the class.

The View Manager triggers events associated with the state of its views. To get these events, you must implement the interface and register it with the view manager using the method, as shown in the following example.

Note that the adapter can also be used to simplify the development of a listener.

The table below shows the events triggered by the class.

It is also possible to register a listener to the View Manager to get the events generated by all the views associated with the layer manager. This may be more convenient than registering a listener on each view separately. To do so, use the method of the class.

The class provides useful methods to work with the view.

The table below shows the mains methods of the class.

Sends an image of the map by email to the recipients defined in the type object passed as a parameter.

View
View
ViewEventListener
addViewEventListener()
ViewAdapter
View
Java Tutorial
ViewState
getViewState()
View
ViewManager
ViewManager
ViewManagerEventListener
addViewManagerEventListener()
ViewManagerAdapter
ViewManager
addViewEventListener
ViewManager
ViewUtil
ViewUtil
zoom(double)
zoom(Rectangle)
zoomExtent()
moveTo(double, double)
moveTo(Point)
pan(int, int)
setScale(double)
refresh()
addMarker(Point, String, Style)
removeMarker(long)
clearMarkers()
getDCViewBounds()
getWCViewBounds()
getTransform()
getViewOverlay()
getScaleFactor()
getViewState()
ViewState
getZoomLevel()
getLayerManager()
LayerManager
getMapProjection()
Projection
getMapUnit()
JMapUnit
removePopupMenuAction(Action)
removePopupMenuItem(JMenuItem)
addPopupMenuAction(Action)
addPopupMenuItem(JMenuItem)
addViewEventListener(ViewEventListener)
removeViewEventListener(ViewEventListener)
setCurrentTool(Tool)
viewChangedOccurred (ViewChangedEvent)
viewToolChangedOccurred (ViewToolChangedEvent)
viewRedrawOccurred (ViewRedrawEvent)
viewRepaintOccurred (ViewRepaintEvent)
viewStaticElementChanged (ViewStaticElementEvent)
viewPopupMenuShowing(ViewPopupMenuShowingEvent)
viewReadyOccurred(ViewReadyEvent)
addViewEventListener(ViewEventListener)
addViewManagerEventListener(ViewManagerEventListener)
getActiveView()
getLayerManager()
getView(String)
getViews()
refresh()
removeViewEventListener(ViewEventListener)
removeViewManagerEventListener(ViewManagerEventListener)
setCurrentTool(Tool)
viewAdded(ViewAddedEvent)
viewActivated (ViewActivatedEvent)
viewDeactivated (ViewDeactivatedEvent)
viewRemoved(ViewRemovedEvent)
mailMap(View, JMapSrvConnection, int, MailMessage)
MailMessage
makeImage(View, int)
saveAs(View)