Package org.hibernate.search.spatial.impl

Examples of org.hibernate.search.spatial.impl.Point


      Double longitude = getLongitude( value );

      if ( ( latitude != null ) && ( longitude != null ) ) {

        if ( quadTreeIndex ) {
          Point point = Point.fromDegrees( latitude, longitude );

          for ( int i = topQuadTreeLevel; i <= bottomQuadTreeLevel; i++ ) {
            luceneOptions.addFieldToDocument( SpatialHelper.formatFieldName( i, name ), SpatialHelper.getQuadTreeCellId( point, i ), document );
          }
        }
View Full Code Here


      Double longitude = getLongitude( value );

      if ( ( latitude != null ) && ( longitude != null ) ) {

        if ( spatialHashIndex ) {
          Point point = Point.fromDegrees( latitude, longitude );

          for ( int i = topSpatialHashLevel; i <= bottomSpatialHashLevel; i++ ) {
            luceneOptions.addFieldToDocument( SpatialHelper.formatFieldName( i, name ), SpatialHelper.getSpatialHashCellId( point, i ), document );
          }
        }
View Full Code Here

      Double longitude = getLongitude( value );

      if ( ( latitude != null ) && ( longitude != null ) ) {

        if ( gridIndex ) {
          Point point = Point.fromDegrees( latitude, longitude );

          for ( int i = topGridLevel; i <= bottomGridLevel; i++ ) {
            luceneOptions.addFieldToDocument( GridHelper.formatFieldName( i, name ), GridHelper.getGridCellId( point, i), document );
          }
        }
View Full Code Here

      Double longitude = coordinates.getLongitude();

      if( ( latitude != null ) && ( longitude != null ) ) {

        if( gridIndex ) {
          Point point = Point.fromDegrees( latitude, longitude );

          for ( int i = topGridLevel; i <= bottomGridLevel; i++ ) {
            luceneOptions.addFieldToDocument( GridHelper.formatFieldName( i, name ), GridHelper.getGridCellId( point, i), document );
          }
        }
View Full Code Here

* @author Nicolas Helleringer <nicolas.helleringer@novacodex.net>
*/
public class RectangleTest {
  @Test
  public void boundingBoxTest() {
    Point center = Point.fromDegrees( 45, 4 );
    Rectangle rectangle = Rectangle.fromBoundingCircle( center, 50 );

    Assert.assertEquals( 44.550339, rectangle.getLowerLeft().getLatitude(), 0.000001d );
    Assert.assertEquals( 3.359047, rectangle.getLowerLeft().getLongitude(), 0.000001d );
    Assert.assertEquals( 45.449660, rectangle.getUpperRight().getLatitude(), 0.000001d );
View Full Code Here

* @author Nicolas Helleringer <nicolas.helleringer@novacodex.net>
*/
public class PointTest {
  @Test
  public void normalizeTest() {
    Point point = Point.fromDegrees( 45, 517 );
    Assert.assertEquals( 45, point.getLatitude(), 0 );
    Assert.assertEquals( 157, point.getLongitude(), 0 );

    Point point2 = Point.fromDegrees( 0, -185 );
    Assert.assertEquals( 175, point2.getLongitude(), 0 );

    Point point3 = Point.fromDegrees( 110, 0 );
    Assert.assertEquals( 70, point3.getLatitude(), 0 );

    Point point4 = Point.fromDegrees( -110, 0 );
    Assert.assertEquals( -70, point4.getLatitude(), 0 );

    Point point5 = Point.fromDegrees( 185, 0 );
    Assert.assertEquals( -5, point5.getLatitude(), 0 );

    Point point6 = Point.fromDegrees( 90, 180);
    Assert.assertEquals( 90, point6.getLatitude(), 0 );
    Assert.assertEquals( 180, point6.getLongitude(), 0 );

    Point point7 = Point.fromDegrees( -90, -180);
    Assert.assertEquals( -90, point7.getLatitude(), 0 );
    Assert.assertEquals( 180, point7.getLongitude(), 0 );
  }
View Full Code Here

    Assert.assertEquals( 180, point7.getLongitude(), 0 );
  }

  @Test
  public void computeDestinationTest() {
    Point point = Point.fromDegrees( 45, 4 );

    Point destination = point.computeDestination( 100, 45 );

    Assert.assertEquals( 0.796432523, destination.getLatitudeRad(), 0.00001 );
    Assert.assertEquals( 0.08568597, destination.getLongitudeRad(), 0.00001 );
  }
View Full Code Here

    Assert.assertEquals( 0.08568597, destination.getLongitudeRad(), 0.00001 );
  }

  @Test
  public void distanceToPoint() {
    Point point = Point.fromDegrees( 45, 4 );
    Point point2 = Point.fromDegrees( 46, 14 );

    double distance = point.getDistanceTo( point2 );

    Assert.assertEquals( 786.7, distance, 0.1 );
  }
View Full Code Here

    Assert.assertEquals( 9, cellIndex4 );
  }

  @Test
  public void getSpatialHashCellIdTest() {
    Point point = Point.fromDegrees( 45, 4 );

    String cellId = SpatialHelper.getSpatialHashCellId( point, 5 );
    Assert.assertEquals( "0|8", cellId );

    String cellId2 = SpatialHelper.getSpatialHashCellId( point, 7 );
    Assert.assertEquals( "1|32", cellId2 );

    String cellId3 = SpatialHelper.getSpatialHashCellId( point, 14 );
    Assert.assertEquals( "128|4096", cellId3 );

    Point point2 = Point.fromDegrees( -12, -179 );

    String cellId4 = SpatialHelper.getSpatialHashCellId( point2, 5 );
    Assert.assertEquals( "-16|-3", cellId4 );

    String cellId5 = SpatialHelper.getSpatialHashCellId( point2, 7 );
View Full Code Here

    Assert.assertEquals( 15, bestSpatialHashLevel2 );
  }

  @Test
  public void projectedBoundingBoxCellsIdsInclusionTest() {
    Point center = Point.fromDegrees( 45.0d, 32.0d );
    Double radius = 50.0d;
    Assert.assertTrue( projectedBoundingBoxCellsIdsInclusionTest( center, radius ) );

    center = Point.fromDegrees( 0.0d, 0.0d );
    radius = 100.0d;
View Full Code Here

TOP

Related Classes of org.hibernate.search.spatial.impl.Point

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.