本文整理了Java中org.openstreetmap.osmosis.core.domain.v0_6.Relation.<init>
方法的一些代码示例,展示了Relation.<init>
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Relation.<init>
方法的具体详情如下:
包路径:org.openstreetmap.osmosis.core.domain.v0_6.Relation
类名称:Relation
方法名:<init>
[英]Creates a new instance.
[中]创建一个新实例。
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
@Override
public Relation buildEntity() {
return new Relation(id, version, timestampContainer, user, changesetId, tags, members);
}
代码示例来源:origin: openstreetmap/osmosis
/**
* Creates a new instance.
*
* @param sr
* The store to read state from.
* @param scr
* Maintains the mapping between classes and their identifiers
* within the store.
*/
public RelationContainer(StoreReader sr, StoreClassRegister scr) {
relation = new Relation(sr, scr);
}
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-core
/**
* Creates a new instance.
*
* @param sr
* The store to read state from.
* @param scr
* Maintains the mapping between classes and their identifiers
* within the store.
*/
public RelationContainer(StoreReader sr, StoreClassRegister scr) {
relation = new Relation(sr, scr);
}
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-core
/**
* {@inheritDoc}
*/
@Override
public Relation buildEntity() {
return new Relation(id, version, timestampContainer, user, changesetId, tags, members);
}
代码示例来源:origin: openstreetmap/osmosis
/**
* Creates a new instance.
*
* @param sr
* The store to read state from.
* @param scr
* Maintains the mapping between classes and their identifiers
* within the store.
*/
public RelationBuilder(StoreReader sr, StoreClassRegister scr) {
this();
initialize(new Relation(sr, scr));
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
@Override
public Relation getWriteableInstance() {
if (isReadOnly()) {
return new Relation(this);
} else {
return this;
}
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
@Override
public void process(CommonEntityData data, ResultSet resultSet) throws SQLException {
Relation relation;
relation = new Relation(data);
listener.process(relation, resultSet);
}
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
@Override
public Relation mapRow(ResultSet rs, int rowNumber) throws SQLException {
return new Relation(mapCommonEntityData(rs));
}
}
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-core
/**
* {@inheritDoc}
*/
@Override
public Relation getWriteableInstance() {
if (isReadOnly()) {
return new Relation(this);
} else {
return this;
}
}
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-apidb
/**
* {@inheritDoc}
*/
@Override
public void process(CommonEntityData data, ResultSet resultSet) throws SQLException {
Relation relation;
relation = new Relation(data);
listener.process(relation, resultSet);
}
}
代码示例来源:origin: org.openstreetmap.osmosis/osmosis-core
/**
* Creates a new instance.
*
* @param sr
* The store to read state from.
* @param scr
* Maintains the mapping between classes and their identifiers
* within the store.
*/
public RelationBuilder(StoreReader sr, StoreClassRegister scr) {
this();
initialize(new Relation(sr, scr));
}
代码示例来源:origin: openstreetmap/osmosis
/**
* {@inheritDoc}
*/
@Override
public Relation parseRecord(ResultSet resultSet) {
try {
return new Relation(
new CommonEntityData(
resultSet.getLong("id"),
resultSet.getInt("version"),
new Date(resultSet.getTimestamp("tstamp").getTime()),
buildUser(resultSet),
resultSet.getLong("changeset_id")
)
);
} catch (SQLException e) {
throw new OsmosisRuntimeException("Unable to build a relation from the current recordset row.", e);
}
}
代码示例来源: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);
}
}
代码示例来源:origin: openstreetmap/osmosis
/**
* Performs pre-test activities.
*/
@Before
public void setUp() {
OsmUser user;
List<Tag> tags;
user = new OsmUser(12, "OsmosisTest");
tags = Arrays.asList(new Tag("amenity", "bank"), new Tag("Akey", "Avalue"));
amenityNode = new Node(new CommonEntityData(1101, 0, new Date(), user, 0, tags), 1, 2);
amenityNodeContainer = new NodeContainer(amenityNode);
tags = new ArrayList<Tag>();
taglessNode = new Node(new CommonEntityData(1102, 0, new Date(), user, 0, tags), 3, 4);
taglessNodeContainer = new NodeContainer(taglessNode);
tags = Arrays.asList(new Tag("highway", "motorway"), new Tag("Bkey", "Bvalue"));
motorwayWay = new Way(new CommonEntityData(2201, 0, new Date(), user, 0, tags), new ArrayList<WayNode>());
motorwayWayContainer = new WayContainer(motorwayWay);
tags = Arrays.asList(new Tag("highway", "residential"), new Tag("Ckey", "Cvalue"));
residentialWay =
new Way(new CommonEntityData(2202, 0, new Date(), user, 0, tags), new ArrayList<WayNode>());
residentialWayContainer = new WayContainer(residentialWay);
tags = Arrays.asList(new Tag("Dkey", "Dvalue"));
testRelation =
new Relation(new CommonEntityData(3301, 0, new Date(), user, 0, tags), new ArrayList<RelationMember>());
testRelationContainer = new RelationContainer(testRelation);
}
代码示例来源: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: osmlab/atlas
@Override
public Relation convert(final AtlasPrimitiveRelation object)
{
final List<RelationMember> members = new ArrayList<>();
final RelationBean bean = object.getRelationBean();
for (int index = 0; index < bean.size(); index++)
{
members.add(new RelationMember(bean.getMemberIdentifiers().get(index),
ITEM_TYPE_TO_ENTITY_TYPE_CONVERTER.convert(bean.getMemberTypes().get(index)),
bean.getMemberRoles().get(index)));
}
return new Relation(
new CommonEntityData(object.getIdentifier(), 0, new Date(), new OsmUser(0, "osm"),
0, TAG_MAP_TO_TAG_COLLECTION_CONVERTER.convert(object.getTags())),
members);
}
代码示例来源:origin: openstreetmap/osmosis
/**
* Test writing out a Relation element with no tags.
*/
@Test
public final void testProcessRelationNoTags() {
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"));
testRelationWriter.process(relation);
try {
testBufferedWriter.flush();
} catch (IOException e) {
e.printStackTrace();
fail("IOException");
}
String[] strArray = testWriter.toString().split("\\n", 5);
assertTrue(strArray[0].matches(relationOpeningMatch));
assertTrue(strArray[1].matches(nodeMemberMatch));
assertTrue(strArray[2].matches(wayMemberMatch));
assertTrue(strArray[3].matches(relationMemberMatch));
assertTrue(strArray[4].matches(relationClosingMatch));
}
}
代码示例来源: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
/**
* 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
private void processRelations(List<Relation> relations, PbfFieldDecoder fieldDecoder) {
for (Relation relation : relations) {
org.openstreetmap.osmosis.core.domain.v0_6.Relation osmRelation;
CommonEntityData entityData;
if (relation.hasInfo()) {
entityData = buildCommonEntityData(relation.getId(), relation.getKeysList(), relation.getValsList(),
relation.getInfo(), fieldDecoder);
} else {
entityData = buildCommonEntityData(relation.getId(), relation.getKeysList(), relation.getValsList(),
fieldDecoder);
}
osmRelation = new org.openstreetmap.osmosis.core.domain.v0_6.Relation(entityData);
buildRelationMembers(osmRelation, relation.getMemidsList(), relation.getRolesSidList(),
relation.getTypesList(), fieldDecoder);
// Add the bound object to the results.
decodedEntities.add(new RelationContainer(osmRelation));
}
}
内容来源于网络,如有侵权,请联系作者删除!