public class DefaultNameFormatter extends Object implements NameFormatter, HistoryNameFormatter
NameFormatter
for names of OsmPrimitive
s.Modifier and Type | Field and Description |
---|---|
static String[] |
DEFAULT_NAMING_TAGS_FOR_RELATIONS
The default list of tags which are used as naming tags in relations.
|
private static List<NameFormatterHook> |
formatHooks |
private static DefaultNameFormatter |
instance |
private static List<String> |
namingTagsForRelations
the current list of tags used as naming tags in relations
|
private Comparator<Node> |
nodeComparator |
private Comparator<Relation> |
relationComparator |
private Comparator<Way> |
wayComparator |
Constructor and Description |
---|
DefaultNameFormatter() |
Modifier and Type | Method and Description |
---|---|
String |
buildDefaultToolTip(HistoryOsmPrimitive primitive)
Builds a default tooltip text for an HistoryOsmPrimitive
primitive . |
String |
buildDefaultToolTip(IPrimitive primitive)
Builds a default tooltip text for the primitive
primitive . |
protected void |
decorateNameWithId(StringBuilder name,
HistoryOsmPrimitive primitive)
Decorates the name of primitive with its id, if the preference
osm-primitives.showid is set.
|
protected void |
decorateNameWithId(StringBuilder name,
IPrimitive primitive)
Decorates the name of primitive with its id, if the preference
osm-primitives.showid is set.
|
String |
format(Changeset changeset)
Formats a name for a changeset
|
String |
format(HistoryNode node)
Formats a name for a history node
|
String |
format(HistoryRelation relation)
Formats a name for a
HistoryRelation ) |
String |
format(HistoryWay way)
Formats a name for a way
|
String |
format(Node node)
Formats a name for a node
|
String |
format(Relation relation)
Formats a name for a relation
|
String |
format(Way way)
Formats a name for a way
|
String |
formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives) |
String |
formatAsHtmlUnorderedList(OsmPrimitive... primitives) |
private void |
formatRelationNameAndType(Relation relation,
StringBuilder result,
TaggingPreset preset) |
static DefaultNameFormatter |
getInstance()
Replies the unique instance of this formatter
|
private String |
getNameTagValue(IRelation relation,
String nameTag) |
static List<String> |
getNamingtagsForRelations()
Replies the list of naming tags used in relations.
|
Comparator<Node> |
getNodeComparator() |
Comparator<Relation> |
getRelationComparator() |
private String |
getRelationName(IRelation relation) |
private String |
getRelationTypeName(IRelation relation) |
Comparator<Way> |
getWayComparator() |
static void |
registerFormatHook(NameFormatterHook hook)
Registers a format hook.
|
static void |
unregisterFormatHook(NameFormatterHook hook)
Unregisters a format hook.
|
private static DefaultNameFormatter instance
private static final List<NameFormatterHook> formatHooks
public static final String[] DEFAULT_NAMING_TAGS_FOR_RELATIONS
private static List<String> namingTagsForRelations
private final Comparator<Node> nodeComparator
private final Comparator<Way> wayComparator
private final Comparator<Relation> relationComparator
public DefaultNameFormatter()
public static DefaultNameFormatter getInstance()
public static void registerFormatHook(NameFormatterHook hook)
hook
- the format hook. Ignored if null.public static void unregisterFormatHook(NameFormatterHook hook)
hook
- the format hook. Ignored if null.public static List<String> getNamingtagsForRelations()
DEFAULT_NAMING_TAGS_FOR_RELATIONS
protected void decorateNameWithId(StringBuilder name, IPrimitive primitive)
name
- the name without the idprimitive
- the primitivepublic String format(Node node)
format
in interface NameFormatter
node
- the nodepublic Comparator<Node> getNodeComparator()
getNodeComparator
in interface NameFormatter
public String format(Way way)
format
in interface NameFormatter
way
- the waypublic Comparator<Way> getWayComparator()
getWayComparator
in interface NameFormatter
public String format(Relation relation)
format
in interface NameFormatter
relation
- the relationprivate void formatRelationNameAndType(Relation relation, StringBuilder result, TaggingPreset preset)
public Comparator<Relation> getRelationComparator()
getRelationComparator
in interface NameFormatter
private String getRelationTypeName(IRelation relation)
private String getNameTagValue(IRelation relation, String nameTag)
private String getRelationName(IRelation relation)
public String format(Changeset changeset)
format
in interface NameFormatter
changeset
- the changesetpublic String buildDefaultToolTip(IPrimitive primitive)
primitive
.primitive
- the primitmiveprotected void decorateNameWithId(StringBuilder name, HistoryOsmPrimitive primitive)
StringBuilder
passed in in name
.name
- the name without the idprimitive
- the primitivepublic String format(HistoryNode node)
format
in interface HistoryNameFormatter
node
- the nodepublic String format(HistoryWay way)
format
in interface HistoryNameFormatter
way
- the waypublic String format(HistoryRelation relation)
HistoryRelation
)format
in interface HistoryNameFormatter
relation
- the relationpublic String buildDefaultToolTip(HistoryOsmPrimitive primitive)
primitive
.primitive
- the primitmivepublic String formatAsHtmlUnorderedList(Collection<? extends OsmPrimitive> primitives)
public String formatAsHtmlUnorderedList(OsmPrimitive... primitives)