private void removeDataFromTiles( String layer, Pair<String, Long> certificate, TilePyramid pyramid ) { // read the annotation data List< Pair<String, Long> > certificates = new ArrayList<>(); certificates.add( certificate ); AnnotationData<?> data = readDataFromIO( layer, certificates ).get(0); // get list of the indices for all levels List< TileAndBinIndices > indices = _indexer.getIndices( data, pyramid ); // read existing tiles List< AnnotationTile > tiles = readTilesFromIO( layer, convert( indices ) ); // maintain lists of what bins to modify and what bins to remove List< AnnotationTile > tilesToWrite = new LinkedList<>(); List< TileIndex > tilesToRemove = new LinkedList<>(); // remove data from tiles and organize into lists to write and remove removeDataCertificateFromTiles( tilesToWrite, tilesToRemove, tiles, data, pyramid ); // write modified tiles writeTilesToIO( layer, tilesToWrite ); // remove empty tiles and data removeTilesFromIO( layer, tilesToRemove ); }
private void addDataToTiles( String layer, AnnotationData<?> data, TilePyramid pyramid ) { // get list of the indices for all levels List< TileAndBinIndices > indices = _indexer.getIndices( data, pyramid ); // get all affected tiles List< AnnotationTile > tiles = readTilesFromIO( layer, convert( indices ) ); // add new data certificate to tiles addDataCertificateToTiles( tiles, indices, data ); // write tiles back to io writeTilesToIO( layer, tiles ); // write data to io writeDataToIO( layer, data ); }