public class TLcdGXYViewFitAction extends ALcdAction implements ILcdAction
ILcdGXYLayer
s
fit into the containing ILcdGXYView
.
It can be triggered as follows:
actionPerformed(java.awt.event.ActionEvent)
or fit(com.luciad.view.gxy.ILcdGXYView)
. A single ILcdGXYLayer
is
chosen by the user
among those that belong to theILcdGXYView
.
fitGXYLayer(ILcdGXYLayer, ILcdGXYView, Rectangle)
or
fitGXYLayers(ILcdGXYLayer[], ILcdGXYView, java.awt.Rectangle)
. The latter allows fitting
on multiple layers and can be called from a background thread.TLcdFitGXYLayerInViewClipAction
.TLcdFitSelectionInViewClipAction
changeSupport
DEFAULT, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, VISIBLE
Constructor and Description |
---|
TLcdGXYViewFitAction()
Constructs an action to fit on a view, without setting the view.
|
TLcdGXYViewFitAction(boolean aRegisterInstance)
Deprecated.
use one of the constructors without the aRegisterInstance parameter.
|
TLcdGXYViewFitAction(ILcdGXYView aGXYView)
Constructs an action to fit on a view.
|
TLcdGXYViewFitAction(ILcdGXYView aGXYView,
boolean aRegisterInstance)
Deprecated.
use one of the constructors without the aRegisterInstance parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Chooses an
ILcdGXYLayer for the set view using chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView) and calls
fitGXYLayer . |
protected ILcdGXYLayer |
chooseGXYLayer(ILcdGXYView aGXYView)
Chooses an
ILcdGXYLayer among those that belongs to the
ILcdGXYView . |
void |
fit(ILcdGXYView aGXYView)
Chooses an
ILcdGXYLayer using chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView) and calls
fitGXYLayer(aGXYLayer, aGXYView) . |
protected void |
fitFromBoundedModel(ILcdBounded aBounded,
ILcdGXYLayer aGXYLayer,
ILcdGXYView aGXYView,
Rectangle aRectangleToFitInto)
This method is called by
fitGXYLayer(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle)
when fitting on a single layer whose model implements ILcdBounded . |
protected void |
fitFromGXYLayerBounds(ILcdGXYLayer aGXYLayer,
ILcdGXYView aGXYView,
Rectangle aRectangleToFitInto)
This is called by
fitGXYLayer(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle)
when fitting on a single layer whose model is not bounded. |
void |
fitGXYLayer(ILcdGXYLayer aGXYLayer,
ILcdGXYView aGXYView)
Calls
fitGXYLayer(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle) with a null rectangle. |
void |
fitGXYLayer(ILcdGXYLayer aGXYLayer,
ILcdGXYView aGXYView,
Rectangle aRectangleToFitInto)
Rescales and pans the view so that the objects in the given layer are visible in the view.
|
void |
fitGXYLayers(ILcdGXYLayer[] aGXYLayers,
ILcdGXYView aGXYView,
Rectangle aRectangleToFitInto)
Rescales and pans the view so that the objects in the layers are visible in the view.
|
String |
getDialogMessage()
Returns the message to use in
chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView) |
ILcdGXYView |
getGXYView()
Returns the view into which object representions will be fitted when invoking the action.
|
double |
getMaximumScaleOnBoundedPointModel()
Returns the scale to which the view should revert when fitting on a bounded model
(or an unbounded model with only bounded elements) whose bounds have zero width and height.
|
boolean |
isFitToChildren()
Returns whether the fit behavior should take child layers into account when fitting.
|
boolean |
isFitToMaximumScaleOnBoundedPointModel()
Returns whether a view should revert to
a predefined scale
when fitting on a bounded model (or an unbounded model with only bounded elements) with width and height equal to 0. |
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setDialogMessage(String aDialogMessage)
Sets the message to use in
chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView) |
void |
setExceptionHandler(ILcdExceptionHandler aExceptionHandler)
Handles the exceptions thrown when fitting to a layer failed.
|
void |
setFitToChildren(boolean aFitToChildren)
Sets whether the fit behavior should also take child layers into account when fitting on
layer tree nodes.
|
void |
setFitToMaximumScaleOnBoundedPointModel(boolean aFitToMaximumScaleOnBoundedPointModel)
Sets whether a view should revert to a predefined scale when fitting on a bounded model
(or an unbounded model with only bounded elements) with width and height equal to 0.
|
void |
setGXYView(ILcdGXYView aGXYView)
Sets the view into which object representions will be fitted when invoking the action.
|
void |
setMaximumScaleOnBoundedPointModel(double aMaximumScaleOnBoundedPointModel)
Sets the scale to which the view should revert when fitting on a bounded model
(or an unbounded model with only bounded elements) whose bounds have zero width and height.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, getValue, isEnabled, putValue, registerInstance, removePropertyChangeListener, setClassTraceOn, setDisplayName, setEnabled, setIcon, setLongDescription, setName, setShortDescription
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValue, isEnabled, putValue, setEnabled
addPropertyChangeListener, removePropertyChangeListener
public TLcdGXYViewFitAction()
setGXYView(ILcdGXYView)
public TLcdGXYViewFitAction(ILcdGXYView aGXYView)
aGXYView
- the view that should be fitted.public TLcdGXYViewFitAction(boolean aRegisterInstance)
aRegisterInstance
- whether or not to register this action as a Beanpublic TLcdGXYViewFitAction(ILcdGXYView aGXYView, boolean aRegisterInstance)
aRegisterInstance
- whether or not to register this action as a BeanaGXYView
- the view that should be fitted.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.setTraceOn
in class ALcdAction
aTraceOn
- if true then all log messages are recorded for this
instance. If false, then only the informative, warning and
error log messages are recorded.public boolean isTraceOn()
true
if tracing is enabled for this class.isTraceOn
in class ALcdAction
public ILcdGXYView getGXYView()
public void setGXYView(ILcdGXYView aGXYView)
aGXYView
- the view into which object representions will be fitted.public void actionPerformed(ActionEvent e)
ILcdGXYLayer
for the set view using chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView)
and calls
fitGXYLayer
.actionPerformed
in interface ActionListener
setGXYView(ILcdGXYView)
,
fit(com.luciad.view.gxy.ILcdGXYView)
public void fit(ILcdGXYView aGXYView)
ILcdGXYLayer
using chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView)
and calls
fitGXYLayer(aGXYLayer, aGXYView)
.aGXYView
- the view to fit and to select a layer from.chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView)
,
fitGXYLayers(com.luciad.view.gxy.ILcdGXYLayer[], com.luciad.view.gxy.ILcdGXYView, java.awt.Rectangle)
public void fitGXYLayer(ILcdGXYLayer aGXYLayer, ILcdGXYView aGXYView)
fitGXYLayer(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle)
with a null rectangle.aGXYLayer
- the layer to fit to.aGXYView
- the view to fit.fitGXYLayer(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle)
public void fitGXYLayer(ILcdGXYLayer aGXYLayer, ILcdGXYView aGXYView, Rectangle aRectangleToFitInto)
fitFromBoundedModel(com.luciad.shape.ILcdBounded, com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.ILcdGXYView, java.awt.Rectangle)
if the ILcdGXYLayer
's
ILcdModel
implements ILcdBounded
,
fitFromGXYLayerBounds(com.luciad.view.gxy.ILcdGXYLayer, com.luciad.view.gxy.ILcdGXYView, java.awt.Rectangle)
otherwise.
This method does not throw exceptions, but instead passes exceptions to the set
exception handler
.
This is done when it is impossible to fit on any of the layers passed to this method.
When it was only possible to fit on certain layers and not on all no
exception will be generated.aGXYLayer
- the layer to fit to.aGXYView
- the view to fit.aRectangleToFitInto
- a rectangle in view coordinates where to fit the representation of
all objects into. If null
, the view bounds are used.fitGXYLayers(com.luciad.view.gxy.ILcdGXYLayer[], com.luciad.view.gxy.ILcdGXYView, java.awt.Rectangle)
public double getMaximumScaleOnBoundedPointModel()
public void setMaximumScaleOnBoundedPointModel(double aMaximumScaleOnBoundedPointModel)
aMaximumScaleOnBoundedPointModel
- the new scale to revert to when a new scale could not be computed from the
models bounds.setFitToMaximumScaleOnBoundedPointModel(boolean)
public boolean isFitToMaximumScaleOnBoundedPointModel()
a predefined scale
when fitting on a bounded model (or an unbounded model with only bounded elements) with width and height equal to 0.public void setFitToMaximumScaleOnBoundedPointModel(boolean aFitToMaximumScaleOnBoundedPointModel)
aFitToMaximumScaleOnBoundedPointModel
- true to make the view revert to a predefined scale when
fitting on a bounded model with width and height equal to 0.0.setMaximumScaleOnBoundedPointModel(double)
public void setFitToChildren(boolean aFitToChildren)
aFitToChildren
- true if the children of the layers should also be taken into accountILcdLayerTreeNode
public boolean isFitToChildren()
protected void fitFromBoundedModel(ILcdBounded aBounded, ILcdGXYLayer aGXYLayer, ILcdGXYView aGXYView, Rectangle aRectangleToFitInto) throws TLcdNoBoundsException
fitGXYLayer(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle)
when fitting on a single layer whose model implements ILcdBounded
.
It changes the scale and the world origin of a view so that all objects of a layer with a ILcdBounded
model
are displayed in the view or in a rectangle of the view. If the bounded has width and height zero, the view will revert
to a predefined scale if isFitToMaximumScaleOnBoundedPointModel()
is true.aBounded
- the bounded object (model).aGXYLayer
- the layer for which the bounded is the model.aGXYView
- the view to fit.aRectangleToFitInto
- the rectangle to fit into.TLcdNoBoundsException
- when the layer could not be made entirely visible in the views world reference.public void fitGXYLayers(ILcdGXYLayer[] aGXYLayers, ILcdGXYView aGXYView, Rectangle aRectangleToFitInto)
ILcdBounded
,
and the layer bounds
otherwise.
This method does not throw exceptions, but instead passes exceptions to the set
exception handler
.
This is done when it is impossible to fit on any of the layers passed to this method.
When it was only possible to fit on certain layers and not on all no
exception will be generated.
This method can be invoked from a background thread as well as from the EDT thread.aGXYLayers
- the layers to fit tooaGXYView
- the view to fit.aRectangleToFitInto
- a rectangle in view coordinates where to fit the representation of
all objects into. If null
, the view bounds are used.isFitToMaximumScaleOnBoundedPointModel()
protected void fitFromGXYLayerBounds(ILcdGXYLayer aGXYLayer, ILcdGXYView aGXYView, Rectangle aRectangleToFitInto)
fitGXYLayer(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle)
when fitting on a single layer whose model is not bounded.
It changes the scale and the world origin of a view so that all objects of a layer are displayed in the view
or in a rectangle of the view. If the union of all object bounds has width and height zero,
the view will revert to a predefined scale if isFitToMaximumScaleOnBoundedPointModel()
is true.aGXYLayer
- the layer to fit on.aGXYView
- the view to fit.aRectangleToFitInto
- the rectangle to fit into.TLcdNoBoundsException
- when the layer could not be made entirely visible in the views world reference.public void setExceptionHandler(ILcdExceptionHandler aExceptionHandler)
aExceptionHandler
- clarifies why the fit action failed.fitFromGXYLayerBounds(ILcdGXYLayer, ILcdGXYView, java.awt.Rectangle)
,
isTraceOn()
protected ILcdGXYLayer chooseGXYLayer(ILcdGXYView aGXYView)
ILcdGXYLayer
among those that belongs to the
ILcdGXYView
.
It pops up a Dialog
with the set message
to allow the
user to choose one. This method can be redefined for specific needs.aGXYView
- the view to choose a layer from.fit(ILcdGXYView)
,
setDialogMessage(String)
public void setDialogMessage(String aDialogMessage)
chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView)
aDialogMessage
- to message to display to the user when choosing a layergetDialogMessage()
public String getDialogMessage()
chooseGXYLayer(com.luciad.view.gxy.ILcdGXYView)
setDialogMessage(java.lang.String)