/** * Get the types of all layers the user should be able to create. There can also be internal * types reserved for built-in features. These are not returned. */ default List<LayerType> getAllTypes() { List<LayerType> allTypes = new ArrayList<>(); for (LayerSupport layerSupport : getLayerSupports()) { List<LayerType> types = layerSupport.getSupportedLayerTypes(); types.stream().forEach(allTypes::add); } allTypes.sort(comparing(LayerType::getUiName)); return allTypes; } }
/** * Get the types of all layers the user should be able to create. There can also be internal * types reserved for built-in features. These are not returned. */ default List<LayerType> getAllTypes() { List<LayerType> allTypes = new ArrayList<>(); for (LayerSupport layerSupport : getLayerSupports()) { List<LayerType> types = layerSupport.getSupportedLayerTypes(); types.stream().forEach(allTypes::add); } allTypes.sort(comparing(LayerType::getUiName)); return allTypes; } }
/** * Get the layer type for the given annotation layer. If the current layer support does * not provide any layer type for the given layer, an empty value is returned. As we * usually use {@link LayerType} objects in layer type selection lists, this method is * helpful in obtaining the selected value of such a list from the {@link AnnotationLayer} * object being edited. * * @param aLayer * a layer definition. * @return the corresponding layer type. */ default Optional<LayerType> getLayerType(AnnotationLayer aLayer) { return getSupportedLayerTypes().stream() .filter(t -> t.getName().equals(aLayer.getType())).findFirst(); }
/** * Get the layer type for the given annotation layer. If the current layer support does * not provide any layer type for the given layer, an empty value is returned. As we * usually use {@link LayerType} objects in layer type selection lists, this method is * helpful in obtaining the selected value of such a list from the {@link AnnotationLayer} * object being edited. * * @param aLayer * a layer definition. * @return the corresponding layer type. */ default Optional<LayerType> getLayerType(AnnotationLayer aLayer) { return getSupportedLayerTypes().stream() .filter(t -> t.getName().equals(aLayer.getType())).findFirst(); }