Class TLcd2DBoundsIndexedModelList

java.lang.Object
com.luciad.model.ALcdModel
com.luciad.model.TLcdModelList
com.luciad.model.TLcd2DBoundsIndexedModelList
All Implemented Interfaces:
ILcd2DBoundsIndexedModel, ILcd2DBoundsInteractable, ILcdModel, ILcdModelContainer, ILcdModelProducerListener, ILcdBounded, ILcdLockDependent, ILcdDisposable, Serializable, AutoCloseable, EventListener

public class TLcd2DBoundsIndexedModelList extends TLcdModelList implements ILcd2DBoundsIndexedModel
A TLcdModelList that also implements ILcd2DBoundsIndexedModel.

Only models which implements ILcd2DBoundsIndexedModel can be added to this model.

The spatial-access methods of this model list preserve the order of the submodels: the function to be applied is first applied to the first submodel, then to the second submodel, etcetera.

This model is typically used to decode and represent tiled data: each tile can be decoded into a separate ILcd2DBoundsIndexedModel, and all these tile models can be merged together into a TLcd2DBoundsIndexedModelList. This approach also works well with lazily-loaded datasets, where each tile is stored in a TLcdSoft2DBoundsIndexedModel.

See Also:
  • Constructor Details

    • TLcd2DBoundsIndexedModelList

      public TLcd2DBoundsIndexedModelList()
      Constructs a new, empty TLcd2DBoundsIndexedModelList list with a default TLcdEditableModelListDescriptor.
    • TLcd2DBoundsIndexedModelList

      public TLcd2DBoundsIndexedModelList(ILcdModelDescriptor aModelDescriptor)
      Constructs a new, empty TLcd2DBoundsIndexedModelList, initialized with the specified model descriptor.
      Parameters:
      aModelDescriptor - a model descriptor for this model list.
  • Method Details

    • addModel

      public boolean addModel(ILcdModel aModel)
      Adds the specified model to this model list, without a filter.

      This implementation only accepts models which implement ILcd2DBoundsIndexedModel.

      Specified by:
      addModel in interface ILcdModelContainer
      Overrides:
      addModel in class TLcdModelList
      Parameters:
      aModel - the model to be added
      Returns:
      true if this collection of models changed as a result of the call
      Throws:
      IllegalArgumentException - if the specified model cannot be added to this model list (!canAddModel(aModel)).
    • addModel

      public boolean addModel(ILcdModel aModel, ILcdFilter aObjectInModelFilter)
      Adds the specified model to this model list. The specified filter should only accept objects which are in the model.

      This implementation only accepts models which implement ILcd2DBoundsIndexedModel.

      Overrides:
      addModel in class TLcdModelList
      Parameters:
      aModel - the model to be added.
      aObjectInModelFilter - a filter that returns true for objects which are contained in the model, false otherwise.
      Returns:
      true if this collection of models changed as a result of the call
      Throws:
      IllegalArgumentException - if the specified model cannot be added to this model list (!canAddModel(aModel).
    • canAddModel

      public boolean canAddModel(ILcdModel aModel)
      Returns true if the specified model can be added to this list, false otherwise. A model can only be added if either:

      Additionally, this implementation requires that each model implements ILcd2DBoundsIndexedModel.

      Overrides:
      canAddModel in class TLcdModelList
      Parameters:
      aModel - the model to be added to this model list.
      Returns:
      true if the specified model can be added to this list, false otherwise.
    • applyOnInteract2DBounds

      public int applyOnInteract2DBounds(ILcdBounds aBounds, boolean aStrictInteract, ILcdFunction aFunction, double aPrecisionX, double aPrecisionY)
      Description copied from interface: ILcd2DBoundsIndexedModel
      Applies the specified function to all the model elements of which the 2D bounds overlap with the specified bounds. By default, the order in which the function is applied on the elements is unspecified and depends on the implementation.

      The return value of the specified function is used as a stop criterion: the spatial query is interrupted if the function returns false.

      Specified by:
      applyOnInteract2DBounds in interface ILcd2DBoundsIndexedModel
      Parameters:
      aBounds - the rectangle to test overlap with.
      aStrictInteract - if false, the spatial search may return more elements than the ones strictly overlapping; if true, the search only returns the elements that are overlapping. The latter mode is more precise, but it may be slower.
      aFunction - the function to apply on each element that overlaps with the given bounds. The return value of the specified function is used as a stop criterion: the spatial query is interrupted if the function returns false.
      aPrecisionX - the precision required in the x dimension, expressed in model units. For example, for a cartesian grid system expressed in meters, the values should be expressed in meters as well, for a geodetic coordinate system the accuracy values should be expressed in degrees.

      The precision is useful in combination with multi-leveled data (multiple representations of the same object, but with varying accuracy), so that the most appropriate accuracy level can be used. 0 means best possible accuracy, but it might trigger lazy-loaded implementations to load lots of data.

      aPrecisionY - the precision required in the y dimension, expressed in model units.
      Returns:
      the number of elements to which the ILcdFunction has been applied.
    • applyOnInteract2DBounds

      public int applyOnInteract2DBounds(ILcdBounds aBounds, boolean aStrictInteract, ILcdFunction aFunction, double aPrecisionX, double aPrecisionY, double aMinSizeX, double aMinSizeY, boolean aIncludePoints)
      Description copied from interface: ILcd2DBoundsInteractable
      Applies the specified function to all the elements of which the 2D bounds overlap with the specified bounds. The order in which the function is applied on the elements is unspecified and depends on the implementation.

      Only elements that have at least the specified minimal size in the x dimension or in the y dimension are considered. This can be useful for quickly eliminating elements that are too small to be visible in a view, for instance. If required, an exception can be made for point elements, which have a size of 0 by 0. They can be forced to be considered, even though they would always be rejected as being too small for any sizes larger than 0.

      The return value of the specified function is used as a stop criterion: the spatial query will be interrupted as soon as the function returns false for an element it was applied on.

      Specified by:
      applyOnInteract2DBounds in interface ILcd2DBoundsIndexedModel
      Specified by:
      applyOnInteract2DBounds in interface ILcd2DBoundsInteractable
      Parameters:
      aBounds - the rectangle to test overlap with.
      aStrictInteract - if false, the spatial search may return more elements than the ones strictly overlapping; if true, the search only returns the elements that are overlapping. The latter mode is more precise, but it may be slower.
      aFunction - the function to apply on each element that overlaps with the given bounds.
      aPrecisionX - the precision required in the x dimension, expressed in model units. For example, for a cartesian grid system expressed in meters, the values should be expressed in meters as well, for a geodetic coordinate system the accuracy values should be expressed in degrees.

      The precision is useful in combination with multi-leveled data (multiple representations of the same object, but with varying accuracy), so that the most appropriate accuracy level can be used. 0 means best possible accuracy, but it might trigger lazy-loaded implementations to load lots of data.

      aPrecisionY - the precision required in the y dimension, expressed in model units.
      aMinSizeX - the minimal element size in the x dimension (as in ILcdBounds.getWidth()), expressed in model units. Elements that are smaller than this size will be skipped. This may, for example, be useful when improving the efficiency of painting elements by skipping elements that are smaller than some threshold (e.g. one pixel, converted to model units).
      aMinSizeY - the minimal element size in the y dimension (as in ILcdBounds.getHeight()), expressed in model units.
      aIncludePoints - if true, zero-sized elements (points) are considered as well, even though they might be smaller than the minimum size.
      Returns:
      the number of elements to which the ILcdFunction has been applied.
    • getBounds

      public ILcdBounds getBounds()
      Description copied from interface: ILcdBounded
      Returns the ILcdBounds by which the geometry of this ILcdBounded object is bounded.

      If the geometry does not allow retrieving valid bounds (for example a polyline with 0 points) the return value is unspecified. It is highly recommended to return an undefined bounds. You can create undefined bounds using the default constructors of TLcdLonLatBounds or TLcdXYBounds.

      Specified by:
      getBounds in interface ILcdBounded
      Returns:
      the ILcdBounds by which the geometry of this ILcdBounded object is bounded.