Class TLcdGXYViewMeasureProvider
This class retrieves measures of the layers in a GXY view. The default behavior retrieves the topmost measures for every type of measure.
It is possible to configure this measure provider with model measure provider factories or layer measure provider factories. Both are optional, so it is possible to create a view measure provider based on model measure provider factories only, layer measure provider factories only, or both. In the latter case, the model measure provider factories are used as a fallback for the layer measure provider factories.
This class properly handles asynchronous layer wrappers. It makes sure that asynchronous layers are unwrapped
safely. Delegate ILcdLayerMeasureProviderFactory
don't need to handle asynchronous layer wrappers when
using this class.
This class is thread safe, as long as the given ILcdModelMeasureProviderFactory
instances are thread safe, and as long as they produce ALcdMeasureProvider
instances that
are thread safe. Note that TLcdGXYViewMeasureProvider
instances should always be
created on the EDT thread.
Note that LuciadLightspeed uses a more specific API for height values:
TLcdViewHeightProvider
.
- Since:
- 2013.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Callback class that is used to return measure results when using theretrieveMeasuresAt
method.static enum
Sets the sample density to use when no sample density is specified in theParameters
(Double.isNan(
).getSampleDensity
) == trueNested classes/interfaces inherited from class com.luciad.util.measure.ALcdMeasureProvider
ALcdMeasureProvider.Parameters
-
Constructor Summary
ConstructorDescriptionTLcdGXYViewMeasureProvider
(ILcdGXYView aView, Iterable<? extends ILcdModelMeasureProviderFactory> aMeasureProviderFactories) Creates a new measure provider for the given view, using the given collection of model measure provider factories.TLcdGXYViewMeasureProvider
(ILcdGXYView aView, Iterable<? extends ILcdModelMeasureProviderFactory> aModelMeasureProviderFactories, Iterable<? extends ILcdLayerMeasureProviderFactory> aLayerMeasureProviderFactories) Creates a new measure provider for the given view, using the given collections of model and layer measure provider factories. -
Method Summary
Modifier and TypeMethodDescriptionReturns the default sample density.boolean
Returns whether to retrieve only the topmost measures of every measure type.retrieveMeasuresAt
(ILcdPoint aPoint, ILcdModelReference aPointReference, ALcdMeasureProvider.Parameters aParameters) This method retrieves the measures at the given point.void
retrieveMeasuresAt
(ILcdPoint aPoint, ILcdModelReference aPointReference, ALcdMeasureProvider.Parameters aParameters, TLcdGXYViewMeasureProvider.Callback aCallback) This method retrieves the measures at the given point, and does not block the calling thread when handling asynchronous layers.void
setDefaultSampleDensity
(TLcdGXYViewMeasureProvider.DefaultSampleDensity aDefaultSampleDensity) Sets the default sample density to use when no sample density is specified in theParameters
object passed to theretrieveMeasuresAt
method (Double.isNan(
).getSampleDensity
) == truevoid
setRetrieveTopMostMeasures
(boolean aRetrieveTopMostMeasures) Sets whether to retrieve only the topmost measures of every measure type.
-
Constructor Details
-
TLcdGXYViewMeasureProvider
public TLcdGXYViewMeasureProvider(ILcdGXYView aView, Iterable<? extends ILcdModelMeasureProviderFactory> aMeasureProviderFactories) Creates a new measure provider for the given view, using the given collection of model measure provider factories.- Parameters:
aView
- the view.aMeasureProviderFactories
- a collection of model measure provider factories. Can benull
.
-
TLcdGXYViewMeasureProvider
public TLcdGXYViewMeasureProvider(ILcdGXYView aView, Iterable<? extends ILcdModelMeasureProviderFactory> aModelMeasureProviderFactories, Iterable<? extends ILcdLayerMeasureProviderFactory> aLayerMeasureProviderFactories) Creates a new measure provider for the given view, using the given collections of model and layer measure provider factories. Both are optional, and can benull
. See class doc for more information.- Parameters:
aView
- the view for which measures are retrieved.aModelMeasureProviderFactories
- a collection of model measure provider factories. Can benull
.aLayerMeasureProviderFactories
- a collection of layer measure provider factories. Can benull
.
-
-
Method Details
-
isRetrieveTopMostMeasures
public boolean isRetrieveTopMostMeasures()Returns whether to retrieve only the topmost measures of every measure type.- Returns:
- true if, for every measure type, only the topmost measure is returned. false if all measures of all layers are returned.
- See Also:
-
setRetrieveTopMostMeasures
public void setRetrieveTopMostMeasures(boolean aRetrieveTopMostMeasures) Sets whether to retrieve only the topmost measures of every measure type.- Parameters:
aRetrieveTopMostMeasures
- if true, for every measure type, only the topmost measure is returned. If false, all measures of all layers are returned.- See Also:
-
getDefaultSampleDensity
Returns the default sample density.- Returns:
- the default sample density.
- See Also:
-
setDefaultSampleDensity
public void setDefaultSampleDensity(TLcdGXYViewMeasureProvider.DefaultSampleDensity aDefaultSampleDensity) Sets the default sample density to use when no sample density is specified in the
Parameters
object passed to theretrieveMeasuresAt
method (Double.isNan(
).getSampleDensity
) == trueThe default is
VIEW_SAMPLE_DENSITY
.- Parameters:
aDefaultSampleDensity
- the default sample density.- See Also:
-
retrieveMeasuresAt
public TLcdISO19103Measure[] retrieveMeasuresAt(ILcdPoint aPoint, ILcdModelReference aPointReference, ALcdMeasureProvider.Parameters aParameters) This method retrieves the measures at the given point.Note that calling this method may block the EDT thread when using asynchronous painting. This can be avoided by using the
retrieveMeasuresAt
method that takes a Callback as argument.- Specified by:
retrieveMeasuresAt
in classALcdMeasureProvider
- Parameters:
aPoint
- the point for which to retrieve measures.aPointReference
- the reference in whichaPoint
is defined.aParameters
- the parameters.- Returns:
- an array with the found measurements, or an empty array if no measure was found
-
retrieveMeasuresAt
public void retrieveMeasuresAt(ILcdPoint aPoint, ILcdModelReference aPointReference, ALcdMeasureProvider.Parameters aParameters, TLcdGXYViewMeasureProvider.Callback aCallback) This method retrieves the measures at the given point, and does not block the calling thread when handling asynchronous layers. The resulting measures are passed to the given callback. This method may only be called on the EDT thread.- Parameters:
aPoint
- the point for which to retrieve measures.aPointReference
- the reference in whichaPoint
is defined.aParameters
- the parameters.aCallback
- the callback used to return the resulting measures. Must not benull
.
-