Search in sources :

Example 1 with OSMCoordinateSequence

use of org.locationtech.geogig.osm.internal.OSMCoordinateSequence in project GeoGig by boundlessgeo.

the class BDBJEPointCache method get.

@Override
public CoordinateSequence get(List<Long> ids) {
    Preconditions.checkNotNull(ids, "ids is null");
    OSMCoordinateSequence cs = CSFAC.create(ids.size());
    DatabaseEntry key = new DatabaseEntry();
    DatabaseEntry data = new DatabaseEntry();
    for (int index = 0; index < ids.size(); index++) {
        Long nodeID = ids.get(index);
        LongBinding.longToEntry(nodeID.longValue(), key);
        OperationStatus status = database.get(null, key, data, LockMode.DEFAULT);
        if (!OperationStatus.SUCCESS.equals(status)) {
            String msg = String.format("node id %s not found", nodeID);
            throw new IllegalArgumentException(msg);
        }
        int[] c = CoordinateBinding.entryToCoord(data);
        cs.setOrdinate(index, 0, c[0]);
        cs.setOrdinate(index, 1, c[1]);
    }
    return cs;
}
Also used : OSMCoordinateSequence(org.locationtech.geogig.osm.internal.OSMCoordinateSequence) OperationStatus(com.sleepycat.je.OperationStatus) DatabaseEntry(com.sleepycat.je.DatabaseEntry)

Example 2 with OSMCoordinateSequence

use of org.locationtech.geogig.osm.internal.OSMCoordinateSequence in project GeoGig by boundlessgeo.

the class MappedPointCache method get.

@Override
public OSMCoordinateSequence get(List<Long> ids) {
    Preconditions.checkNotNull(ids, "ids is null");
    OSMCoordinateSequence sequence = index.build(ids);
    return sequence;
}
Also used : OSMCoordinateSequence(org.locationtech.geogig.osm.internal.OSMCoordinateSequence)

Example 3 with OSMCoordinateSequence

use of org.locationtech.geogig.osm.internal.OSMCoordinateSequence in project GeoGig by boundlessgeo.

the class MappedIndex method build.

public OSMCoordinateSequence build(List<Long> ids) {
    // sort();
    OSMCoordinateSequence sequence = CSFAC.create(ids.size());
    int[] coordinateBuff = new int[2];
    for (int index = 0; index < ids.size(); index++) {
        Long nodeId = ids.get(index);
        getCoordinate(nodeId, coordinateBuff);
        sequence.setOrdinate(index, 0, coordinateBuff[0]);
        sequence.setOrdinate(index, 1, coordinateBuff[1]);
    }
    return sequence;
}
Also used : OSMCoordinateSequence(org.locationtech.geogig.osm.internal.OSMCoordinateSequence)

Aggregations

OSMCoordinateSequence (org.locationtech.geogig.osm.internal.OSMCoordinateSequence)3 DatabaseEntry (com.sleepycat.je.DatabaseEntry)1 OperationStatus (com.sleepycat.je.OperationStatus)1