Package javaff.planning

Examples of javaff.planning.PlanningGraph$Node


  }


  @Override
  public void process(NodeContainer nodeContainer) {
    Node node = nodeContainer.getEntity();

    if (nodesSeen) {
      left = Math.min(left, node.getLongitude());
      right = Math.max(right, node.getLongitude());

      bottom = Math.min(bottom, node.getLatitude());
      top = Math.max(top, node.getLatitude());
    } else {
      left = node.getLongitude();
      right = node.getLongitude();
      top = node.getLatitude();
      bottom = node.getLatitude();
      nodesSeen = true;
    }

    objects.add(nodeContainer);
  }
View Full Code Here


    DatasetContext dsCtx = dataset.createReader();
   
    try {
      EntityManager<Node> nodeManager = dsCtx.getNodeManager();
      OsmUser user;
      Node node;
     
      // Create the user for edits to be performed under. This is an existing user with an
      // updated name.
      user = new OsmUser(10, "user10b");
     
      // Modify node 1 to add a new tag.
      node = nodeManager.getEntity(1).getWriteableInstance();
      node.setUser(user);
      node.getTags().add(new Tag("change", "new tag"));
      nodeManager.modifyEntity(node);
     
      // Delete node 6.
      nodeManager.removeEntity(6);
     
      // Add node 7 using the NONE user.
      node = new Node(new CommonEntityData(7, 16, buildDate("2008-01-02 18:19:20"), OsmUser.NONE, 93), -11, -12);
      node.getTags().addAll(
          Arrays.asList(new Tag[]{new Tag("created_by", "Me7"), new Tag("change", "new node")}));
      nodeManager.addEntity(node);
     
      dsCtx.complete();
     
View Full Code Here

  @Test
  public void badSortOrderVersion() throws Exception {
    ChangeSimplifier simplifier = new ChangeSimplifier();
    simplifier.setChangeSink(new NullChangeWriter());
    simplifier.initialize(new HashMap<String, Object>());
    Node node;

    node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 2), 1, 1);
    simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));

    try {
      node = new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1);
      simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
    } catch (OsmosisRuntimeException e) {
      if (e.getMessage().startsWith("Pipeline entities are not sorted")) {
        return;
      }
View Full Code Here

  @Test
  public void badSortOrderId() throws Exception {
    ChangeSimplifier simplifier = new ChangeSimplifier();
    simplifier.setChangeSink(new NullChangeWriter());
    simplifier.initialize(new HashMap<String, Object>());
    Node node;

    node = new Node(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 2), 1, 1);
    simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));

    try {
      node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 1), 1, 1);
      simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
    } catch (OsmosisRuntimeException e) {
      if (e.getMessage().startsWith("Pipeline entities are not sorted")) {
        return;
      }
View Full Code Here

  @Test
  public void badSortOrderType() throws Exception {
    ChangeSimplifier simplifier = new ChangeSimplifier();
    simplifier.setChangeSink(new NullChangeWriter());
    simplifier.initialize(new HashMap<String, Object>());
    Node node;
    Way way;
   
    way = new Way(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 2));
    simplifier.process(new ChangeContainer(new WayContainer(way), ChangeAction.Modify));

    try {
      node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 1), 1, 1);
      simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
    } catch (OsmosisRuntimeException e) {
      if (e.getMessage().startsWith("Pipeline entities are not sorted")) {
        return;
      }
View Full Code Here

          tags.add(new Tag(getStringById(i.getKeys(j)), getStringById(i.getVals(j))));
        }
        // long id, int version, Date timestamp, OsmUser user,
        // long changesetId, Collection<Tag> tags,
        // double latitude, double longitude
        Node tmp;
        long id = i.getId();
        double latf = parseLat(i.getLat()), lonf = parseLon(i.getLon());

        if (i.hasInfo()) {
          Osmformat.Info info = i.getInfo();
          tmp = new Node(new CommonEntityData(id, info.getVersion(), getDate(info),
              getUser(info), info.getChangeset(), tags), latf, lonf);
        } else {
          tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
              NOCHANGESET, tags), latf, lonf);
        }
        sink.process(new NodeContainer(tmp));

      }
