Package org.openstreetmap.osmosis.pgsnapshot.common

Examples of org.openstreetmap.osmosis.pgsnapshot.common.NodeLocation


   *
   * @param node
   *            The node to add.
   */
  public void addNodeLocation(Node node) {
    locationStore.addLocation(node.getId(), new NodeLocation(node.getLongitude(), node.getLatitude()));
  }
View Full Code Here


     * @param nodeId
     *             Id of the node.
     * @return Point object
     */
    public Point createPoint(long nodeId) {
      NodeLocation nodeLocation = locationStore.getNodeLocation(nodeId);
        Point point = new Point(nodeLocation.getLongitude(), nodeLocation.getLatitude());
        point.srid = 4326;

        return point;
    }
View Full Code Here

    left = 0;
    right = 0;
    bottom = 0;
    top = 0;
    for (WayNode wayNode : way.getWayNodes()) {
      NodeLocation nodeLocation;
      double longitude;
      double latitude;
     
      nodeLocation = locationStore.getNodeLocation(wayNode.getNodeId());
      longitude = nodeLocation.getLongitude();
      latitude = nodeLocation.getLatitude();
     
      if (nodeLocation.isValid()) {
        if (nodesFound) {
          if (longitude < left) {
            left = longitude;
          }
          if (longitude > right) {
View Full Code Here

  public LineString createWayLinestring(Way way) {
    List<Point> linePoints;
   
    linePoints = new ArrayList<Point>();
    for (WayNode wayNode : way.getWayNodes()) {
      NodeLocation nodeLocation;
     
      nodeLocation = locationStore.getNodeLocation(wayNode.getNodeId());
 
      if (nodeLocation.isValid()) {
        linePoints.add(new Point(nodeLocation.getLongitude(), nodeLocation.getLatitude()));
      } else {
        return null;
      }
    }
    return createLinestring(linePoints);
View Full Code Here

      // The longitude and latitude must be different values to ensure they don't get mixed up.
      longitude = FixedPrecisionCoordinateConvertor.convertToDouble(1 << (i % 32));
      latitude = FixedPrecisionCoordinateConvertor.convertToDouble(1 << ((i + 1) % 32));
     
      // Add the location to the store but leave every node invalid.
      store.addLocation(i * 2, new NodeLocation(longitude, latitude));
    }
   

    // Verify that the data from the store matches.
    for (int i = 0; i < 100000; i++) {
      double longitude;
      double latitude;
      NodeLocation location;
     
      // Stores typically use fixed precision storage therefore ensure we
      // have a good spread of values.
      // The longitude and latitude must be different values to ensure they don't get mixed up.
      longitude = FixedPrecisionCoordinateConvertor.convertToDouble(1 << (i % 32));
      latitude = FixedPrecisionCoordinateConvertor.convertToDouble(1 << ((i + 1) % 32));
     
      location = store.getNodeLocation(i * 2);
      Assert.assertTrue("The node location should be valid.", location.isValid());
      Assert.assertEquals("The longitude is incorrect.", longitude, location.getLongitude(), 0);
      Assert.assertEquals("The latitude is incorrect.", latitude, location.getLatitude(), 0);
     
      location = store.getNodeLocation((i * 2) + 1);
      Assert.assertFalse("The node location should be invalid.", location.isValid());
    }
   
    store.release();
  }
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.pgsnapshot.common.NodeLocation

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.