Examples of PointImpl


Examples of com.spatial4j.core.shape.impl.PointImpl

                new RectangleImpl(0, 10, 0, 10,SpatialContext.GEO))
            .relation(ShapeRelation.WITHIN);
        logger.info("Your query is : {}", qb);

        qb = QueryBuilders.geoShapeQuery("location",
                new PointImpl(0, 0, SpatialContext.GEO))
                .relation(ShapeRelation.INTERSECTS);
        logger.info("Your query is : {}", qb);

        qb = QueryBuilders.geoShapeQuery("location", "New Zealand", "countries")
                .relation(ShapeRelation.DISJOINT);
View Full Code Here

Examples of com.spatial4j.core.shape.impl.PointImpl

    @Test
    public void testGeoCircle() {
        double earthCircumference = 40075016.69;
        Circle circle = ShapeBuilder.newCircleBuilder().center(0, 0).radius("100m").build();
        assertEquals((360 * 100) / earthCircumference, circle.getRadius(), 0.00000001);
        assertEquals((Point) new PointImpl(0, 0, ShapeBuilder.SPATIAL_CONTEXT), circle.getCenter());
        circle = ShapeBuilder.newCircleBuilder().center(+180, 0).radius("100m").build();
        assertEquals((360 * 100) / earthCircumference, circle.getRadius(), 0.00000001);
        assertEquals((Point) new PointImpl(180, 0, ShapeBuilder.SPATIAL_CONTEXT), circle.getCenter());
        circle = ShapeBuilder.newCircleBuilder().center(-180, 0).radius("100m").build();
        assertEquals((360 * 100) / earthCircumference, circle.getRadius(), 0.00000001);
        assertEquals((Point) new PointImpl(-180, 0, ShapeBuilder.SPATIAL_CONTEXT), circle.getCenter());
        circle = ShapeBuilder.newCircleBuilder().center(0, 90).radius("100m").build();
        assertEquals((360 * 100) / earthCircumference, circle.getRadius(), 0.00000001);
        assertEquals((Point) new PointImpl(0, 90, ShapeBuilder.SPATIAL_CONTEXT), circle.getCenter());
        circle = ShapeBuilder.newCircleBuilder().center(0, -90).radius("100m").build();
        assertEquals((360 * 100) / earthCircumference, circle.getRadius(), 0.00000001);
        assertEquals((Point) new PointImpl(0, -90, ShapeBuilder.SPATIAL_CONTEXT), circle.getCenter());
        double randomLat = (randomDouble() * 180) - 90;
        double randomLon = (randomDouble() * 360) - 180;
        double randomRadius = randomIntBetween(1, (int) earthCircumference / 4);
        circle = ShapeBuilder.newCircleBuilder().center(randomLon, randomLat).radius(randomRadius + "m").build();
        assertEquals((360 * randomRadius) / earthCircumference, circle.getRadius(), 0.00000001);
        assertEquals((Point) new PointImpl(randomLon, randomLat, ShapeBuilder.SPATIAL_CONTEXT), circle.getCenter());
    }
View Full Code Here

Examples of de.psi.telco.sumoplayer.util.PointImpl

     
      // calculate jitter if required
      if (jitter > 0){
        double jitterLon = GeoCalc.getLonOffset(p.getX(), p.getY(), jitter)*((Math.random()*2)-1);
        double jitterLat = GeoCalc.getLatOffset(p.getX(), p.getY(), jitter)*((Math.random()*2)-1);
        p = new PointImpl(p.getX()+jitterLon,p.getY()+jitterLat);
      }
     
      // call the listener
      this.listener.LocationUpdated(vehicleId, timestep, p.getX(), p.getY(), speed*3.6);
    }
 
View Full Code Here

Examples of de.psi.telco.sumoplayer.util.PointImpl

      Point out = network.lanes.get(laneId).getPositionWithin(pos);
     
      out = proj.transformInvers(out);
      return out;
    }else{
      return new PointImpl(0,0);
    }
  }
View Full Code Here

Examples of de.psi.telco.sumoplayer.util.PointImpl

        a = b;
      }
     
      // sometimes requested positions lies a bit outside the lane. dont know why.
      if (foundWithin){  // TODO: check if this is just a sumo mistake
        PointImpl startPos = new PointImpl(points.get(idx).getX(),points.get(idx).getY());
        PointImpl endPos = new PointImpl(points.get(idx+1).getX(),points.get(idx+1).getY());
        double partialLen = startPos.distance(endPos);
        double rest = pos-len;
        double fact = rest/partialLen;
       
        Vector out = startPos.add((endPos.sub(startPos).scale(fact)));
        return new PointImpl(out.getX(),out.getY());
      }else{
        return points.get(points.size()-1);    // just return last point
      }
   
    }catch(Exception e){
      e.printStackTrace();
      return new PointImpl(0,0);
    }
  }
