Class TLcyCompositeModelHeightProviderFactory
- All Implemented Interfaces:
ILcdModelHeightProviderFactory
,Iterable<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
.
- Since:
- 10.0
-
Field Summary
Fields inherited from class com.luciad.lucy.util.TLcyGenericComposite
PRIORITY_DEFAULT, PRIORITY_FALLBACK
Fields inherited from interface com.luciad.util.height.ILcdModelHeightProviderFactory
KEY_GEO_REFERENCE
-
Constructor Summary
ConstructorDescriptionDefault constructor.Construct aTLcyCompositeModelHeightProviderFactory
working on the Lucy back-end -
Method Summary
Modifier and TypeMethodDescriptionvoid
addModelHeightProviderFactory
(ILcdModelHeightProviderFactory aModelHeightProviderFactory) Adds the givenILcdModelHeightProviderFactory
to the list of registered model height provider factories.createHeightProvider
(ILcdModel aModel, Map<String, Object> aRequiredPropertiesSFCT, Map<String, Object> aOptionalProperties) Returns a height provider for a givenILcdModel
using the given properties.getModelHeightProviderFactory
(int aIndex) Returns theILcdModelHeightProviderFactory
at indexaIndex
.int
Returns the number of registeredILcdModelHeightProviderFactory
instances.void
removeModelHeightProviderFactory
(ILcdModelHeightProviderFactory aModelHeightProviderFactory) Removes the givenILcdModelHeightProviderFactory
from the list of registered model height provider factories.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TLcyCompositeModelHeightProviderFactory
public TLcyCompositeModelHeightProviderFactory()Default constructor.
The created instance will only work on the
ILcdModelHeightProviderFactory
instances registered to it. If you want to use all registeredILcdModelHeightProviderFactory
instances of the Lucy back-end, useTLcyCompositeModelHeightProviderFactory(com.luciad.lucy.ILcyLucyEnv)
instead.- See Also:
-
TLcyCompositeModelHeightProviderFactory
Construct a
TLcyCompositeModelHeightProviderFactory
working on the Lucy back-endIt will use all
ILcdModelHeightProviderFactory
instances registered to the back-end, and adding and/or removingILcdModelHeightProviderFactory
s to/from thisTLcyCompositeModelHeightProviderFactory
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, useTLcyCompositeModelHeightProviderFactory()
instead.- Parameters:
aLucyEnv
- The Lucy back-end.- See Also:
-
-
Method Details
-
addModelHeightProviderFactory
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, theILcdModelHeightProviderFactory
will be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)
). When callingILcyLucyEnv.getServices(Class)
afterwards,aModelHeightProviderFactory
will only be included in the returned list when the requested class wasILcdModelHeightProviderFactory.class
.
Note: if you want to remove the registeredILcdModelHeightProviderFactory
afterwards, useremoveModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
and notILcyLucyEnv.removeService(Object)
.- Parameters:
aModelHeightProviderFactory
- The model height provider factory to add. Must not benull
.- See Also:
-
removeModelHeightProviderFactory
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, theILcdModelHeightProviderFactory
will be removed as service from the Lucy back-end (seeILcyLucyEnv.removeService(Object)
).
Note: it is only possible to removeILcdModelHeightProviderFactory
instances which were registered using theaddModelHeightProviderFactory(com.luciad.util.height.ILcdModelHeightProviderFactory)
method.- Parameters:
aModelHeightProviderFactory
- The model height provider factory to remove. Must not benull
- See Also:
-
createHeightProvider
public ILcdHeightProvider createHeightProvider(ILcdModel aModel, Map<String, Object> aRequiredPropertiesSFCT, Map<String, throws TLcdMissingPropertyException, TLcdUnsupportedPropertyExceptionObject> aOptionalProperties) Description copied from interface:ILcdModelHeightProviderFactory
Returns a height provider for a givenILcdModel
using the given properties. The returned height provider is determined by the implementation, theILcdModel
and the given properties.- Specified by:
createHeightProvider
in interfaceILcdModelHeightProviderFactory
- Parameters:
aModel
- anILcdModel
for which a height provider is created.aRequiredPropertiesSFCT
- the required properties. The properties can be retrieved using aString
key describing the property type. When not all required properties are used, an exception is thrown.aRequiredProperties
may be empty but should not benull
. When an implementation of this interface uses a required property, it should always remove it from the list of required properties. When theILcdHeightProvider
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 aString
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.- Returns:
- a height provider if elevation is supported, or
null
when elevation is not supported or when no valid height provider can be created. - Throws:
TLcdMissingPropertyException
- when the implementation misses a necessary property.TLcdUnsupportedPropertyException
- when a required property is not used by the implementation.- See Also:
-
getModelHeightProviderFactoryCount
public int getModelHeightProviderFactoryCount()Returns the number of registered
ILcdModelHeightProviderFactory
instances.- Returns:
- the number of registered
ILcdModelHeightProviderFactory
instances.
-
getModelHeightProviderFactory
Returns the
ILcdModelHeightProviderFactory
at indexaIndex
.- Parameters:
aIndex
- The index: 0 <= aIndex <getModelHeightProviderFactoryCount()
- Returns:
- the
ILcdModelHeightProviderFactory
at indexaIndex
.
-