private List<TileIndex> convert( List<TileAndBinIndices> tiles ) { List<TileIndex> indices = new ArrayList<>(); for ( TileAndBinIndices tile : tiles ) { indices.add( tile.getTile() ); } return indices; }
public List<AnnotationTile> generateTiles( List<AnnotationData<?>> annotations, AnnotationIndexer indexer, TilePyramid pyramid ) { Map<TileIndex, AnnotationTile> tiles = new HashMap<>(); for ( AnnotationData<?> annotation : annotations ) { List<TileAndBinIndices> indices = indexer.getIndices( annotation, pyramid ); for ( TileAndBinIndices index : indices ) { TileIndex tileIndex = index.getTile(); BinIndex binIndex = index.getBin(); if ( tiles.containsKey( tileIndex ) ) { tiles.get( tileIndex ).addDataToBin(binIndex, annotation); } else { AnnotationTile tile = new AnnotationTile( tileIndex ); tile.addDataToBin(binIndex, annotation); tiles.put( tileIndex, tile ); } } } return new ArrayList<>( tiles.values() ); }
@Override public boolean equals (Object obj) { if (this == obj) return true; if (null == obj) return false; if (!(obj instanceof TileAndBinIndices)) return false; TileAndBinIndices tb = (TileAndBinIndices) obj; if (!_tile.equals(tb.getTile())) return false; if (!_bin.equals(tb.getBin())) return false; return true; } }
private void addDataCertificateToTiles( List<AnnotationTile> tiles, List<TileAndBinIndices> indices, AnnotationData<?> data ) { for ( TileAndBinIndices index : indices ) { // check all existing tiles for matching index boolean found = false; for ( AnnotationTile tile : tiles ) { if ( tile.getDefinition().equals( index.getTile() ) ) { // tile exists already, add data to bin tile.addDataToBin( index.getBin(), data ); found = true; break; } } if ( !found ) { // no tile exists, add tile AnnotationTile tile = new AnnotationTile( index.getTile() ); tile.addDataToBin(index.getBin(), data); tiles.add( tile ); } } }
BinIndex bin = new BinIndex(baseUBin.getX() + rx, baseUBin.getY() + ry); TileAndBinIndices tbi = TileIndex.universalBinIndexToTileBinIndex(baseTile, bin); TileData<List<Integer>> subTile = allTiles.get(b).get(tbi.getTile()); if (null != subTile) { List<Integer> subBin = subTile.getBin(tbi.getBin().getX(), tbi.getBin().getY());