This tutorial series show you how to build your first LuciadLightspeed application that loads data and allows you to navigate on a 2D/3D map:
Starting point
We take the code written in the Add vector data article as our starting point.
Using a controller to make the view interactive
Essentially, a controller interprets input events and translates them into actions that are performed on the view, or on the models it contains.
For the creation of the view, we used the TLspViewBuilder
.
That builder already installs a default ILspController
on the view for us.
This default controller is a chained controller that combines the behavior of several other LuciadLightspeed controllers. It offers view navigation, selection and editing with this navigation and selection configuration:
-
Dragging the left mouse button pans the view, unless a selected editable object is under the cursor.
-
Dragging the middle mouse button pans the view.
-
Dragging the right mouse button rotates the view.
-
Scrolling the mouse wheel zooms in and out on the cursor location.
-
Double-clicking the left mouse button starts a smooth, animated fly-to 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.
In 3D, the controller allows you to navigate around tall or airborne objects like air tracks easily, by moving around and toward the object under the mouse.
For this tutorial, we stick to the default controller. To learn how the chaining works in this controller, see Working with controllers.
See the documentation about Interacting with the view for more information about using controllers in general.