public static class LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy extends LabelCompositionStrategy
LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy, LabelCompositionStrategy.StaticLabelCompositionStrategy, LabelCompositionStrategy.TagLookupCompositionStrategy
Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULT_NAME_TAGS
The list of default name tags from which a label candidate is derived.
|
private List<String> |
nameTags |
Constructor and Description |
---|
DeriveLabelFromNameTagsCompositionStrategy()
Creates the strategy and initializes its name tags from the preferences.
|
Modifier and Type | Method and Description |
---|---|
String |
compose(OsmPrimitive primitive)
Replies the text value to be rendered as label for the primitive
primitive . |
List<String> |
getNameTags()
Replies an unmodifiable list of the name tags used to compose the label.
|
private String |
getPrimitiveName(OsmPrimitive n) |
void |
initNameTagsFromPreferences()
Initializes the name tags to use from a list of default name tags (see
DEFAULT_NAME_TAGS ) and from name tags configured in the preferences
using the preference key mappaint.nameOrder. |
void |
setNameTags(List<String> nameTags)
Sets the name tags to be looked up in order to build up the label
|
String |
toString() |
public static final String[] DEFAULT_NAME_TAGS
public DeriveLabelFromNameTagsCompositionStrategy()
Creates the strategy and initializes its name tags from the preferences.
Note: If the list of name tags in the preferences changes, strategy instances
are not notified. It's up to the client to listen to preference changes and
invoke initNameTagsFromPreferences()
accordingly.
public void setNameTags(List<String> nameTags)
nameTags
- the name tags. null values are ignore.public List<String> getNameTags()
public void initNameTagsFromPreferences()
DEFAULT_NAME_TAGS
) and from name tags configured in the preferences
using the preference key mappaint.nameOrder.private String getPrimitiveName(OsmPrimitive n)
public String compose(OsmPrimitive primitive)
LabelCompositionStrategy
primitive
.compose
in class LabelCompositionStrategy
primitive
- the primitive