Hi Eric,
I just took a quick look at this, and added these methods to the
DayNightLayer. The doPrepare method was copied from another layer, and
calling that should kick off a DayNightWorker for you, and the layer
should update itself automatically.
I just tossed in a couple of setters and getters, just in case you need
those, too.
/**
* A method that will launch a DayNightWorker to fetch the images
* that best suit the settings in the current attributes.
*
* If you call this AND change the projection of the MapBean, you
* double the work for the layer.
*/
public void doPrepare() {
// If there isn't a worker thread working on a projection
// changed or other doPrepare call, then create a thread that
// will do the real work. If there is a thread working on
// this, then set the cancelled flag in the layer.
if (currentWorker == null) {
currentWorker = new DayNightWorker();
currentWorker.execute();
}
else setCancelled(true);
}
/**
* Get the time of the overlay.
*/
public long getOverlayTime() {
return overlayTime;
}
/**
* Set the time for the overlay.
*/
public void setOverlayTime(long ot) {
overlayTime = ot;
currentTime = false;
}
/**
* Returns whether the layer will set the overlayTime to the time
* the image is created.
*/
public boolean getCurrentTime() {
return currentTime;
}
/**
* Set whether the layer should set the overlayTime to the time
* the image is created. If the time is being set to reflect a
* time other than the current time, this needs to be set to
* false. It actually is, if you manually set the overlay time.
*/
public void setCurrentTime(boolean ct) {
currentTime = ct;
}
/**
* Get the timer being used for automatic updates. May be null if
* a timer is not set.
*/
public Timer getTimer() {
return timer;
}
/**
* If you want the layer to update itself at certain intervals,
* you can set the timer to do that. Set it to null to disable it.
*/
public void setTimer(Timer t) {
timer = t;
}
Hope this helps. If you send some GUI updates, I'll incorporate them to
the regular package!
Cheers,
Don
On Wednesday, August 8, 2001, at 05:11 PM, Jablow, Eric R. wrote:
>
> I'm trying to write a version of the DayNightLayer whose focus time can
> be
> changed under program control. Instead of either using a fixed time
> declared
> in the openmap.properties file or using the current time, updated on a
> timer, I want the user to be able to use a widget to select the time to
> display. Yet, I don't want to rewrite the layer.
>
> I've created a DateHandler bean to control the date for the entire
> system, a
> DatePopup GUI, and I've subclassed the DayNightLayer to listen for date
> changes. I put them together using the bean context, but I'm not sure
> what
> to do when the user chooses a new date. The subclass doesn't have
> access to
> currentWorker; the only thing I can figure to do is to set the overlay
> time
> and then to call actionPerformed with a null argument. It isn't working;
> nothing is redrawn.
>
> Can someone help? I'll provide source code if anyone is interested.
>
> Respectfully,
> Eric Jablow
>
> --
> [To unsubscribe to this list send an email to "majdart@bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Donald F. Dietrick, dietrick@bbn.com
BBN Technologies, 10 Moulton Street, Cambridge, MA 02138
617.873.3031 FAX 2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Wed Aug 8 17:48:15 2001
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT