private int[][] apply(boolean preview) { int[][] heightmap = new int[128][128]; int step = 1; if (!preview) { parent.setProgressBar(sldIterations.getValue()); heightmap = parent.cloneArray(parent.getHeightMap()); } else { heightmap = parent.getPreviewMap(); step = (int) Math.ceil( (double) parent.getHeightMap().length / (double) parent.getPreviewMap().length); } for (int i = 0; i < sldIterations.getValue() / step; i++) { heightmap = applyThermal(heightmap); if (!preview) parent.increaseProgressBar(); } if (!preview) parent.resetProgressBar(); return heightmap; }
public void stateChanged(ChangeEvent e) { if (e.getSource().equals(sldIterations)) { txtIterations.setText(Integer.toString((int) sldIterations.getValue())); if (preview) { parent.setPreviewMap(parent.getHeightMap(), 128); parent.refreshMiniView(apply(preview)); } } }