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

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

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

Relation.getWriteableInstance介绍

暂无

代码示例

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

/**
   * {@inheritDoc}
   */
  @Override
  public RelationContainer getWriteableInstance() {
    if (relation.isReadOnly()) {
      return new RelationContainer(relation.getWriteableInstance());
    } else {
      return this;
    }
  }
}

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

/**
   * {@inheritDoc}
   */
  @Override
  public RelationContainer getWriteableInstance() {
    if (relation.isReadOnly()) {
      return new RelationContainer(relation.getWriteableInstance());
    } else {
      return this;
    }
  }
}

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

/**
   * Relation cloning test.
   */
  @Test
  public void testRelationClone() {
    // Build the original entity.
    List<Tag> tags = new ArrayList<Tag>();
    tags.add(new Tag("myKey", "myValue"));
    List<RelationMember> members = new ArrayList<RelationMember>();
    members.add(new RelationMember(1, EntityType.Node, "myRole"));
    Relation entity = new Relation(new CommonEntityData(1, 2, new Date(0), OsmUser.NONE, 3, tags), members);

    // Cloning a writeable object should return the original object.
    Assert.assertSame("Entity was cloned", entity, entity.getWriteableInstance());

    // Get a cloned entity.
    entity.makeReadOnly();
    Relation clonedEntity = entity.getWriteableInstance();

    // Make sure we weren't assigned the original entity.
    Assert.assertNotSame("Entity was not cloned", entity, clonedEntity);
  }
}

相关文章