public class TLcdMultilevelGridCoordinateModel extends ALcdModel implements ILcd2DBoundsIndexedModel
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.
ILcdModel.Query
fModelEventSupport
FIRE_LATER, FIRE_NOW, NO_EVENT
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
void |
addElement(Object aObject,
int aFireEventMode)
Adds a
ILcdMultilevelCoordinate object to the model. |
void |
allElementsChanged(int aFireEventMode)
Updates the structure for all elements and notifies the listeners that all elements in this model have changed.
|
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.
|
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.
|
boolean |
canAddElement(Object aObject)
Only
ILcdMultilevelCoordinate implementations can be added to this model. |
boolean |
canRemoveElement(Object aObject)
Always returns true.
|
void |
elementChanged(Object aObject,
int aFireEventMode)
Updates the internal structure to the change of the object passed and notifies the model listeners.
|
Enumeration |
elements()
Returns all elements contained in this model, in no specific order.
|
void |
elementsAtSFCT(ILcdMultilevelGridCoordinate aMultilevelGridCoordinate,
Vector aCollectedObjectsVector)
Puts all the model elements which are in the model at the location of the multilevel coordinate passed.
|
void |
elementsChanged(Vector aVector,
int aFireEventMode)
Updates the internal structure to the changes of the objects passed and notifies the model listeners.
|
ILcdBounds |
getBounds()
Returns the bounds of the grid on which this model is based.
|
ILcdMultilevelGrid |
getMultilevelGrid()
Returns the grid on which this model is based.
|
void |
removeAllElements(int aFireEventMode)
Clears the internal structure of the model and notifies the listeners that all elements have been removed.
|
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.
|
addElements, addModelListener, allElementsRemoved, dispose, elementAdded, elementRemoved, elementsAdded, elementsRemoved, fireCollectedModelChanges, getModelDescriptor, getModelEncoder, getModelMetadata, getModelReference, initializeTransientValues, isClassTraceOn, isTraceOn, removeElements, removeModelListener, setClassTraceOn, setModelDescriptor, setModelDisposer, setModelEncoder, setModelMetadataFunction, setModelReference, setTraceOn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
query
addElements, addModelListener, all, dispose, filter, fireCollectedModelChanges, getModelDescriptor, getModelEncoder, getModelMetadata, getModelReference, removeElements, removeModelListener
close
public TLcdMultilevelGridCoordinateModel(ILcdMultilevelGrid aMultilevelGrid, ILcdModelReference aModelReference)
ILcdMultilevelCoordinate
which are defined with regard to
the multilevel grid passed, which is based on the model reference passed.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.public ILcdMultilevelGrid getMultilevelGrid()
public boolean canAddElement(Object aObject)
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.canAddElement
in interface ILcdModel
canAddElement
in class ALcdModel
aObject
- the object to check.ILcdMultilevelCoordinate
, false otherwise.public void elementsAtSFCT(ILcdMultilevelGridCoordinate aMultilevelGridCoordinate, Vector aCollectedObjectsVector)
aMultilevelGridCoordinate
- the location of the elements to look for, expressed as a multilevel coordinate.aCollectedObjectsVector
- the vector to put the elements in.public boolean canRemoveElement(Object aObject)
canRemoveElement
in interface ILcdModel
canRemoveElement
in class ALcdModel
aObject
- not take into account.public void removeElement(Object aObject, int aFireEventMode)
removeElement
in interface ILcdModel
removeElement
in class ALcdModel
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.ILcdModel.canRemoveElement(Object)
public void removeAllElements(int aFireEventMode)
removeAllElements
in interface ILcdModel
removeAllElements
in class ALcdModel
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.public void addElement(Object aObject, int aFireEventMode)
ILcdMultilevelCoordinate
object to the model. If the object is not an
ILcdMultilevelGridCoordinate
object, it will not be added to the model.addElement
in interface ILcdModel
addElement
in class ALcdModel
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.ILcdModel.canAddElement(Object)
public int applyOnInteract2DBounds(ILcdBounds aBounds, boolean aStrictInteract, ILcdFunction aFunction, double aPrecisionX, double aPrecisionY)
applyOnInteract2DBounds
in interface ILcd2DBoundsIndexedModel
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.public int applyOnInteract2DBounds(ILcdBounds aBounds, boolean aStrictInteract, ILcdFunction aFunction, double aPrecisionX, double aPrecisionY, double aMinSizeX, double aMinSizeY, boolean aIncludePoints)
applyOnInteract2DBounds
in interface ILcd2DBoundsIndexedModel
applyOnInteract2DBounds
in interface ILcd2DBoundsInteractable
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.ILcdFunction
has been applied.public ILcdBounds getBounds()
getBounds
in interface ILcdBounded
getMultilevelGrid()
public Enumeration elements()
public void elementChanged(Object aObject, int aFireEventMode)
elementChanged
in interface ILcdModel
elementChanged
in class ALcdModel
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.public void elementsChanged(Vector aVector, int aFireEventMode)
elementsChanged
in interface ILcdModel
elementsChanged
in class ALcdModel
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.public void allElementsChanged(int aFireEventMode)
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.allElementsChanged
in class ALcdModel
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.