This tutorial series show you how to build your first 2D LuciadLightspeed application with a GXY view:

Goal

In this tutorial, we focus on making the map interactive.

Starting point

We take the code written in the Add vector data article as our starting point.

Using a controller to make the map interactive

For the creation of the map, we used the TLcdMapJPanel constructor. The constructor already installed an ILcdGXYController on the view, allowing users to use the mouse for navigation in the view.

Essentially, a controller interprets input events and translates them into actions that are performed on the view, or on the models it contains.

The default controller offers view navigation, selection and editing with the following navigation and selection configuration:

  • Dragging the left mouse button pans the view, unless a selected editable object is under the cursor.

  • Scrolling the mouse wheel zooms in and out on the cursor location.

  • Clicking the left mouse button selects a selectable object.

  • Dragging the left mouse button over one or more selectable objects while holding the Shift key selects the objects that are fully covered by the resulting selection rectangle.

  • Clicking the left mouse button over one or more selectable objects while holding the Alt key displays a pop-up menu. The menu allows you to indicate which object you want to select.

  • Clicking the left mouse button over a selectable object while holding the Shift key inverts the selection state of the object. An unselected object is selected, a selected object is de-selected.

  • Dragging the left mouse button while a selected object is under the cursor, moves the selected object.

  • Dragging the left mouse button on a handle of a selected object edits the object.

For this tutorial, we stick to the default controller. See Interacting with the view for more information about working with controllers.