private List<TileIndex> copyUp (TileIndex root, List<TileIndex> indexBuffer) throws IOException { if (_parameters._minLevel <= root.getLevel()) { indexBuffer.add(root); indexBuffer = checkBuffer(indexBuffer); indexBuffer = copyUp(TileIndex.getParent(root), indexBuffer); } return indexBuffer; }
private List<TileIndex> copyDown (TileIndex root, List<TileIndex> indexBuffer) throws IOException { if (_parameters._maxLevel >= root.getLevel()) { indexBuffer.add(root); indexBuffer = checkBuffer(indexBuffer); for (TileIndex child: TileIndex.getChildren(root)) { indexBuffer = copyDown(child, indexBuffer); } } return indexBuffer; }
private List<TileIndex> checkBuffer (List<TileIndex> indexBuffer) throws IOException { if (indexBuffer.size() >= _parameters._blockSize) { doCopy(indexBuffer); return new ArrayList<>(); } else { return indexBuffer; } }
JSONObject props = null; try { props = readJSONFile(propFile); } catch (IOException | JSONException e1) { FactoryProvider<PyramidIO> pioFactoryProvider = getPyramidIOFactoryProvider(); FactoryProvider<TileSerializer<?>> tsFactoryProvider = getTileSerializerFactoryProvider(); CopyParameters params = paramFactory.produce(CopyParameters.class); CopyPyramid<?> copier = new CopyPyramid(source, destination, serializer, params); System.out.println("Starting pyramid copy at "+new Date()); copier.copy(params._indices); System.out.println("Pyramid copy finished at "+new Date()); } catch (ConfigurationException e) {
public void copy (List<TileIndex> rootTiles) throws IOException { _source.initializeForRead(_parameters._sourceId, _parameters._width, _parameters._height, null); _destination.initializeForWrite(_parameters._destinationId); String metaData = _source.readMetaData(_parameters._sourceId); if (null != metaData) _destination.writeMetaData(_parameters._destinationId, metaData); List<TileIndex> toCopy = new ArrayList<>(); for (TileIndex root: rootTiles) { toCopy = copyUp(root, toCopy); toCopy = copyDown(root, toCopy); } doCopy(toCopy); }