10 |
import org.geotools.renderer.RenderListener; |
import org.geotools.renderer.RenderListener; |
11 |
import org.opengis.feature.simple.SimpleFeature; |
import org.opengis.feature.simple.SimpleFeature; |
12 |
|
|
13 |
|
import schmitzm.geotools.gui.XMapPane; |
14 |
|
|
15 |
/** |
/** |
16 |
* This class is used by {@link XMapPane} to start and stop the rendering a |
* This class is used by {@link XMapPane} to start and stop the rendering a |
17 |
* {@link Thread} for rendering. |
* {@link Thread} for rendering. |
18 |
*/ |
*/ |
19 |
class RenderingExecutor { |
public class RenderingExecutor { |
20 |
private final static Logger LOGGER = Logger.getLogger(RenderingExecutor.class); |
private final static Logger LOGGER = Logger.getLogger(RenderingExecutor.class); |
21 |
/** |
/** |
22 |
* Instance to a {@link RenderThread} doing any work. It's volatile so the |
* Instance to a {@link RenderThread} doing any work. It's volatile so the |
123 |
|
|
124 |
@Override |
@Override |
125 |
public void run() { |
public void run() { |
126 |
|
long startT = System.currentTimeMillis(); |
127 |
try { |
try { |
128 |
renderer.addRenderListener(this); |
renderer.addRenderListener(this); |
129 |
LOGGER.debug("start rendering..."); |
// LOGGER.debug("start rendering..."); |
130 |
|
|
131 |
// Clear the graphics context |
// Clear the graphics context |
132 |
graphics.setBackground(mapPane.getMapBackgroundColor()); |
graphics.setBackground(mapPane.getMapBackgroundColor()); |
138 |
// Kill the reference to this Thread so #isRunning will say |
// Kill the reference to this Thread so #isRunning will say |
139 |
// false directly |
// false directly |
140 |
renderThread = null; |
renderThread = null; |
141 |
mapPane.onRenderingCompleted(); |
mapPane.onRenderingCompleted(System.currentTimeMillis()-startT); |
142 |
} catch (Exception e) { |
} catch (Exception e) { |
143 |
mapPane.onRenderingFailed(e); |
mapPane.onRenderingFailed(e); |
144 |
} finally { |
} finally { |