View Full Code Here

Examples of de.psi.telco.sumoplayer.util.PointImpl

        if (coordElements != null && coordElements.length == 2){  // split by comma ( COORD1X,COORD1Y )
          try{
            double x = Double.parseDouble(coordElements[0]);
            double y = Double.parseDouble(coordElements[1]);
           
            network.lanes.get(sumoLaneId).points.add(new PointImpl(x,y));
          }catch(NumberFormatException e){
          }
        }       
      }
     
View Full Code Here

Examples of de.psi.telco.sumoplayer.util.PointImpl

        if (coordElements != null && coordElements.length == 2){  // split by comma ( COORD1X,COORD1Y )
          try{
            double x = Double.parseDouble(coordElements[0]);
            double y = Double.parseDouble(coordElements[1]);
           
            network.lanes.get(sumoLaneId).points.add(new PointImpl(x,y));
          }catch(NumberFormatException e){
          }
        }       
      }

    }else if (currentElementType == OFFSET){  // read offset. i.e:  <net-offset>-755969.000000,-5660071.000000</net-offset>
      char[] chars = new char[length]// copy stuff from sax buffer
      for (int i = 0; i<length; i++){
        chars[i] = ch[start+i];
      }
      String data = new String(chars);
      String[] vectorElements = data.split(",");
      if (vectorElements.length==2){
        network.offset = new PointImpl(Double.parseDouble(vectorElements[0]),Double.parseDouble(vectorElements[1]));
      }
    }else if (currentElementType == PROJ){  // read projection string. i.e:  <orig-proj>+proj=utm +ellps=bessel +units=m</orig-proj>
      char[] chars = new char[length]// copy stuff from sax buffer
      for (int i = 0; i<length; i++){
        chars[i] = ch[start+i];
View Full Code Here

Examples of de.psi.telco.sumoplayer.util.PointImpl

  public String projString = null;
  public Vector offset = new PointImpl(0,0);
  private Map<String,Point> junctions = new HashMap<String,Point>();
 
  public void addJunction(String id, double x, double y){
    junctions.put(id, new PointImpl(x,y));
  }
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

  // make it and test it's serialization
  public void testPointFactory() throws IOException, ClassNotFoundException {
   
    // create object, serialize, deserialize and compare results
    DirectPosition dp = new DirectPositionImpl(DefaultGeographicCRS.WGS84, new double[]{1,2});
    PointImpl point = new PointImpl(dp);
    PointImpl copy = (PointImpl) serializeAndDeSerialize(point);
    assertTrue(point.equals(copy));
  }
View Full Code Here

Examples of org.geotools.geometry.iso.primitive.PointImpl

   
    PositionFactoryImpl positionFactory = (PositionFactoryImpl) c.getComponentInstanceOfType(PositionFactory.class);
    ComplexFactoryImpl complf = (ComplexFactoryImpl) c.getComponentInstanceOfType(ComplexFactory.class);
     
    // testcreateCompositeCurve()
    PointImpl p1 = new PointImpl( positionFactory.createDirectPosition(new double[]{50, 20}) );
    PointImpl p2 = new PointImpl( positionFactory.createDirectPosition(new double[]{70, 80}) );
   
    CompositePoint comppoint1 = complf.createCompositePoint(p1);
    CompositePoint comppoint2 = complf.createCompositePoint(p2);
   
    assertNotNull(comppoint1);
    assertNotNull(comppoint2);
    double[] dp = comppoint1.getEnvelope().getLowerCorner().getCoordinate();
    assertEquals(dp[0], 50.0);
    assertEquals(dp[1], 20.0);
    dp = comppoint2.getEnvelope().getLowerCorner().getCoordinate();
    assertEquals(dp[0], 70.0);
    assertEquals(dp[1], 80.0);
   
    assertEquals(comppoint1.getCoordinateDimension(), p1.getCoordinateDimension());
    assertEquals(comppoint2.getCoordinateDimension(), p2.getCoordinateDimension());
   
    // test equals
    assertTrue(comppoint1.equals(new CompositePointImpl(p1)));
   
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.