public static class LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy extends LabelCompositionStrategy
LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy, LabelCompositionStrategy.StaticLabelCompositionStrategy, LabelCompositionStrategy.TagLookupCompositionStrategy
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
DEFAULT_NAME_COMPLEMENT_TAGS
The list of default name complement tags from which a label candidate is derived.
|
private static java.lang.String[] |
DEFAULT_NAME_TAGS
The list of default name tags from which a label candidate is derived.
|
private java.util.List<java.lang.String> |
nameComplementTags |
private java.util.List<java.lang.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 java.util.List<java.lang.String> |
buildNameTags(java.util.List<java.lang.String> nameTags) |
java.lang.String |
compose(OsmPrimitive primitive)
Replies the text value to be rendered as label for the primitive
primitive . |
java.util.List<java.lang.String> |
getNameComplementTags()
Replies an unmodifiable list of the name complement tags used to compose the label.
|
java.util.List<java.lang.String> |
getNameTags()
Replies an unmodifiable list of the name tags used to compose the label.
|
private java.lang.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 |
setNameComplementTags(java.util.List<java.lang.String> nameComplementTags)
Sets the name complement tags to be looked up in order to build up the label.
|
void |
setNameTags(java.util.List<java.lang.String> nameTags)
Sets the name tags to be looked up in order to build up the label.
|
java.lang.String |
toString() |
private static final java.lang.String[] DEFAULT_NAME_TAGS
private static final java.lang.String[] DEFAULT_NAME_COMPLEMENT_TAGS
private java.util.List<java.lang.String> nameTags
private java.util.List<java.lang.String> nameComplementTags
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.
private static java.util.List<java.lang.String> buildNameTags(java.util.List<java.lang.String> nameTags)
public void setNameTags(java.util.List<java.lang.String> nameTags)
nameTags
- the name tags. null values are ignored.public void setNameComplementTags(java.util.List<java.lang.String> nameComplementTags)
nameComplementTags
- the name complement tags. null values are ignored.public java.util.List<java.lang.String> getNameTags()
public java.util.List<java.lang.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 java.lang.String getPrimitiveName(OsmPrimitive n)
public java.lang.String compose(OsmPrimitive primitive)
LabelCompositionStrategy
primitive
.compose
in class LabelCompositionStrategy
primitive
- the primitivepublic java.lang.String toString()
toString
in class java.lang.Object