To let the user focus on specific data displayed in the view, you often have to shift the view to the world area containing the data. This is called fitting the view.
LuciadLightspeed offers functionality to fit the view on the data in a layer or on some pre-defined bounds. For example,
TLspViewNavigationUtil.fit() to navigate to specific bounds shows you how to fit the view on specific bounds.
TLspViewNavigationUtil.fit()to navigate to specific bounds
TLspViewNavigationUtil navigationUtil = new TLspViewNavigationUtil(view); navigationUtil.fit(new TLcdLonLatBounds( -180, -90, 360, 180 ), new TLcdGeodeticReference());
TLspViewNavigationUtil.animatedFit() offers similar functionality. Instead of initiating a jump to the new state, it starts an animation to move fluidly from
the current state to the fitted state. Program: Using animated fit to navigate to a specific layer demonstrates this:
TLspViewNavigationUtil navigationUtil = new TLspViewNavigationUtil(view); navigationUtil.animatedFit(Collections.singletonList(layer));
By default, animations start automatically.
To center the view to the middle of a set of layer data or bounds without zooming and re-scaling the view, you can call the
You could also use the various