org.openstreetmap.osmosis.core.domain.v0_6.Relation.getTags()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.openstreetmap.osmosis.core.domain.v0_6.Relation.getTags方法的一些代码示例,展示了Relation.getTags的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Relation.getTags方法的具体详情如下:
包路径:org.openstreetmap.osmosis.core.domain.v0_6.Relation
类名称:Relation
方法名:getTags

Relation.getTags介绍

暂无

代码示例

代码示例来源:origin: mapsforge/mapsforge

void filterBoundaries(Relation relation) {
  if ("boundary".equalsIgnoreCase(writer.getTagValue(relation.getTags(), "type"))) {
    String boundaryCategory = writer.getTagValue(relation.getTags(), "boundary");
    if ("administrative".equalsIgnoreCase(boundaryCategory)) {
      String adminLevelValue = writer.getTagValue(relation.getTags(), "admin_level");
      if (adminLevelValue == null) return;
      switch (adminLevelValue.trim()) {
        //TODO Specify cultural/regional diffs for admin_levels,
        // which should be the lowest level of administrative boundary, tagged with is_in
        case "7":
          administrativeBoundaries.get(6).add(relation);
          return;
        case "8":
          administrativeBoundaries.get(7).add(relation);
          return;
        case "9":
          administrativeBoundaries.get(8).add(relation);
          return;
        case "10":
          administrativeBoundaries.get(9).add(relation);
          return;
        default:
      }
    } else if ("postal_code".equalsIgnoreCase(boundaryCategory)) {
      postalBoundaries.add(relation);
    }
  }
}

代码示例来源:origin: mapsforge/mapsforge

