|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.layer.policy.AbstractProjectionChangePolicy com.bbn.openmap.layer.policy.StandardPCPolicy
public class StandardPCPolicy
ProjectionChangePolicy that uses a Layer SwingWorker to kick off a thread to call layer.prepare() and doesn't delete the OMGraphicList between projection changes. The standard behavior for simple layers that maintain a constant list of OMGraphics.
Field Summary | |
---|---|
protected boolean |
alwaysSpawnThread
A flag to tell the policy to always spawn a thread. |
protected int |
graphicCutoff
The number of OMGraphics that have to be on the layer's OMGraphicList before a thread is spawned. |
Fields inherited from class com.bbn.openmap.layer.policy.AbstractProjectionChangePolicy |
---|
layer |
Constructor Summary | |
---|---|
StandardPCPolicy()
You must set a layer at some point before using this class. |
|
StandardPCPolicy(OMGraphicHandlerLayer layer)
Don't pass in a null layer. |
|
StandardPCPolicy(OMGraphicHandlerLayer layer,
boolean alwaysSpawnThreadForPrepare)
Don't pass in a null layer. |
Method Summary | |
---|---|
boolean |
getAlwaysSpawnThread()
|
int |
getGraphicCutoff()
|
void |
projectionChanged(ProjectionEvent pe)
When the projection changes, the StandardPCPolicy sets the current projection on the layer, and calls prepare() on the layer. |
void |
setAlwaysSpawnThread(boolean val)
Tell the policy whether to spawn a thread when projectionChanged() is called with a new projection. |
void |
setGraphicCutoff(int number)
|
protected boolean |
shouldSpawnThreadForPrepare()
We're assuming that the list is somewhat constant for the layer. |
Methods inherited from class com.bbn.openmap.layer.policy.AbstractProjectionChangePolicy |
---|
getLayer, setLayer, workerComplete |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int graphicCutoff
protected boolean alwaysSpawnThread
Constructor Detail |
---|
public StandardPCPolicy()
public StandardPCPolicy(OMGraphicHandlerLayer layer)
public StandardPCPolicy(OMGraphicHandlerLayer layer, boolean alwaysSpawnThreadForPrepare)
layer
- layer to work foralwaysSpawnThreadForPrepare
- should be true if the layer's prepare
method takes a while. Normally, the policy looks at the number of
OMGraphics on the list to determine if a thread should be spawned.
True by default.Method Detail |
---|
public void setAlwaysSpawnThread(boolean val)
val
- setting for always spawning thread for every projection
change.public boolean getAlwaysSpawnThread()
public void projectionChanged(ProjectionEvent pe)
If a Layer is using this PC policy, then it's kind of assumed that the layer is setting the list and generating the same list over and over again with the new projection. So, when we look at the min and max scales set on the layer, we don't want to clear out that list if the projection scale is outside of the acceptable range of good projection scales. Instead, we want to skip the prepare() method call as to not waste CPU cycles generating things we won't see, and let the RenderPolicy check to see if the list should be painted.
pe
- The ProjectionEvent received from the MapBean.protected boolean shouldSpawnThreadForPrepare()
public void setGraphicCutoff(int number)
number
- Set the number of OMGraphics that have to be on the list
before a thread gets spawned to call generate() on them.public int getGraphicCutoff()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |