Class TLcyCompositeLayerMeasureProviderFactory
- All Implemented Interfaces:
ILcdLayerMeasureProviderFactory,Iterable<ILcdLayerMeasureProviderFactory>
Composite implementation (see composite design pattern) of ILcdLayerMeasureProviderFactory. It
keeps a list of associated ILcdLayerMeasureProviderFactory instances: one can add and remove other
ILcdLayerMeasureProviderFactory instances to this ILcdLayerMeasureProviderFactory.
When creating a new TLcyCompositeLayerMeasureProviderFactory using the default
constructor (see TLcyCompositeLayerMeasureProviderFactory()), the created instance will
only work on/with the ILcdLayerMeasureProviderFactorys registered
on this composite instance (see addLayerMeasureProviderFactory(com.luciad.util.measure.ILcdLayerMeasureProviderFactory)
and removeLayerMeasureProviderFactory(com.luciad.util.measure.ILcdLayerMeasureProviderFactory)).
When creating a new TLcyCompositeLayerMeasureProviderFactory using the constructor
specifying an ILcyLucyEnv instance (see TLcyCompositeLayerMeasureProviderFactory(com.luciad.lucy.ILcyLucyEnv)), the created instance will
work on the Lucy back-end services. It will use
all registered ILcdLayerMeasureProviderFactory instances of the
Lucy back-end, adding and/or removing an ILcdLayerMeasureProviderFactory will
add/remove the ILcdLayerMeasureProviderFactory as service from Lucy, ... .
This class can for example be used to retrieve measures for a view:
TLcyCompositeLayerMeasureProviderFactory factory = new TLcyCompositeLayerMeasureProviderFactory(lucyEnv);
TLcdGXYViewMeasureProvider measureProvider = new TLcdGXYViewMeasureProvider(view, null, Collections.singletonList(factory));
ALcdMeasureProvider.Parameters parameters = ALcdMeasureProvider.Parameters.newBuilder().build();
List<TLcdISO19103Measure[]> measures = measureProvider.retrieveMeasuresAt(point, pointReference, parameters);
- Since:
- 2015.0
-
Field Summary
Fields inherited from class com.luciad.lucy.util.TLcyGenericComposite
PRIORITY_DEFAULT, PRIORITY_FALLBACK -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.Construct aTLcyCompositeLayerMeasureProviderFactoryworking on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLayerMeasureProviderFactory(ILcdLayerMeasureProviderFactory aLayerMeasureProviderFactory) Adds the givenILcdLayerMeasureProviderFactoryto this composite measure provider factory.voidaddLayerMeasureProviderFactory(ILcdLayerMeasureProviderFactory aLayerMeasureProviderFactory, int aPriority) Adds the givenILcdLayerMeasureProviderFactoryto this composite measure provider factory, with the given priority.createMeasureProvider(ILcdLayer aLayer, ILcdView aView) Creates a new measure provider, based on the given layer and view, ornullif no measure provider can be created.getList()Returns an unmodifiableListcontaining all registered instances ofILcdLayerMeasureProviderFactory.voidremoveLayerMeasureProviderFactory(ILcdLayerMeasureProviderFactory aLayerMeasureProviderFactory) Removes the givenILcdLayerMeasureProviderFactoryfrom this composite measure provider factory.Methods inherited from class com.luciad.lucy.util.TLcyGenericComposite
add, add, 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
-
TLcyCompositeLayerMeasureProviderFactory
public TLcyCompositeLayerMeasureProviderFactory()Default constructor. No
ILcdLayerMeasureProviderFactorys are associated.The created instance will only work on the
ILcdLayerMeasureProviderFactoryinstances registered to it. If you want to use all registeredILcdLayerMeasureProviderFactoryinstances of the Lucy back-end, useTLcyCompositeLayerMeasureProviderFactory(com.luciad.lucy.ILcyLucyEnv)instead.- See Also:
-
TLcyCompositeLayerMeasureProviderFactory
Construct a
TLcyCompositeLayerMeasureProviderFactoryworking on the Lucy back-end.It will use all
ILcdLayerMeasureProviderFactoryinstances registered to the back-end, and adding and/or removingILcdLayerMeasureProviderFactorys to/from thisILcdLayerMeasureProviderFactorywill respectively add/remove it as service from the back-end.If you want to create a
TLcyCompositeLayerMeasureProviderFactorywhich does not use the back-end, useTLcyCompositeLayerMeasureProviderFactory()instead.- Parameters:
aLucyEnv- The Lucy back-end.- See Also:
-
-
Method Details
-
createMeasureProvider
Description copied from interface:ILcdLayerMeasureProviderFactoryCreates a new measure provider, based on the given layer and view, ornullif no measure provider can be created.- Specified by:
createMeasureProviderin interfaceILcdLayerMeasureProviderFactory- Parameters:
aLayer- the layer for which to create a measure provideraView- the view for which to create a measure provider- Returns:
- a measure provider, or
nullif no measure provider can be created for the given layer and view.
-
addLayerMeasureProviderFactory
public void addLayerMeasureProviderFactory(ILcdLayerMeasureProviderFactory aLayerMeasureProviderFactory) Adds the given
ILcdLayerMeasureProviderFactoryto this composite measure provider factory.If the constructor specifying an
ILcyLucyEnvis used, theILcdLayerMeasureProviderFactorywill be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)). When callingILcyLucyEnv.getServices(Class)afterwards,aLayerMeasureProviderFactorywill only be included in the returned list when the requested class wasILcdLayerMeasureProviderFactory.class.
Note: if you want to remove the registeredILcdLayerMeasureProviderFactoryafterwards, useremoveLayerMeasureProviderFactoryand notILcyLucyEnv.removeService(Object).- Parameters:
aLayerMeasureProviderFactory- the measure provider factory to add- See Also:
-
addLayerMeasureProviderFactory
public void addLayerMeasureProviderFactory(ILcdLayerMeasureProviderFactory aLayerMeasureProviderFactory, int aPriority) Adds the given
ILcdLayerMeasureProviderFactoryto this composite measure provider factory, with the given priority.If the constructor specifying an
ILcyLucyEnvis used, theILcdLayerMeasureProviderFactorywill be registered as a service on the Lucy back-end (seeILcyLucyEnv.addService(Object, int)). When callingILcyLucyEnv.getServices(Class)afterwards,aLayerMeasureProviderFactorywill only be included in the returned list when the requested class wasILcdLayerMeasureProviderFactory.class.
Note: if you want to remove the registeredILcdLayerMeasureProviderFactoryafterwards, useremoveLayerMeasureProviderFactoryand notILcyLucyEnv.removeService(Object).- Parameters:
aLayerMeasureProviderFactory- the measure provider factory to addaPriority- the priority- See Also:
-
removeLayerMeasureProviderFactory
public void removeLayerMeasureProviderFactory(ILcdLayerMeasureProviderFactory aLayerMeasureProviderFactory) Removes the given
ILcdLayerMeasureProviderFactoryfrom this composite measure provider factory. If the givenILcdLayerMeasureProviderFactorywas never added before, nothing happens.If the constructor specifying an
ILcyLucyEnvis used, theILcdLayerMeasureProviderFactorywill be removed as service from the Lucy back-end (seeILcyLucyEnv.removeService(Object)).
Note: it is only possible to removeILcdLayerMeasureProviderFactoryinstances which were registered using theaddLayerMeasureProviderFactory(com.luciad.util.measure.ILcdLayerMeasureProviderFactory)method.- Parameters:
aLayerMeasureProviderFactory- AILcdLayerMeasureProviderFactoryto remove.- See Also:
-
getList
Returns an unmodifiable
Listcontaining all registered instances ofILcdLayerMeasureProviderFactory.- Overrides:
getListin classTLcyGenericComposite<ILcdLayerMeasureProviderFactory>- Returns:
- an unmodifiable
Listcontaining all registered instances ofILcdLayerMeasureProviderFactory.
-