|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.swing.RenderingExecutor
public class RenderingExecutor
This class is used by JMapPane
to handle the scheduling and running of
rendering tasks on a background thread. It functions as a single thread, non-
queueing executor, ie. only one rendering task can run at any given time and,
while it is running, any other submitted tasks will be rejected.
Whether a rendering task is accepted or rejected can be tested on submission:
ReferencedEnvelope areaToDraw = ...
Graphics2D graphicsToDrawInto = ...
boolean accepted = renderingExecutor.submit(areaToDraw, graphicsToDrawInto);
The status of the executor can also be checked at any time like this:
boolean busy = renderingExecutor.isRunning();
While a rendering task is running it is regularly polled to see if it has completed
and, if so, whether it finished normally, was cancelled or failed. The interval between
polling can be adjusted which might be useful to tune the executor for particular
applications:
RenderingExecutor re = new RenderingExecutor( mapPane );
re.setPollingInterval( 150 ); // 150 milliseconds
JMapPane
Nested Class Summary | |
---|---|
static class |
RenderingExecutor.TaskResult
Constants to indicate the result of a rendering task |
Field Summary | |
---|---|
static long |
DEFAULT_POLLING_INTERVAL
The default interval (milliseconds) for polling the result of a rendering task |
Constructor Summary | |
---|---|
RenderingExecutor(JMapPane mapPane)
Constructor. |
Method Summary | |
---|---|
void |
cancelTask()
Cancel the current rendering task if one is running |
protected void |
finalize()
|
long |
getPollingInterval()
Get the interval for polling the result of a rendering task |
boolean |
isRunning()
|
void |
setPollingInterval(long interval)
Set the interval for polling the result of a rendering task |
boolean |
submit(ReferencedEnvelope envelope,
java.awt.Rectangle paintArea,
java.awt.Graphics2D graphics)
Submit a new rendering task. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_POLLING_INTERVAL
Constructor Detail |
---|
public RenderingExecutor(JMapPane mapPane)
mapPane
- the map pane to be servicedMethod Detail |
---|
public long getPollingInterval()
public void setPollingInterval(long interval)
interval
- interval in milliseconds (values <=
0 are ignored)public boolean submit(ReferencedEnvelope envelope, java.awt.Rectangle paintArea, java.awt.Graphics2D graphics)
envelope
- the map area (world coordinates) to be renderedgraphics
- the graphics object to draw on
public void cancelTask()
public boolean isRunning()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |