public class TLcyCompositeModelHeightProviderFactory extends TLcyGenericComposite<ILcdModelHeightProviderFactory> implements ILcdModelHeightProviderFactory
A composite implementation of ILcdModelHeightProviderFactory
according to the
composite design pattern.
When creating a new TLcyCompositeModelHeightProviderFactory
using the default
constructor (see TLcyCompositeModelHeightProviderFactory()
), the created instance will
only work on/with the ILcdModelHeightProviderFactorys registered
on this composite instance (see addModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
and removeModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
).
When creating a new TLcyCompositeModelHeightProviderFactory
using the constructor
specifying an ILcyLucyEnv
instance (see TLcyCompositeModelHeightProviderFactory(com.luciad.lucy.ILcyLucyEnv)
, the created instance will
work on the Lucy back-end services. It will use
all registered ILcdModelHeightProviderFactory instances of the
Lucy back-end, adding and/or removing an ILcdModelHeightProviderFactory
will
add/remove the ILcdModelHeightProviderFactory
as service from Lucy, ... .
Creating an ILcdHeightProvider
using the back-end based implementation
can be done by creating a new instance of this class:
//Create a new instance whenever you need it.
TLcyCompositeModelHeightProviderFactory factory = new TLcyCompositeModelHeightProviderFactory( aLucyEnv );
ILcdHeightProvider provider = factory.createHeightProvider( aModel, aRequiredPropertiesSFCT, aOptionalProperties );
//There is no need to keep a reference to the composite instance, you can create a new one
//the next time you would need it
factory = null;
To retrieve a more detailed explanation of the required and optional properties,
see ILcdModelHeightProviderFactory
.
PRIORITY_DEFAULT, PRIORITY_FALLBACK
KEY_GEO_REFERENCE
Constructor and Description |
---|
TLcyCompositeModelHeightProviderFactory()
Default constructor.
|
TLcyCompositeModelHeightProviderFactory(ILcyLucyEnv aLucyEnv)
Construct a
TLcyCompositeModelHeightProviderFactory working on the Lucy
back-end |
Modifier and Type | Method and Description |
---|---|
void |
addModelHeightProviderFactory(ILcdModelHeightProviderFactory aModelHeightProviderFactory)
Adds the given
ILcdModelHeightProviderFactory to the list of registered model
height provider factories. |
ILcdHeightProvider |
createHeightProvider(ILcdModel aModel,
Map<String,Object> aRequiredPropertiesSFCT,
Map<String,Object> aOptionalProperties)
Returns a height provider for a given
ILcdModel using the given
properties. |
ILcdModelHeightProviderFactory |
getModelHeightProviderFactory(int aIndex)
Returns the
ILcdModelHeightProviderFactory at index aIndex . |
int |
getModelHeightProviderFactoryCount()
Returns the number of registered
ILcdModelHeightProviderFactory instances. |
void |
removeModelHeightProviderFactory(ILcdModelHeightProviderFactory aModelHeightProviderFactory)
Removes the given
ILcdModelHeightProviderFactory from the list of registered model height
provider factories. |
add, add, getList, getPriority, iterator, remove
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public TLcyCompositeModelHeightProviderFactory()
Default constructor.
The created instance will only work on the ILcdModelHeightProviderFactory
instances registered to it. If you want to use all registered ILcdModelHeightProviderFactory
instances of the Lucy back-end, use TLcyCompositeModelHeightProviderFactory(com.luciad.lucy.ILcyLucyEnv)
instead.
public TLcyCompositeModelHeightProviderFactory(ILcyLucyEnv aLucyEnv)
Construct a TLcyCompositeModelHeightProviderFactory
working on the Lucy
back-end
It will use all ILcdModelHeightProviderFactory
instances registered to the
back-end, and adding and/or removing ILcdModelHeightProviderFactory
s to/from this
TLcyCompositeModelHeightProviderFactory
will respectively add/remove it as service
from the back-end.
If you want to create a TLcyCompositeModelHeightProviderFactory
which does not
use the back-end, use TLcyCompositeModelHeightProviderFactory()
instead.
aLucyEnv
- The Lucy back-end.TLcyCompositeModelHeightProviderFactory()
,
ILcyLucyEnv.addService(Object, int)
,
ILcyLucyEnv.removeService(Object)
public void addModelHeightProviderFactory(ILcdModelHeightProviderFactory aModelHeightProviderFactory)
Adds the given ILcdModelHeightProviderFactory
to the list of registered model
height provider factories.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcdModelHeightProviderFactory
will be registered as a service on the Lucy
back-end (see ILcyLucyEnv.addService(Object, int)
). When calling ILcyLucyEnv.getServices(Class)
afterwards, aModelHeightProviderFactory
will only be included in the returned list when the requested class was
ILcdModelHeightProviderFactory.class
.
Note: if you want to remove the registered ILcdModelHeightProviderFactory
afterwards, use removeModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
and not ILcyLucyEnv.removeService(Object)
.
aModelHeightProviderFactory
- The model height provider factory to add. Must not be
null
.removeModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
public void removeModelHeightProviderFactory(ILcdModelHeightProviderFactory aModelHeightProviderFactory)
Removes the given ILcdModelHeightProviderFactory
from the list of registered model height
provider factories. Nothing will happen if the given factory was never added before.
If the constructor specifying an ILcyLucyEnv
is used, the
ILcdModelHeightProviderFactory
will be removed as service from the Lucy back-end
(see ILcyLucyEnv.removeService(Object)
).
Note: it is only possible to remove ILcdModelHeightProviderFactory
instances
which were registered using the addModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
method.
aModelHeightProviderFactory
- The model height provider factory to remove. Must not be null
addModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
public ILcdHeightProvider createHeightProvider(ILcdModel aModel, Map<String,Object> aRequiredPropertiesSFCT, Map<String,Object> aOptionalProperties) throws TLcdMissingPropertyException, TLcdUnsupportedPropertyException
ILcdModelHeightProviderFactory
ILcdModel
using the given
properties. The returned height provider is determined by the implementation,
the ILcdModel
and the given properties.createHeightProvider
in interface ILcdModelHeightProviderFactory
aModel
- an ILcdModel
for which a height provider is created.aRequiredPropertiesSFCT
- the required properties. The properties can be retrieved using a
String
key describing the property type. When not all required properties
are used, an exception is thrown. aRequiredProperties
may be empty but should
not be null
. When an implementation of this interface uses a required
property, it should always remove it from the list of required properties. When the
ILcdHeightProvider
is actually made, implementations should verify that
the list of required properties is empty (and all required properties are used).aOptionalProperties
- the optional properties. The properties can be retrieved using a
String
key describing the property type. The optional properties may or may
not be used by the implementation. aOptionalProperties
may be empty but
should not be null.null
when elevation
is not supported or when no valid height provider can be created.TLcdMissingPropertyException
- when the implementation misses a necessary property.TLcdUnsupportedPropertyException
- when a required property is not used by the
implementation.TLcdModelHeightProviderFactoryUtil
public int getModelHeightProviderFactoryCount()
Returns the number of registered ILcdModelHeightProviderFactory
instances.
ILcdModelHeightProviderFactory
instances.public ILcdModelHeightProviderFactory getModelHeightProviderFactory(int aIndex)
Returns the ILcdModelHeightProviderFactory
at index aIndex
.
aIndex
- The index: 0 <= aIndex < getModelHeightProviderFactoryCount()
ILcdModelHeightProviderFactory
at index aIndex
.