Re: [OpenMap Users] Fast repaint of a animated icon?

From: oland <com_at_navicon.dk>
Date: Sat, 24 Feb 2007 23:50:09 -0800 (PST)

Hi Jesper

It should work just fine with calling doPrepare as long as the layers
beneath are marked as background.

See also
http://www.nabble.com/animated-OMGraphic-performance-tf2651634.html#a7399408

Something like following should work with ok perf

public class AnimTest extends OMGraphicHandlerLayer {

    private ArrayList<OMRaster> frames = new ArrayList<OMRaster>();

    private int frameCntr = 0;

    Timer timer = null;

    public AnimTest() {
        super();
        timer = new Timer(200, new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                doPrepare();
            }
        });
    }
public void setProperties(String prefix, Properties props) {
...
OMRaster r = new OMRaster(56f, 10f, waypointIcon);
r.setRenderType(OMGraphic.RENDERTYPE_LATLON);
frames.add(r);
timer.start();
}

 public synchronized OMGraphicList prepare() {
        // return new OMGraphicList();
        OMGraphicList l = getList() == null ? new OMGraphicList() :
getList();
        l.clear();
        OMRaster r = frames.get(frameCntr++);
        r.generate(getProjection());
        l.add(r);
        if (frameCntr > frames.size() - 1)
            frameCntr = 0;
        return l;
    }
}

Regards
Carsten
-- 
View this message in context: http://www.nabble.com/Fast-repaint-of-a-animated-icon--tf3285436.html#a9141581
Sent from the OpenMap mailing list archive at Nabble.com.
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Sun Feb 25 2007 - 02:51:14 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:08 EDT