View Full Code Here

        DenseInfo di = null;
        if (nodes.hasDenseinfo()) {
          di = nodes.getDenseinfo();
        }
        for (int i = 0; i < nodes.getIdCount(); i++) {
            Node tmp;
            List<Tag> tags = new ArrayList<Tag>(0);
            long lat = nodes.getLat(i) + lastLat;
            lastLat = lat;
            long lon = nodes.getLon(i) + lastLon;
            lastLon = lon;
            long id = nodes.getId(i) + lastId;
            lastId = id;
            double latf = parseLat(lat), lonf = parseLon(lon);
            // If empty, assume that nothing here has keys or vals.
            if (nodes.getKeysValsCount() > 0) {
                while (nodes.getKeysVals(j) != 0) {
                    int keyid = nodes.getKeysVals(j++);
                    int valid = nodes.getKeysVals(j++);
                    tags.add(new Tag(getStringById(keyid), getStringById(valid)));
                }
                j++; // Skip over the '0' delimiter.
            }
            // Handle dense info.
            if (di != null) {
              int uid = di.getUid(i) + lastuid; lastuid = uid;
              int userSid = di.getUserSid(i) + lastuserSid; lastuserSid = userSid;
              long timestamp = di.getTimestamp(i) + lasttimestamp; lasttimestamp = timestamp;
              int version = di.getVersion(i);
              long changeset = di.getChangeset(i) + lastchangeset; lastchangeset = changeset;

              Date date = new Date(date_granularity * timestamp);

              OsmUser user;
              if (uid < 0) {
                user = OsmUser.NONE;
              } else {
                user = new OsmUser(uid, getStringById(userSid));
              }
              tmp = new Node(new CommonEntityData(id, version, date, user, changeset, tags), latf, lonf);
            } else {
                tmp = new Node(new CommonEntityData(id, NOVERSION, NODATE, OsmUser.NONE,
                        NOCHANGESET, tags), latf, lonf);
            }
            sink.process(new NodeContainer(tmp));
        }
    }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public void process(NodeContainer nodeContainer) {
    Node node;
   
    node = nodeContainer.getEntity();
   
    nodeWriter.writeField(node.getId());
    nodeWriter.writeField(node.getVersion());
    nodeWriter.writeField(node.getUser().getId());
    nodeWriter.writeField(node.getTimestamp());
    nodeWriter.writeField(node.getChangesetId());
    nodeWriter.writeField(pointBuilder.createPoint(node.getLatitude(), node.getLongitude()));
    nodeWriter.endRecord();
   
    for (Tag tag : node.getTags()) {
      nodeTagWriter.writeField(node.getId());
      nodeTagWriter.writeField(tag.getKey());
      nodeTagWriter.writeField(tag.getValue());
      nodeTagWriter.endRecord();
    }
   
View Full Code Here

            processedNodes = new ArrayList<Node>(INSERT_BULK_ROW_COUNT_NODE);

            prmIndex = 1;
            for (int i = 0; i < INSERT_BULK_ROW_COUNT_NODE; i++) {
                Node node;

                node = nodeBuffer.remove(0);
                processedNodes.add(node);

                populateNodeParameters(bulkNodeStatement, prmIndex, node);
                prmIndex += INSERT_PRM_COUNT_NODE;
            }

            try {
                bulkNodeStatement.executeUpdate();
            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to bulk insert nodes into the database.", e);
            }

            for (Node node : processedNodes) {
                addNodeTags(node);
            }
        }

        if (complete) {
            while (nodeBuffer.size() > 0) {
                Node node;

                node = nodeBuffer.remove(0);

                populateNodeParameters(singleNodeStatement, 1, node);
View Full Code Here

            }
          }
          continue;
        }

        Node node = (Node)inode;
        if(node.getIndex() != index) continue;
        Attribute [] attrs = inode.getAttributes();
        if(attrs == null || attrs.length < 1) {
          list.add(item);
        } else {
          String data = (String)item.getData();
View Full Code Here

TOP

Related Classes of javaff.planning.PlanningGraph$Node

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.