Class TLcdMultilevelGridCoordinateModel

java.lang.Object
com.luciad.model.ALcdModel
com.luciad.view.map.multilevelgrid.TLcdMultilevelGridCoordinateModel
All Implemented Interfaces:
ILcd2DBoundsIndexedModel, ILcd2DBoundsInteractable, ILcdModel, ILcdBounded, ILcdDisposable, Serializable, AutoCloseable

public class TLcdMultilevelGridCoordinateModel extends ALcdModel implements ILcd2DBoundsIndexedModel
An ILcd2DBoundsIndexedModel implementation to contain ILcdMultilevelGridCoordinate objects. The internal structure of the model takes into account the structure of the ILcdMultilevelGrid with regard to which the multilevel grid coordinates are defined.

This ILcdModel implementation is not thread safe.

Since:
7.0
See Also:
  • Constructor Details

    • TLcdMultilevelGridCoordinateModel

      public TLcdMultilevelGridCoordinateModel(ILcdMultilevelGrid aMultilevelGrid, ILcdModelReference aModelReference)
      Constructs a multilevel model to contain ILcdMultilevelCoordinate which are defined with regard to the multilevel grid passed, which is based on the model reference passed.
      Parameters:
      aMultilevelGrid - the multilevel grid with regard to which the ILcdMultilevelCoordinate objects in the model should be interpreted. The multilevel grid cannot be null.
      aModelReference - the model reference on which the grid is based. This may be null, but it should be set using ALcdModel.setModelReference(com.luciad.model.ILcdModelReference) before this model is used anywhere.
  • Method Details

    • getMultilevelGrid

      public ILcdMultilevelGrid getMultilevelGrid()
      Returns the grid on which this model is based. Elements in this model should have valid coordinates with regard to this grid. The number of specified levels should be less than or equal to that of the grid and the coordinate on every axis and every level should be smaller than or equal to the number of divisions of the grid at that level and axis.
      Returns:
      the grid on which this model is based.
    • canAddElement

      public boolean canAddElement(Object aObject)
      Only ILcdMultilevelCoordinate implementations can be added to this model. This method also checks whether the coordinates comply to the grid on which this model is based.
      Specified by:
      canAddElement in interface ILcdModel
      Overrides:
      canAddElement in class ALcdModel
      Parameters:
      aObject - the object to check.
      Returns:
      true if the object passed implements ILcdMultilevelCoordinate, false otherwise.
    • elementsAtSFCT

      public void elementsAtSFCT(ILcdMultilevelGridCoordinate aMultilevelGridCoordinate, Vector aCollectedObjectsVector)
      Puts all the model elements which are in the model at the location of the multilevel coordinate passed. Only elements which are at exactly the same level are returned, not elements at higher or lower levels.
      Parameters:
      aMultilevelGridCoordinate - the location of the elements to look for, expressed as a multilevel coordinate.
      aCollectedObjectsVector - the vector to put the elements in.
    • canRemoveElement

      public boolean canRemoveElement(Object aObject)
      Always returns true. All objects may be removed from the model, there is no check whether the object is actually in the model.
      Specified by:
      canRemoveElement in interface ILcdModel
      Overrides:
      canRemoveElement in class ALcdModel
      Parameters:
      aObject - not take into account.
      Returns:
      always true.
    • removeElement

      public void removeElement(Object aObject, int aFireEventMode)
      Removes an object from the model and notifies the model listeners that the object was removed from the model.
      Specified by:
      removeElement in interface ILcdModel
      Overrides:
      removeElement in class ALcdModel
      Parameters:
      aObject - the object to remove from the grid. If the object was not part of the model, the model will not be adapted.
      aFireEventMode - indicates when or whether the listeners should be notified that an object was removed from the model. It should be one of ILcdFireEventMode.FIRE_LATER, ILcdFireEventMode.NO_EVENT, or ILcdFireEventMode.FIRE_NOW.
      See Also:
    • removeAllElements

      public void removeAllElements(int aFireEventMode)
      Clears the internal structure of the model and notifies the listeners that all elements have been removed.
      Specified by:
      removeAllElements in interface ILcdModel
      Overrides:
      removeAllElements in class ALcdModel
      Parameters:
      aFireEventMode - indicates when or whether the listeners should be notified that all objects were removed from the model. It should be one of ILcdFireEventMode.FIRE_LATER, ILcdFireEventMode.NO_EVENT, or ILcdFireEventMode.FIRE_NOW.
    • addElement

      public void addElement(Object aObject, int aFireEventMode)
      Adds a ILcdMultilevelCoordinate object to the model. If the object is not an ILcdMultilevelGridCoordinate object, it will not be added to the model.
      Specified by:
      addElement in interface ILcdModel
      Overrides:
      addElement in class ALcdModel
      Parameters:
      aObject - an ILcdMultilevelCoordinate to be added to the model. The coordinate should be valid with regard to the multilevel grid with which this model is constructed.
      aFireEventMode - indicates when or whether the listeners should be notified that an object was added to the model. It should be one of ILcdFireEventMode.FIRE_LATER, ILcdFireEventMode.NO_EVENT, or ILcdFireEventMode.FIRE_NOW.
      See Also:
    • applyOnInteract2DBounds

      public int applyOnInteract2DBounds(ILcdBounds aBounds, boolean aStrictInteract, ILcdFunction aFunction, double aPrecisionX, double aPrecisionY)
      Applies a given function to all elements in this model that interact with the given model bounds.
      Specified by:
      applyOnInteract2DBounds in interface ILcd2DBoundsIndexedModel
      Parameters:
      aBounds - all grid elements interacting with this model bounds will be passed to the function passed.
      aStrictInteract - if set to false the model is checked at the highest level, precision is not taken into account. All objects of elements at the highest level that overlap with the bounds and all objects of all their children are passed to the function.
      aFunction - the function to apply to all objects in the model which are found to interact with the given bounds. A return value false acts as a stop condition.
      aPrecisionX - only taken into account when strict interaction is wanted, otherwise all objects contained in the top level grid elements that interact with the bounds and their children are passed to the function.
      aPrecisionY - only taken into account when strict interaction is wanted, otherwise all objects contained in the top level grid elements that interact with the bounds and their children are passed to the function.
      Returns:
      the number of objects passed to the function.
    • applyOnInteract2DBounds

      public int applyOnInteract2DBounds(ILcdBounds aBounds, boolean aStrictInteract, ILcdFunction aFunction, double aPrecisionX, double aPrecisionY, double aMinSizeX, double aMinSizeY, boolean aIncludePoints)
      Calls applyOnInteract2DBounds without the 3 last parameters.
      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()
      Returns the bounds of the grid on which this model is based.
      Specified by:
      getBounds in interface ILcdBounded
      Returns:
      the bounds of the grid on which this model is based.
      See Also:
    • elements

      public Enumeration elements()
      Returns all elements contained in this model, in no specific order.
      Specified by:
      elements in interface ILcdModel
      Returns:
      all elements contained in this model, in no specific order.
    • elementChanged

      public void elementChanged(Object aObject, int aFireEventMode)
      Updates the internal structure to the change of the object passed and notifies the model listeners.
      Specified by:
      elementChanged in interface ILcdModel
      Overrides:
      elementChanged in class ALcdModel
      Parameters:
      aObject - the object that has changed. Note that an object that is not in the model will not influence the model.
      aFireEventMode - indicates when or whether the listeners should be notified that an element in the model has changed. It should be one of ILcdFireEventMode.FIRE_LATER, ILcdFireEventMode.NO_EVENT, or ILcdFireEventMode.FIRE_NOW.
    • elementsChanged

      public void elementsChanged(Vector aVector, int aFireEventMode)
      Updates the internal structure to the changes of the objects passed and notifies the model listeners.
      Specified by:
      elementsChanged in interface ILcdModel
      Overrides:
      elementsChanged in class ALcdModel
      Parameters:
      aVector - contains all elements that have changed.
      aFireEventMode - indicates when or whether the listeners should be notified that an elements in the model has changed. It should be one of ILcdFireEventMode.FIRE_LATER, ILcdFireEventMode.NO_EVENT, or ILcdFireEventMode.FIRE_NOW.
    • allElementsChanged

      public void allElementsChanged(int aFireEventMode)
      Updates the structure for all elements and notifies the listeners that all elements in this model have changed. This method calls elementsChanged(java.util.Vector, int) with all objects in the model. If not all objects have changed, call elementsChanged with the objects that have changed to avoid unnecessary checks of the models structure.
      Overrides:
      allElementsChanged in class ALcdModel
      Parameters:
      aFireEventMode - indicates when or whether the listeners should be notified that all elements in the model have changed. It should be one of ILcdFireEventMode.FIRE_LATER, ILcdFireEventMode.NO_EVENT, or ILcdFireEventMode.FIRE_NOW.