本文整理了Java中org.openstreetmap.osmosis.core.domain.v0_6.Tag
类的一些代码示例,展示了Tag
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tag
类的具体详情如下:
包路径:org.openstreetmap.osmosis.core.domain.v0_6.Tag
类名称:Tag
[英]A data class representing a single OSM tag.
[中]表示单个OSM标记的数据类。
代码示例来源:origin: mapsforge/mapsforge
/**
* Returns value of given tag in a set of tags.
*
* @param tags collection of tags
* @param key tag key
* @return Tag value or null if not exists
*/
String getTagValue(Collection<Tag> tags, String key) {
for (Tag tag : tags) {
if (tag.getKey().toLowerCase(Locale.ENGLISH).equals(key.toLowerCase(Locale.ENGLISH))) {
return tag.getValue();
}
}
return null;
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
public void begin(Attributes attributes) {
String key;
String value;
key = attributes.getValue(ATTRIBUTE_NAME_KEY);
value = attributes.getValue(ATTRIBUTE_NAME_VALUE);
tag = new Tag(key, value);
}
代码示例来源:origin: openstreetmap/osmosis
tagMap.put(tag.getKey(), tag.getValue());
entityTags.add(new Tag(tag.getKey(), tag.getValue()));
代码示例来源:origin: mapsforge/mapsforge
switch (tag.getKey()) {
case "building":
case "highway":
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
@Override
public void store(StoreWriter sw, StoreClassRegister scr) {
sw.writeCharacter(IntAsChar.intToChar(size()));
for (Tag tag : this) {
tag.store(sw, scr);
}
}
代码示例来源:origin: openstreetmap/osmosis
int result = tags1.get(i).compareTo(tags2.get(i));
代码示例来源:origin: org.locationtech.geogig/geogig-osm
@Override
public int compare(Tag left, Tag right) {
return Ordering.natural().compare(left.getKey(), right.getKey());
}
};
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-core
/**
* {@inheritDoc}
*/
@Override
public void store(StoreWriter sw, StoreClassRegister scr) {
sw.writeCharacter(IntAsChar.intToChar(size()));
for (Tag tag : this) {
tag.store(sw, scr);
}
}
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-core
int result = tags1.get(i).compareTo(tags2.get(i));
代码示例来源:origin: mapsforge/mapsforge
if (way.getTags() != null) {
for (Tag tag : way.getTags()) {
String key = tag.getKey().toLowerCase(Locale.ENGLISH);
String value = tag.getValue().toLowerCase(Locale.ENGLISH);
if ("area".equals(key)) {
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml
/**
* {@inheritDoc}
*/
public void begin(Attributes attributes) {
String key;
String value;
key = attributes.getValue(ATTRIBUTE_NAME_KEY);
value = attributes.getValue(ATTRIBUTE_NAME_VALUE);
tag = new Tag(key, value);
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
@Override
public void process(EntityContainer entityContainer) {
EntityContainer writeableContainer;
Entity entity;
writeableContainer = entityContainer.getWriteableInstance();
entity = writeableContainer.getEntity();
for (Iterator<Tag> i = entity.getTags().iterator(); i.hasNext();) {
Tag tag;
tag = i.next();
if (keysToDrop.contains(tag.getKey())) {
i.remove();
} else {
for (String prefix : keyPrefixesToDrop) {
if (tag.getKey().startsWith(prefix)) {
i.remove();
break;
}
}
}
}
sink.process(writeableContainer);
}
代码示例来源:origin: mapsforge/mapsforge
/**
* Extracts known way tags and returns their ids.
*
* @param entity the way
* @return the ids of the identified tags
*/
public static Map<Short, Object> extractKnownWayTags(Entity entity) {
Map<Short, Object> tagMap = new HashMap<>();
OSMTagMapping mapping = OSMTagMapping.getInstance();
if (entity.getTags() != null) {
for (Tag tag : entity.getTags()) {
OSMTag wayTag = mapping.getWayTag(tag.getKey(), tag.getValue());
if (wayTag != null) {
String wildcard = wayTag.getValue();
tagMap.put(wayTag.getId(), getObjectFromWildcardAndValue(wildcard, tag.getValue()));
}
}
}
return tagMap;
}
代码示例来源:origin: osmlab/atlas
@Override
public Collection<Tag> convert(final Map<String, String> object)
{
final List<Tag> result = new ArrayList<>();
object.forEach((key, value) -> result.add(new Tag(key, value)));
return result;
}
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
public void process(NodeContainer container) {
Node node = container.getEntity();
boolean matchesFilter = false;
for (Tag tag : node.getTags()) {
if (allowedKeys.contains(tag.getKey())) {
matchesFilter = true;
break;
}
}
if (matchesFilter) {
sink.process(container);
}
}
代码示例来源:origin: mapsforge/mapsforge
/**
* Extracts known POI tags and returns their ids.
*
* @param entity the node
* @return the ids of the identified tags
*/
public static Map<Short, Object> extractKnownPOITags(Entity entity) {
Map<Short, Object> tagMap = new HashMap<>();
OSMTagMapping mapping = OSMTagMapping.getInstance();
if (entity.getTags() != null) {
for (Tag tag : entity.getTags()) {
OSMTag poiTag = mapping.getPoiTag(tag.getKey(), tag.getValue());
if (poiTag != null) {
String wildcard = poiTag.getValue();
tagMap.put(poiTag.getId(), getObjectFromWildcardAndValue(wildcard, tag.getValue()));
}
}
}
return tagMap;
}
代码示例来源:origin: openstreetmap/osmosis
private Tag readTag() throws Exception {
Tag tag = new Tag(reader.getAttributeValue(null, ATTRIBUTE_NAME_KEY),
reader.getAttributeValue(null, ATTRIBUTE_NAME_VALUE));
reader.nextTag();
reader.nextTag();
return tag;
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
public void process(WayContainer container) {
Way way = container.getEntity();
boolean matchesFilter = false;
for (Tag tag : way.getTags()) {
if (allowedKeys.contains(tag.getKey())) {
matchesFilter = true;
break;
}
}
if (matchesFilter) {
sink.process(container);
}
}
代码示例来源:origin: mapsforge/mapsforge
List<String> restPreferredLanguages = new ArrayList<String>(preferredLanguages);
for (Tag tag : tags) {
String key = tag.getKey().toLowerCase(Locale.ENGLISH);
if ("name".equals(key)) { // Default 'name'
defaultName = tag.getValue();
name = defaultName;
} else { // Localized name
if (tag.getValue().equals(defaultName)) { // Same with default 'name'?
continue;
if (preferredLanguages.contains(language)) {
restPreferredLanguages.remove(language);
name = (name != null ? name + '\r' : "") + language + '\b' + tag.getValue();
for (String preferredLanguage : restPreferredLanguages) {
for (Tag tag : tags) {
String key = tag.getKey().toLowerCase(Locale.ENGLISH);
Matcher matcher = NAME_LANGUAGE_PATTERN.matcher(key);
if (!matcher.matches()) {
continue;
if (tag.getValue().equals(defaultName)) { // Same with default 'name'?
continue;
if (!fallbacks.containsKey(language) && !language.contains("-") && (preferredLanguage.contains("-") || preferredLanguage.contains("_"))
&& preferredLanguage.toLowerCase(Locale.ENGLISH).startsWith(language)) {
fallbacks.put(language, tag.getValue());
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml
private Tag readTag() throws Exception {
Tag tag = new Tag(reader.getAttributeValue(null, ATTRIBUTE_NAME_KEY),
reader.getAttributeValue(null, ATTRIBUTE_NAME_VALUE));
reader.nextTag();
reader.nextTag();
return tag;
}
内容来源于网络,如有侵权,请联系作者删除!