Package org.openstreetmap.osmosis.core.domain.v0_6

Examples of org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData


   */
  public void setOrigin(OSMData osmData) {
   
    if (osmData.getBounds() != null && !osmData.getBounds().isEmpty()) {
     
      Bound firstBound = osmData.getBounds().iterator().next();
     
      setOrigin(new LatLon(
          (firstBound.getTop() + firstBound.getBottom()) / 2,
          (firstBound.getLeft() + firstBound.getRight()) / 2));
     
    } else {
     
      if (osmData.getNodes().isEmpty()) {
        throw new IllegalArgumentException(
View Full Code Here


            osmuser = OsmUser.NONE;
        }
        String tagsString = (String) feature.getAttribute("tags");
        Collection<Tag> tags = OSMUtils.buildTagsCollectionFromString(tagsString);

        CommonEntityData entityData = new CommonEntityData(id, version, timestamp, osmuser,
                changeset, tags);
        if (type.equals(OSMUtils.nodeType())) {
            Point pt = (Point) feature.getDefaultGeometryProperty().getValue();
            entity = new Node(entityData, pt.getY(), pt.getX());
View Full Code Here

public class OsmDataBuilder {

  public static Node buildSampleNode(long id) {
    List<Tag> tags = Arrays.asList(new Tag[] { new Tag("highway", "traffic_signals") });
    CommonEntityData entityData = new CommonEntityData(id, 0, new Date(), new OsmUser(1, "nco"), 1l, tags);
    return new Node(entityData, 1.0d, 2.0d);
  }
View Full Code Here

    return buildSampleNode(1);
  }

  public static Way buildSampleWay(long id, long... nodeIds) {
    List<Tag> tags = Arrays.asList(new Tag[] { new Tag("highway", "residential") });
    CommonEntityData entityData = new CommonEntityData(id, 0, new Date(), new OsmUser(1, "nco"), 1l, tags);
    List<WayNode> wayNodes = new ArrayList<WayNode>();
    for (int i = 0; i < nodeIds.length; i++)
      wayNodes.add(new WayNode(nodeIds[i]));
    return new Way(entityData, wayNodes);
  }
View Full Code Here

   * Test writing out a normal Way element.
   */
  @Test
  public final void testProcessNormalWay() {
    Way way =
      new Way(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
    way.getWayNodes().add(new WayNode(1235));
    way.getWayNodes().add(new WayNode(1236));
    way.getTags().add(new Tag("waykey", "wayvalue"));
   
    testWayWriter.process(way);
View Full Code Here

   * Test writing of a Way element with no user.
   */
  @Test
  public final void testProcessWayWithNoUser() {
    Way way =
      new Way(new CommonEntityData(1234, 2, timestamp, OsmUser.NONE, 0));
    way.getWayNodes().add(new WayNode(1235));
    way.getWayNodes().add(new WayNode(1236));
    way.getTags().add(new Tag("waykey", "wayvalue"));
   
    testWayWriter.process(way);
View Full Code Here

   * Test writing out a Way element with no tags.
   */
  @Test
  public final void testProcessWayNoTags() {
    Way way =
      new Way(new CommonEntityData(1234, 2, timestamp, new OsmUser(23, "someuser"), 0));
    way.getWayNodes().add(new WayNode(1235));
    way.getWayNodes().add(new WayNode(1236));
   
    testWayWriter.process(way);
    try {
View Full Code Here

   */
  @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")
View Full Code Here

   * 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"));
   
View Full Code Here

   * Test writing of a Relation element with no user.
   */
  @Test
  public final void testProcessRelationWithNoUser() {
    Relation relation =
      new Relation(new CommonEntityData(1234, 2, timestamp, OsmUser.NONE, 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"));
   
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.