Class ALcdTransformingModel
- All Implemented Interfaces:
ILcdModel,ILcdDisposable,Serializable,AutoCloseable
A model representing transformed data of an original model.
It uses a TLcdClusteringTransformer to perform the transformation.
As the data transformation can be time-consuming, it might take a while before the original model
and this transformed model are in sync.
For example when an element is added to the original model, the transformed model must recalculate the
transformation.
Only when recalculation is done, the elements of the transformed model are updated.
To ensure that the layer containing this model remains responsive, the transformation is calculated on
a dedicated thread.
Once the transformation is done, the transformed model is updated (under a write lock) on the painting thread.
This means that you should treat this ALcdTransformingModel just as you do any other ILcdModel:
- Making changes to this model require a write lock (see
TLcdLockUtil.writeLock(Object)). - Querying this model (including using the
originalToTransformed(Collection)andtransformedToOriginal(Collection)methods) requires a read lock (seeTLcdLockUtil.readLock(Object).
More information about the threading and locking rules of ILcdModel instances can be found in the
developer guide.
The asynchronous nature of the transformation implies that when ILcdMultiDimensionalModel.applyDimensionFilter(com.luciad.multidimensional.TLcdDimensionFilter, int)
is called on an implementation of this class that also implements ILcdMultiDimensionalModel,
- this model might not be up-to-date when the method returns
- the given event mode is not respected
Use TLcdTransformingModelFactory to create instances of this class.
- Since:
- 2016.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.luciad.model.ILcdModel
ILcdModel.Query -
Field Summary
Fields inherited from interface com.luciad.model.ILcdModel
FIRE_LATER, FIRE_NOW, NO_EVENT -
Method Summary
Modifier and TypeMethodDescriptionabstract ILcdModelReturns the model containing the original data on which theTLcdClusteringTransformeroperatesabstract Collection<Object> originalToTransformed(Collection<Object> aOriginalModelElements) Returns a collection containing the domain objects from thisALcdTransformingModelcorresponding to the objects from thegetOriginalModel()contained inaOriginalModelElementsabstract voidsetTransformer(TLcdClusteringTransformer aModelTransformer) Sets the transformer responsible from transforming data from the original model.abstract Collection<Object> transformedToOriginal(Collection<Object> aTransformedModelElements) Returns a collection containing the domain objects fromgetOriginalModel()corresponding to the objects from thisALcdTransformingModelcontained inaTransformedModelElementsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.util.ILcdDisposable
closeMethods inherited from interface com.luciad.model.ILcdModel
addElement, addElements, addModelListener, canAddElement, canRemoveElement, dispose, elementChanged, elements, elementsChanged, fireCollectedModelChanges, getModelDescriptor, getModelEncoder, getModelMetadata, getModelReference, query, removeAllElements, removeElement, removeElements, removeModelListener
-
Method Details
-
getOriginalModel
Returns the model containing the original data on which theTLcdClusteringTransformeroperates- Returns:
- the model containing the original data on which the
TLcdClusteringTransformeroperates
-
setTransformer
Sets the transformer responsible from transforming data from the original model.
- Parameters:
aModelTransformer- The transformer. Must not benull.
-
originalToTransformed
Returns a collection containing the domain objects from thisALcdTransformingModelcorresponding to the objects from thegetOriginalModel()contained inaOriginalModelElements- Parameters:
aOriginalModelElements- The elements of thegetOriginalModel()for which the corresponding elements must be retrieved- Returns:
- a collection containing the domain objects from this
ALcdTransformingModelcorresponding to the objects from thegetOriginalModel()contained inaOriginalModelElements. Nevernull, but might be empty (for example when those elements are filtered out).
-
transformedToOriginal
public abstract Collection<Object> transformedToOriginal(Collection<Object> aTransformedModelElements) Returns a collection containing the domain objects fromgetOriginalModel()corresponding to the objects from thisALcdTransformingModelcontained inaTransformedModelElements- Parameters:
aTransformedModelElements- The elements of thisALcdTransformingModelfor which the corresponding elements must be retrieved- Returns:
- a collection containing the domain objects from
getOriginalModel()corresponding to the objects from thisALcdTransformingModelcontained inaTransformedModelElements. Nevernull, but might be empty.
-