use of org.bimserver.geometry.accellerator.Octree in project BIMserver by opensourceBIM.
the class ServiceImpl method getTiles.
@Override
public List<STile> getTiles(Set<Long> roids, Set<String> excludedTypes, Set<Long> geometryIdsToReuse, Float minimumThreshold, Float maximumThreshold, Integer maxDepth) throws ServerException, UserException {
Octree octree = getBimServer().getGeometryAccellerator().getOctree(roids, excludedTypes, geometryIdsToReuse, maxDepth, minimumThreshold, maximumThreshold);
List<STile> result = new ArrayList<>();
// TODO non-breath-first is probably faster, don't think it matters for the
// client (ATM)
octree.breathFirstCounts(minimumThreshold, maximumThreshold, new NodeCounter() {
@Override
public void counted(Node node, int count) {
if (count > 0) {
STile tile = new STile();
tile.setTileId(node.getId());
tile.setNrObjects(count);
tile.setBounds(node.getBounds().toSBounds());
tile.setMinBounds(node.getMinimumBounds().toSBounds());
result.add(tile);
}
}
}, maxDepth);
return result;
}
use of org.bimserver.geometry.accellerator.Octree in project BIMserver by opensourceBIM.
the class ServiceImpl method getTileCounts.
@Override
public List<Number> getTileCounts(Set<Long> roids, Set<String> excludedTypes, Set<Long> geometryIdsToReuse, Float minimumThreshold, Float maximumThreshold, Integer maxDepth) throws ServerException, UserException {
Octree octree = getBimServer().getGeometryAccellerator().getOctree(roids, excludedTypes, geometryIdsToReuse, maxDepth, minimumThreshold, maximumThreshold);
List<Number> result = new ArrayList<>();
AtomicInteger totalObjects = new AtomicInteger(0);
// TODO non-breath-first is probably faster, don't think it matters for the
// client (ATM)
octree.breathFirstCounts(minimumThreshold, maximumThreshold, new NodeCounter() {
@Override
public void counted(Node node, int count) {
if (count > 0) {
result.add(node.getId());
result.add(count);
totalObjects.addAndGet(count);
}
}
}, maxDepth);
return result;
}
Aggregations