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_FALLBACKFields inherited from interface com.luciad.util.height.ILcdModelHeightProviderFactory
KEY_GEO_REFERENCE -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Construct aTLcyCompositeModelHeightProviderFactoryworking on the Lucy back-end -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModelHeightProviderFactory(ILcdModelHeightProviderFactory aModelHeightProviderFactory) Adds the givenILcdModelHeightProviderFactoryto 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 givenILcdModelusing the given properties.getModelHeightProviderFactory(int aIndex) Returns theILcdModelHeightProviderFactoryat indexaIndex.intReturns the number of registeredILcdModelHeightProviderFactoryinstances.voidremoveModelHeightProviderFactory(ILcdModelHeightProviderFactory aModelHeightProviderFactory) Removes the givenILcdModelHeightProviderFactoryfrom the list of registered model height provider factories.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, getList, getPriority, iterator, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TLcyCompositeModelHeightProviderFactory
public TLcyCompositeModelHeightProviderFactory()Default constructor.
The created instance will only work on the
ILcdModelHeightProviderFactoryinstances registered to it. If you want to use all registeredILcdModelHeightProviderFactoryinstances of the Lucy back-end, useTLcyCompositeModelHeightProviderFactory(com.luciad.lucy.ILcyLucyEnv)instead.- See Also:
-
TLcyCompositeModelHeightProviderFactory
Construct a
TLcyCompositeModelHeightProviderFactoryworking on the Lucy back-endIt will use all
ILcdModelHeightProviderFactoryinstances registered to the back-end, and adding and/or removingILcdModelHeightProviderFactorys to/from thisTLcyCompositeModelHeightProviderFactorywill respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeModelHeightProviderFactorywhich 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
ILcdModelHeightProviderFactoryto the list of registered model height provider factories.If the constructor specifying an
ILcyLucyEnvis used, theILcdModelHeightProviderFactorywill be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)). When callingILcyLucyEnv.getServices(Class)afterwards,aModelHeightProviderFactorywill only be included in the returned list when the requested class wasILcdModelHeightProviderFactory.class.
Note: if you want to remove the registeredILcdModelHeightProviderFactoryafterwards, 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
ILcdModelHeightProviderFactoryfrom the list of registered model height provider factories. Nothing will happen if the given factory was never added before.If the constructor specifying an
ILcyLucyEnvis used, theILcdModelHeightProviderFactorywill be removed as service from the Lucy back-end (seeILcyLucyEnv.removeService(Object)).
Note: it is only possible to removeILcdModelHeightProviderFactoryinstances 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:ILcdModelHeightProviderFactoryReturns a height provider for a givenILcdModelusing the given properties. The returned height provider is determined by the implementation, theILcdModeland the given properties.- Specified by:
createHeightProviderin interfaceILcdModelHeightProviderFactory- Parameters:
aModel- anILcdModelfor which a height provider is created.aRequiredPropertiesSFCT- the required properties. The properties can be retrieved using aStringkey describing the property type. When not all required properties are used, an exception is thrown.aRequiredPropertiesmay 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 theILcdHeightProvideris 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 aStringkey describing the property type. The optional properties may or may not be used by the implementation.aOptionalPropertiesmay be empty but should not be null.- Returns:
- a height provider if elevation is supported, or
nullwhen 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
ILcdModelHeightProviderFactoryinstances.- Returns:
- the number of registered
ILcdModelHeightProviderFactoryinstances.
-
getModelHeightProviderFactory
Returns the
ILcdModelHeightProviderFactoryat indexaIndex.- Parameters:
aIndex- The index: 0 <= aIndex <getModelHeightProviderFactoryCount()- Returns:
- the
ILcdModelHeightProviderFactoryat indexaIndex.
-