Re: [OpenMap Users] ServerMapTileFactory and UI responsiveness

From: Don Dietrick <dfdietrick_at_gmail.com>
Date: Mon, 15 Apr 2013 10:26:43 -0400

Hi Gary,

Ahh, if you are using the ESRIPlugIn code from below, your blocking problem is caused by it. The ESRIPlugIn is expecting to do be managed by the PlugInLayer. The PlugInLayer kicks off threads for the ESRIPlugIn's work.

I use the ShapeLayer exclusively, or the BufferedShapeLayer for smaller data files.

So you know which shape file you are loading at startup, or are you letting the user choose one?

You should be able to use the com.bbn.openmap.dataAccess.shape.EsriGraphicFactory.Header inner class to read just the Header of a shapefile and get the bounds. Something like:

        BinaryFile bf = new BinaryFile(<path to shapefile>);
        EsriGraphicFactory.Header head = new EsriGraphicFactory.Header(bf, null);

Then head has the coords for the DataBounds.

Hope this helps,

- Don


On Apr 14, 2013, at 7:05 PM, Gary Briggs wrote:

> On Tue, Apr 09, 2013 at 01:43:58PM -0400, Don Dietrick wrote:
>> Hi Gary,
>>
>> I'll have to look into this. The layer fetches the tiles in a separate thread, so the GUI shouldn't block. What OS and jdk version are you using?
>
> Don,
>
> Thanks for replying; I've been trying to build a minimal case, but
> of course, then my blocking issue doesn't manifest.
>
> Now I'm looking to see if the problem is the EsriPlugin I'm using instead
> of the ServerMapTileFactory. I'll send it to the list as soon as I have a
> minimal case.
>
> As an aside: Is there a concrete guideline as to when to use EsriPlugin
> vs ShapeFile vs EsriLayer, when I have on-disk shapefiles?
>
> Thanks,
> Gary
>
>> - Don
>>
>> On Apr 8, 2013, at 9:32 PM, Gary Briggs wrote:
>>
>>> Afternoon,
>>>
>>> I'm using openmap in a project where users can click on zip codes and
>>> an openmap window scrolls to those zip codes and highlights them.
>>>
>>> That's working great, and is very speedy. The problem I'm suffering is
>>> that as soon as I include a ServerMapTileFactory, UI responsiveness and
>>> performance plummets; it's as if the network queries are being done
>>> on the same thread as the rest of the Swing event queue, causing it to
>>> block for as long as it takes to download a tile.
>>>
>>> This demonstrates the issue:
>>>
>>> OverlayMapPanel omp = new OverlayMapPanel();
>>> MapHandler mapHandler = omp.getMapHandler();
>>> ServerMapTileFactory serverMapTileFactory =
>>> new ServerMapTileFactory("http://otile1.mqcdn.com/tiles/1.0.0/map/");
>>> // From http://developer.mapquest.com/web/products/open/map
>>> MapTileLayer mapTileLayer = new MapTileLayer(serverMapTileFactory);
>>> mapHandler.add(mapTileLayer);
>>>
>>> Dragging it around at various zoom levels soon begins to lag the rest
>>> of the UI, and any code in the rest of the UI that makes the map move
>>> a long way causes the rest of the UI to become unresponsive.
>>>
>>> For example, I have code that creates a new EsriPlugIn, then calls
>>> openMapPanel.getMapBean().setCenter(esriplugin.getDataBounds().getCenter());
>>> This essentially locks the UI until all the tiles have been loaded,
>>> which sometimes takes a while.
>>>
>>>
>>> So, the question; is there a way to get the maps download
>>> asynchronously? Or am I doing something totally wrong here?
>>>
>>> Thank-you!
>>> Gary
>>>
>>> --
>>> [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"]

--
[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 Mon Apr 15 2013 - 10:28:09 EDT

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