use of com.vividsolutions.jts.geom.Envelope in project GeoGig by boundlessgeo.
the class RevTreeSerializationTest method assertTreesAreEqual.
private void assertTreesAreEqual(RevTree a, RevTree b) {
assertTrue(a.getId().equals(b.getId()));
assertTrue(a.buckets().equals(b.buckets()));
assertTrue(a.features().equals(b.features()));
assertTrue(a.trees().equals(b.trees()));
assertTrue(a.numTrees() == b.numTrees());
assertTrue(a.size() == b.size());
Iterator<? extends Bounded> ia;
Iterator<? extends Bounded> ib;
if (a.buckets().isPresent()) {
ia = a.buckets().get().values().iterator();
ib = b.buckets().get().values().iterator();
} else {
ia = a.children();
ib = b.children();
}
// bounds are not part of the Bounded.equals(Object) contract as its auxiliary information
while (ia.hasNext()) {
Bounded ba = ia.next();
Bounded bb = ib.next();
Envelope ea = new Envelope();
Envelope eb = new Envelope();
ba.expand(ea);
bb.expand(eb);
assertEquals(ea.getMinX(), eb.getMinX(), 1e-7D);
assertEquals(ea.getMinY(), eb.getMinY(), 1e-7D);
assertEquals(ea.getMaxX(), eb.getMaxX(), 1e-7D);
assertEquals(ea.getMaxY(), eb.getMaxY(), 1e-7D);
}
}
use of com.vividsolutions.jts.geom.Envelope in project GeoGig by boundlessgeo.
the class FeatureNodeRefFromRefspec method _call.
@Override
protected Optional<NodeRef> _call() {
Optional<RevFeature> feature = getFeatureFromRefSpec();
if (feature.isPresent()) {
RevFeatureType featureType = getFeatureTypeFromRefSpec();
RevFeature feat = feature.get();
Envelope bounds = SpatialOps.boundsOf(feat);
Node node = Node.create(NodeRef.nodeFromPath(ref), feat.getId(), featureType.getId(), TYPE.FEATURE, bounds);
return Optional.of(new NodeRef(node, NodeRef.parentPath(ref), featureType.getId()));
} else {
return Optional.absent();
/*
* new NodeRef(Node.create("", ObjectId.NULL, ObjectId.NULL, TYPE.FEATURE), "",
* ObjectId.NULL);
*/
}
}
use of com.vividsolutions.jts.geom.Envelope in project GeoGig by boundlessgeo.
the class RevTreeBuilderTest method checkTreeBounds.
private void checkTreeBounds(int size) {
RevTree tree;
Envelope bounds;
tree = tree(size).build();
bounds = SpatialOps.boundsOf(tree);
Envelope expected = new Envelope(0, size, 0, size);
assertEquals(expected, bounds);
}
use of com.vividsolutions.jts.geom.Envelope in project GeoGig by boundlessgeo.
the class ChangesetScannerTest method testParseChangeset.
@Test
public void testParseChangeset() throws Exception {
Changeset changeset = parse("1100.xml");
assertNotNull(changeset);
assertFalse(changeset.isOpen());
assertEquals(1100L, changeset.getId());
assertEquals(parseDateTime("2009-10-10T20:02:09Z"), changeset.getCreated());
assertTrue(changeset.getClosed().isPresent());
assertEquals(parseDateTime("2009-10-10T20:02:21Z"), changeset.getClosed().get().longValue());
assertEquals(26L, changeset.getUserId());
assertEquals("BMO_2009", changeset.getUserName());
assertTrue(changeset.getComment().isPresent());
assertEquals("second test upload of BMO data - see http://wiki.openstreetmap.org/wiki/BMO", changeset.getComment().get());
assertEquals(ImmutableMap.of("created_by", "bulk_upload.py/17742 Python/2.5.2"), changeset.getTags());
Envelope bounds = parseWGS84Bounds("48.4031818", "-4.4631203", "48.4058698", "-4.4589401");
assertTrue(changeset.getWgs84Bounds().isPresent());
assertEquals(bounds, changeset.getWgs84Bounds().get());
}
use of com.vividsolutions.jts.geom.Envelope in project GeoGig by boundlessgeo.
the class Bucket method toString.
@Override
public String toString() {
Envelope bounds = new Envelope();
expand(bounds);
return getClass().getSimpleName() + "[" + id() + "] " + bounds;
}
Aggregations