public final class TLcyGenericMapUtil extends Object
Utility class which provides methods to interact with a map or view, independent of the type of view.
The methods of this class should only be used on the view painting thread, and not on a background thread. In Lucy, the view painting thread is the Event Dispatch Thread.
Note: if you know the exact type of view, you should consider using a class designed for that specific view.
For example when you have a Lightspeed view,
you can use the methods in TLspViewNavigationUtil
to navigate the view instead of the utility methods in this class.
Compared to this class, the Lightspeed specific one TLspViewNavigationUtil
has much more customization options
and methods available.
Constructor and Description |
---|
TLcyGenericMapUtil(ILcyLucyEnv aLucyEnv)
Create a new utility class for the specified Lucy instance.
|
Modifier and Type | Method and Description |
---|---|
void |
centerOnBounds(ILcdView aView,
ILcdBounds aBounds,
ILcdGeoReference aReference)
Center
aView on the specified bounds. |
void |
centerOnObjects(ILcdView aView,
ILcdLayer aLayer,
Object... aDomainObjects)
Center
aView on all of the specified domain objects. |
void |
fitOnBounds(ILcdView aView,
ILcdBounds aBounds,
ILcdGeoReference aReference)
Fit
aView on the specified bounds. |
void |
fitOnObjects(ILcdView aView,
ILcdLayer aLayer,
Object... aDomainObjects)
Fit
aView on all of the specified domain objects. |
public TLcyGenericMapUtil(ILcyLucyEnv aLucyEnv)
aLucyEnv
- The Lucy back-end.public void centerOnObjects(ILcdView aView, ILcdLayer aLayer, Object... aDomainObjects) throws TLcdOutOfBoundsException, TLcdNoBoundsException
Center aView
on all of the specified domain objects.
Centering the view means moving the view to the middle of the specified data. This method does not zoom the view, so the scale will not be changed,
aView
- The view which will be centered on the specified domain objectsaLayer
- The layer containing all the domain objects.
The layer must be contained in aView
.aDomainObjects
- The domain objects on which the view must be centered.
Each of those objects must be contained in the model of aLayer
and calling ALcdBounds.fromDomainObject(Object)
on the object
should return valid bounds.TLcdOutOfBoundsException
- when centering on the given domain objects isn't possible, for instance
when the domain objects aren't visible in the current projection.TLcdNoBoundsException
- when calling ALcdBounds.fromDomainObject(Object)
on one of the domain objects
does not return valid bounds.public void fitOnObjects(ILcdView aView, ILcdLayer aLayer, Object... aDomainObjects) throws TLcdOutOfBoundsException, TLcdNoBoundsException
Fit aView
on all of the specified domain objects.
Fitting the view means moving and rescaling the view in such a way that all the specified data fits entirely in the given view.
aView
- The view which will be fit on the specified domain objectsaLayer
- The layer containing all the domain objects.
The layer must be contained in aView
.
If the layer is invisible, it will be made visible.aDomainObjects
- The domain objects on which the view must be fitted.
Each of those objects must be contained in the model of aLayer
and calling ALcdBounds.fromDomainObject(Object)
on the object
should return valid bounds.TLcdOutOfBoundsException
- when fitting on the given domain objects isn't possible, for instance
when the domain objects aren't visible in the current projection.TLcdNoBoundsException
- when calling ALcdBounds.fromDomainObject(Object)
on one of the domain objects
does not return valid bounds.public void centerOnBounds(ILcdView aView, ILcdBounds aBounds, ILcdGeoReference aReference) throws TLcdOutOfBoundsException
Center aView
on the specified bounds.
Centering the view means moving the view to the middle of the specified bounds. This method does not zoom the view, so the scale will not be changed.
aView
- The view which will be centered on the specified bounds.aBounds
- The bounds on which the view must be centered.aReference
- The reference of the specified bounds.TLcdOutOfBoundsException
- when centering on the given bounds isn't possible, for instance
when the bounds is not visible in the current projection.public void fitOnBounds(ILcdView aView, ILcdBounds aBounds, ILcdGeoReference aReference) throws TLcdOutOfBoundsException
Fit aView
on the specified bounds.
Fitting the view means moving and rescaling the view in such a way that the specified bounds fits entirely in the given view.
aView
- The view which will be fit on the specified bounds.aBounds
- The bounds on which the view must be fitted.aReference
- The reference of the specified bounds.TLcdOutOfBoundsException
- when fitting on the given bounds isn't possible, for instance
when the bounds is not visible in the current projection.