public static class LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy extends LabelCompositionStrategy implements Preferences.PreferenceChangedListener
LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy, LabelCompositionStrategy.StaticLabelCompositionStrategy, LabelCompositionStrategy.TagLookupCompositionStrategy
Modifier and Type | Field and Description |
---|---|
private static String[] |
DEFAULT_NAME_COMPLEMENT_TAGS
The list of default name complement tags from which a label candidate is derived.
|
private static String[] |
DEFAULT_NAME_TAGS
The list of default name tags from which a label candidate is derived.
|
private List<String> |
nameComplementTags |
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 |
---|---|
private static List<String> |
buildNameTags(List<String> nameTags) |
String |
compose(OsmPrimitive primitive)
Replies the text value to be rendered as label for the primitive
primitive . |
List<String> |
getNameComplementTags()
Replies an unmodifiable list of the name complement tags used to compose the label.
|
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 DEFAULT_NAME_COMPLEMENT_TAGS )
and from name tags configured in the preferences using the keys
mappaint.nameOrder and mappaint.nameComplementOrder. |
void |
preferenceChanged(Preferences.PreferenceChangeEvent e)
Trigerred when a preference entry value changes.
|
void |
setNameComplementTags(List<String> nameComplementTags)
Sets the name complement tags to be looked up in order to build up the label.
|
void |
setNameTags(List<String> nameTags)
Sets the name tags to be looked up in order to build up the label.
|
String |
toString() |
private static final String[] DEFAULT_NAME_TAGS
private static final String[] DEFAULT_NAME_COMPLEMENT_TAGS
private List<String> nameComplementTags
public DeriveLabelFromNameTagsCompositionStrategy()
Creates the strategy and initializes its name tags from the preferences.
private static List<String> buildNameTags(List<String> nameTags)
public void setNameTags(List<String> nameTags)
nameTags
- the name tags. null values are ignored.public void setNameComplementTags(List<String> nameComplementTags)
nameComplementTags
- the name complement tags. null values are ignored.public List<String> getNameTags()
public List<String> getNameComplementTags()
public final void initNameTagsFromPreferences()
DEFAULT_NAME_TAGS
and DEFAULT_NAME_COMPLEMENT_TAGS
)
and from name tags configured in the preferences using the keys
mappaint.nameOrder and mappaint.nameComplementOrder.private String getPrimitiveName(OsmPrimitive n)
public String compose(OsmPrimitive primitive)
LabelCompositionStrategy
primitive
.compose
in class LabelCompositionStrategy
primitive
- the primitivepublic void preferenceChanged(Preferences.PreferenceChangeEvent e)
Preferences.PreferenceChangedListener
preferenceChanged
in interface Preferences.PreferenceChangedListener
e
- the preference change event