String postcode = writer.getTagValue(relation.getTags(), "postal_code");
if (postcode != null && !postcode.isEmpty()) {
  updateTagData(pois, "addr:postcode", postcode);
  String city = writer.getTagValue(relation.getTags(), "note");
  if (city != null && !city.isEmpty()) {
    int i = city.indexOf(postcode);
  isInTagName = adminArea.getValue().get("is_in");
String relationName = writer.getTagValue(relation.getTags(), "name");

代码示例来源:origin: mapsforge/mapsforge

return null;
LOGGER.fine("Administrative: " + writer.getTagValue(relation.getTags(), "name")
    + " #Members: " + relation.getMembers().size()
    + " #Segments: " + bounds.size());

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml

/**
 * This is called by child element processors when a tag object is
 * encountered.
 * 
 * @param tag
 *            The tag to be processed.
 */
public void processTag(Tag tag) {
  relation.getTags().add(tag);
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * This is called by child element processors when a tag object is
 * encountered.
 * 
 * @param tag
 *            The tag to be processed.
 */
public void processTag(Tag tag) {
  relation.getTags().add(tag);
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-core

/** 
   * ${@inheritDoc}.
   */
  @Override
  public String toString() {
    String type = null;
    Collection<Tag> tags = getTags();
    for (Tag tag : tags) {
      if (tag.getKey() != null && tag.getKey().equalsIgnoreCase("type")) {
        type = tag.getValue();
        break;
      }
    }
    if (type != null) {
      return "Relation(id=" + getId() + ", #tags=" +  getTags().size() + ", type='" + type + "')";
    }
    return "Relation(id=" + getId() + ", #tags=" +  getTags().size() + ")";
  }
}

代码示例来源:origin: openstreetmap/osmosis

/** 
   * ${@inheritDoc}.
   */
  @Override
  public String toString() {
    String type = null;
    Collection<Tag> tags = getTags();
    for (Tag tag : tags) {
      if (tag.getKey() != null && tag.getKey().equalsIgnoreCase("type")) {
        type = tag.getValue();
        break;
      }
    }
    if (type != null) {
      return "Relation(id=" + getId() + ", #tags=" +  getTags().size() + ", type='" + type + "')";
    }
    return "Relation(id=" + getId() + ", #tags=" +  getTags().size() + ")";
  }
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * Process the relation tags.
 * 
 * @param relation
 *            The relation to be processed.
 */
private void addRelationTags(Relation relation) {
  for (Tag tag : relation.getTags()) {
    relationTagBuffer.add(new DbFeature<Tag>(relation.getId(), tag));
  }
  
  flushRelationTags(false);
}

代码示例来源:origin: openstreetmap/osmosis

private Relation readRelation() throws Exception {
  long id;
  int version;
  TimestampContainer timestamp;
  OsmUser user;
  long changesetId;
  Relation relation;
  
  id = Long.parseLong(reader.getAttributeValue(null, ATTRIBUTE_NAME_ID));
  version = Integer.parseInt(reader.getAttributeValue(null, ATTRIBUTE_NAME_VERSION));
  timestamp = parseTimestamp(reader.getAttributeValue(null, ATTRIBUTE_NAME_TIMESTAMP));
  user = readUser();
  changesetId = readChangesetId();
  
  relation = new Relation(new CommonEntityData(id, version, timestamp, user, changesetId));
  
  reader.nextTag();
  while (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
    if (reader.getLocalName().equals(ELEMENT_NAME_TAG)) {
      relation.getTags().add(readTag());
    } else if (reader.getLocalName().equals(ELEMENT_NAME_MEMBER)) {
      relation.getMembers().add(readRelationMember());
    } else {
      readUnknownElement();
    }
  }
  reader.nextTag();
  
  return relation;
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml

private Relation readRelation() throws Exception {
  long id;
  int version;
  TimestampContainer timestamp;
  OsmUser user;
  long changesetId;
  Relation relation;
  
  id = Long.parseLong(reader.getAttributeValue(null, ATTRIBUTE_NAME_ID));
  version = Integer.parseInt(reader.getAttributeValue(null, ATTRIBUTE_NAME_VERSION));
  timestamp = parseTimestamp(reader.getAttributeValue(null, ATTRIBUTE_NAME_TIMESTAMP));
  user = readUser();
  changesetId = readChangesetId();
  
  relation = new Relation(new CommonEntityData(id, version, timestamp, user, changesetId));
  
  reader.nextTag();
  while (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
    if (reader.getLocalName().equals(ELEMENT_NAME_TAG)) {
      relation.getTags().add(readTag());
    } else if (reader.getLocalName().equals(ELEMENT_NAME_MEMBER)) {
      relation.getMembers().add(readRelationMember());
    } else {
      readUnknownElement();
    }
  }
  reader.nextTag();
  
  return relation;
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * Process the relation tags.
 * 
 * @param relation The relation to be processed.
 */
private void addRelationTags(Relation relation) {
  for (Tag tag : relation.getTags()) {
    relationTagBuffer.add(new DbFeatureHistory<DbFeature<Tag>>(new DbFeature<Tag>(relation.getId(), tag),
        relation.getVersion()));
  }
  flushRelationTags(false);
}

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-apidb

/**
 * Process the relation tags.
 * 
 * @param relation The relation to be processed.
 */
private void addRelationTags(Relation relation) {
  for (Tag tag : relation.getTags()) {
    relationTagBuffer.add(new DbFeatureHistory<DbFeature<Tag>>(new DbFeature<Tag>(relation.getId(), tag),
        relation.getVersion()));
  }
  flushRelationTags(false);
}

代码示例来源:origin: openstreetmap/osmosis

tags = relation.getTags();

代码示例来源:origin: org.openstreetmap.osmosis/osmosis-xml

tags = relation.getTags();

代码示例来源:origin: openstreetmap/osmosis

/**
 * Test processing a Relation.
 */
@Test
public final void testProcess8() {
  Relation testRelation;
  
  testRelation = new Relation(new CommonEntityData(3456, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0));
  testRelation.getMembers().add(new RelationMember(1234, EntityType.Node, "role1"));
  testRelation.getTags().add(new Tag("test_key1", "test_value1"));
  
  testOsmWriter.process(new RelationContainer(testRelation));
  // Nothing to assert; just expect no exception
}

代码示例来源:origin: openstreetmap/osmosis

/**
 * Test writing out a normal Relation element. 
 */
@Test
public final void testProcessNormalRelation() {
  Relation relation =
    new Relation(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
  relation.getMembers().add(new RelationMember(2345, EntityType.Node, "noderole"));
  relation.getMembers().add(new RelationMember(3456, EntityType.Way, "wayrole"));
  relation.getMembers().add(new RelationMember(4567, EntityType.Relation, "relationrole"));
  relation.getTags().add(new Tag("relationkey", "relationvalue"));
  
  testRelationWriter.process(relation);
  try {
    testBufferedWriter.flush();
  } catch (IOException e) {
    e.printStackTrace();
    fail("IOException");
  }
  String[] strArray = testWriter.toString().split("\\n", 6);
  assertTrue("Relation opening element does not match.", strArray[0].matches(relationOpeningMatch));
  assertTrue("Relation member node does not match.", strArray[1].matches(nodeMemberMatch));
  assertTrue("Relation member way does not match.", strArray[2].matches(wayMemberMatch));
  assertTrue("Relation member relation does not match.", strArray[3].matches(relationMemberMatch));
  assertTrue("Relation tag does not match.", strArray[4].matches(relationTagMatch));
  assertTrue("Relation closing element does not match.", strArray[5].matches(relationClosingMatch));
}

代码示例来源:origin: openstreetmap/osmosis

relation.getMembers().add(new RelationMember(3456, EntityType.Way, "wayrole"));
relation.getMembers().add(new RelationMember(4567, EntityType.Relation, "relationrole"));
relation.getTags().add(new Tag("relationkey", "relationvalue"));

代码示例来源:origin: openstreetmap/osmosis

/**
   * Test processing a Bound after a Relation.
   */
  @Test(expected = OsmosisRuntimeException.class)
  public final void testProcess9() {
    Relation testRelation;
    
    testRelation = new Relation(new CommonEntityData(3456, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0));
    testRelation.getMembers().add(new RelationMember(1234, EntityType.Node, "role1"));
    testRelation.getTags().add(new Tag("test_key1", "test_value1"));
    
    testOsmWriter.process(new RelationContainer(testRelation));
    testOsmWriter.process(new BoundContainer(new Bound("source")));
  }
}

代码示例来源:origin: openstreetmap/osmosis

for (Tag t : i.getTags()) {
  bi.addKeys(stable.getIndex(t.getKey()));
  bi.addVals(stable.getIndex(t.getValue()));

代码示例来源:origin: openstreetmap/osmosis

relationWriter.endRecord();
for (Tag tag : relation.getTags()) {
  relationTagWriter.writeField(relation.getId());
  relationTagWriter.writeField(tag.getKey());

相关文章