Search in sources :

Example 31 with PointValue

use of org.neo4j.values.storable.PointValue in project neo4j by neo4j.

the class LiteralJavaccParserTest method shouldInterpretPoint.

@Test
void shouldInterpretPoint() throws ParseException {
    PointValue point = PointValue.parse("{ x:3, y:0 }");
    assertEquals(point, parseLiteral("point({ x:3, y:0 })"));
    PointValue point3d = PointValue.parse("{ x:0, y:4, z:1 }");
    assertEquals(point3d, parseLiteral("point({ x:0, y:4, z:1 })"));
    PointValue pointWGS84 = PointValue.parse("{ longitude: 56.7, latitude: 12.78 }");
    assertEquals(pointWGS84, parseLiteral("point({ longitude: 56.7, latitude: 12.78 })"));
    assertEquals(pointWGS84.getCoordinateReferenceSystem().getName(), "wgs-84");
    assertThrows(IllegalArgumentException.class, () -> parseLiteral("point(2020)"));
    assertNull(parseLiteral("point(null)"));
}
Also used : PointValue(org.neo4j.values.storable.PointValue) Test(org.junit.jupiter.api.Test)

Example 32 with PointValue

use of org.neo4j.values.storable.PointValue in project neo4j by neo4j.

the class AppendOnlyValuesContainer method readPointArray.

private static PointArray readPointArray(ByteBuffer bb, int offset) {
    final int len = bb.getInt(offset);
    offset += Integer.BYTES;
    final PointValue[] array = new PointValue[len];
    for (int i = 0; i < len; i++) {
        final PointValue point = readPoint(bb, offset);
        array[i] = point;
        offset += Integer.BYTES + point.getCoordinateReferenceSystem().getDimension() * Double.BYTES;
    }
    return pointArray(array);
}
Also used : PointValue(org.neo4j.values.storable.PointValue)

Aggregations

PointValue (org.neo4j.values.storable.PointValue)32 Test (org.junit.jupiter.api.Test)16 ArrayList (java.util.ArrayList)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 Value (org.neo4j.values.storable.Value)9 EnumSource (org.junit.jupiter.params.provider.EnumSource)7 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)7 Transaction (org.neo4j.graphdb.Transaction)6 Pair (org.neo4j.internal.helpers.collection.Pair)6 CoordinateReferenceSystem (org.neo4j.values.storable.CoordinateReferenceSystem)6 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)5 IndexReadSession (org.neo4j.internal.kernel.api.IndexReadSession)5 Values.stringValue (org.neo4j.values.storable.Values.stringValue)5 Path (java.nio.file.Path)4 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)4 Node (org.neo4j.graphdb.Node)4 TextValue (org.neo4j.values.storable.TextValue)4 Values.pointValue (org.neo4j.values.storable.Values.pointValue)4 SpaceFillingCurve (org.neo4j.gis.spatial.index.curves.SpaceFillingCurve)3 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)3