RE: [OpenMap Users] Can't get LocationLayer repaint to work

From: Dause, Stephen Howard CIV NSWCDD, K71 <stephen.dause_at_navy.mil>
Date: Tue, 21 Dec 2010 15:04:30 -0500

Hey there,

I had the exact same problem and asked this question a couple weeks ago. To quote Don Dietrick:

"... the problem is that the OMGraphicList isn't being generated with the new projection.

Stephen, if your layer has been added to the map, then getProjection() will give you the current projection of the map. When the OMGraphics are updated, you need to call generate(projection) on your OMGraphic list before calling repaint().

You should take a look at the com.bbn.openmap.layer.learn.BasicLayer,
read the comments, and get an idea of how OMGraphicHandlerLayers work.
 After that, you can create your own layer that extends OMGraphicHandlerLayer. When you extend that class, your layer will generally be based on an overridden prepare() method that returns an OMGraphic list for the current projection. The OMGraphicHandlerLayer sets its OMGraphicList from what is returned from the prepare() method, and you can access it using the setList() and getList() methods.

Based on what it sounds like you are doing, you would be able to call
setList(omGraphicList) on your new layer, and then call doPrepare() on your layer, which would call prepare() and repaint() on your layer for you, in a separate thread(). If you don't override prepare(), the layer will use whatever list is already set on it."

-----Original Message-----
From: mtrewartha [mailto:mdtrewar_at_gmail.com]
Sent: Tuesday, December 21, 2010 14:51
To: openmap-users_at_bbn.com
Subject: [OpenMap Users] Can't get LocationLayer repaint to work


I'm using a LocationLayer that's fed by a modified CSVLocationHandler that
fits my needs. Inside one of the location handler's methods, I have a bit of
code that looks like the following:

LocationLayer locLayer = getLayer();
Location loc = createLocation(...);
quadtree.put(loc.lat, loc.lon, loc);
locLayer.repaint();

However, my new location doesn't show up on the map until there's a
projection change (zoom, pan, etc...).

I've searched like crazy for this and it sounds like the OMGraphics for the
layer need to be regenerated using the new projection. So I tried calling
doPrepare() instead, but then my location didn't even show up after the
projection change. I've also tried getting the graphics list from the layer
and calling generate on each individual OMGraphic using the layer's
projection. Same result as doPrepare()... what am I doing wrong?
-- 
View this message in context: http://old.nabble.com/Can%27t-get-LocationLayer-repaint-to-work-tp30508737p30508737.html
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"]



--
[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 Tue Dec 21 2010 - 15:15:05 EST

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