use of org.opengis.geometry.BoundingBox in project GeoGig by boundlessgeo.
the class WorkingTreeInsertHelper method put.
public Node put(final ObjectId revFeatureId, final Feature feature) {
final RevTreeBuilder2 treeBuilder = getTreeBuilder(feature);
String fid = feature.getIdentifier().getID();
BoundingBox bounds = feature.getBounds();
FeatureType type = feature.getType();
final Node node = treeBuilder.putFeature(revFeatureId, fid, bounds, type);
return node;
}
use of org.opengis.geometry.BoundingBox in project GeoGig by boundlessgeo.
the class DiffBoundsTest method testReprojectToTargetCRS.
@Test
public void testReprojectToTargetCRS() throws Exception {
DiffBounds cmd = geogig.command(DiffBounds.class).setOldVersion("HEAD^").setNewVersion("HEAD");
DiffSummary<BoundingBox, BoundingBox> defaultCrs = cmd.call();
CoordinateReferenceSystem target = CRS.decode("EPSG:26986");
cmd.setCRS(target);
DiffSummary<BoundingBox, BoundingBox> reprojected = cmd.call();
assertEquals(target, reprojected.getLeft().getCoordinateReferenceSystem());
assertEquals(target, reprojected.getRight().getCoordinateReferenceSystem());
assertEquals(target, reprojected.getMergedResult().get().getCoordinateReferenceSystem());
assertFalse(defaultCrs.getLeft().isEmpty());
assertFalse(defaultCrs.getRight().isEmpty());
assertFalse(defaultCrs.getMergedResult().get().isEmpty());
ReferencedEnvelope e = new ReferencedEnvelope(defaultCrs.getLeft());
ReferencedEnvelope expected = e.transform(target, true);
assertEquals(expected, reprojected.getLeft());
}
use of org.opengis.geometry.BoundingBox in project GeoGig by boundlessgeo.
the class DiffBoundsTest method testDiffBetweenDifferentTrees.
@Test
public void testDiffBetweenDifferentTrees() {
String oldRefSpec = "HEAD~3";
String newRefSpec = "HEAD";
DiffSummary<BoundingBox, BoundingBox> diffBounds = geogig.command(DiffBounds.class).setOldVersion(oldRefSpec).setNewVersion(newRefSpec).setCRS(pointsType.getCoordinateReferenceSystem()).call();
BoundingBox bounds = diffBounds.getMergedResult().get();
assertEquals(1.0, bounds.getMinX(), 0.0);
assertEquals(1.0, bounds.getMinY(), 0.0);
assertEquals(10.0, bounds.getMaxX(), 0.0);
assertEquals(220.0, bounds.getMaxY(), 0.0);
}
use of org.opengis.geometry.BoundingBox in project GeoGig by boundlessgeo.
the class DiffBoundsTest method testReprojectToTargetBucketTree.
@Test
public void testReprojectToTargetBucketTree() throws Exception {
final int leftCount = RevTree.NORMALIZED_SIZE_LIMIT * 2;
final int rightCount = RevTree.NORMALIZED_SIZE_LIMIT * 3;
WorkingTree workingTree = geogig.getRepository().workingTree();
final String typeName = "newpoints";
final DefaultProgressListener listener = new DefaultProgressListener();
workingTree.insert(typeName, new TestFeatureIterator(typeName, leftCount), listener, null, null);
geogig.command(AddOp.class).call();
workingTree.insert(typeName, new TestFeatureIterator(typeName, rightCount), listener, null, null);
{
// sanity check
long diffFeatures = geogig.command(DiffCount.class).setOldVersion("STAGE_HEAD").setNewVersion("WORK_HEAD").call().featureCount();
assertEquals(rightCount - leftCount, diffFeatures);
}
DiffBounds cmd = geogig.command(DiffBounds.class).setOldVersion("STAGE_HEAD").setNewVersion("WORK_HEAD");
final CoordinateReferenceSystem nativeCrs = CRS.decode("EPSG:3857");
final DiffSummary<BoundingBox, BoundingBox> diffInNativeCrs = cmd.setCRS(nativeCrs).call();
CoordinateReferenceSystem targetcrs = CRS.decode("EPSG:4326", true);
cmd.setCRS(targetcrs);
DiffSummary<BoundingBox, BoundingBox> reprojected = cmd.call();
assertEquals(targetcrs, reprojected.getLeft().getCoordinateReferenceSystem());
assertEquals(targetcrs, reprojected.getRight().getCoordinateReferenceSystem());
assertEquals(targetcrs, reprojected.getMergedResult().get().getCoordinateReferenceSystem());
ReferencedEnvelope e = new ReferencedEnvelope(diffInNativeCrs.getRight());
ReferencedEnvelope expected = e.transform(targetcrs, true);
BoundingBox actual = reprojected.getRight();
assertEquals(expected, actual);
}
use of org.opengis.geometry.BoundingBox in project GeoGig by boundlessgeo.
the class DiffBoundsTest method testPathFiltering.
@Test
public void testPathFiltering() throws Exception {
insertAndAdd(l1Modified);
geogig.command(CommitOp.class).call();
insert(l2Modified);
testPathFiltering("HEAD~3", "HEAD", l1Modified.getBounds(), linesName);
testPathFiltering("HEAD", "WORK_HEAD", l2Modified.getBounds(), linesName);
testPathFiltering("HEAD~3", "HEAD~2", null, linesName);
testPathFiltering("HEAD~3", "HEAD~2", null, linesName);
String head = points1_modified_commit.getId().toString();
BoundingBox expected = points1.getBounds();
expected.include(points1_modified.getBounds());
testPathFiltering(head + "^", head, expected, pointsName);
testPathFiltering(head + "^", head, null, linesName);
testPathFiltering("HEAD^", "HEAD", null, pointsName);
}
Aggregations