Hi Hal,
I found that I needed to ensure that all 'heavy' processing is done on a
separate Thread. If you do processing on the main Thread, it will only
update the display pane when that Thread is idle.
Frank
On Tue, Jan 21, 2014 at 11:55 AM, Hal Mirsky <[email protected]> wrote:
> Thanks Jairo for the reply and hints.
>
>
>
> I’m pretty sure I’ve moved all code that 1) creates and adds the JMapPane
> the JavaFX GUI node, 2) adds layers to my JMapPane and, 3) updates the
> styles of the map layer to inside blocks such as:
>
>
>
> javafx.application.Platform.*runLater*(*new* Runnable() {
>
> *public* *void* run() {
>
> …
>
> }
>
> });
>
>
>
> So far no change in rendering. However, I did notice that adding a short
> sleep after calling setStyle seems to eliminate the problem:
>
>
>
> mylayer.setStyle(mystyle);
>
> *try* {
>
> Thread.*sleep*(100);
>
> } *catch* (InterruptedException e) {
>
> }
>
>
>
> Hal
>
>
>
> *From:* Jairo de Almeida [mailto:[email protected]]
> *Sent:* Monday, January 20, 2014 9:58 AM
> *To:* hmirsky
> *Subject:* Re: [Geotools-gt2-users] Problems to rendering the map using
> JMapPane
>
>
>
> Probably a conflict with threads that are triggered by internally-GeoTools
>
> in my case replace the addLayer by addLayers with my layers in mapcontent
> and worked
>
> deducting the threads of your code finalized the process of thread
> addLayer triggered by the GeoTools.
>
>
>
> 2014/1/20 hmirsky <[email protected]>
>
> Hello,
> I am seeing a similar problem with my geotools application. I create a map
> display with several layers created from shapefiles and additional "direct
> layers" for a scalebar, title, and legend. The styles of two of the
> shapefile layers are updated based on user action. For example, the user
> can specify a city name which causes the program to update the styles of
> the
> city polygon feature and point features that fall inside the city polygon.
>
> As shown in the attached two screen shots image1
> <http://s8.postimg.org/nrf8kh68l/image1.png> and image2
> <http://s10.postimg.org/tv7gncnop/image2.png> , some of the shapefile
> layers were not rendered properly.
>
> The problem manifests itself somewhat randomly. I've tried updating the
> styles in a background thread as shown here but that did not solve the
> issue.
>
> // this snippit is called with the GUI app's main execution thread
>
> Task mapUpdater = new Task() {
>
> @Override
> protected Object call() throws Exception {
> // these three methods call setStyle on a layer
> handler.updateSelectedPoi(setPoi);
> handler.updateSelectedZipCodes(setZip);
> handler.updateSelectedRegions(setRegion);
> return new Boolean(true);
> }
> };
>
> Thread th = new Thread(mapUpdater);
> th.setDaemon(true);
> th.start();
>
> I am using geotools 10.3, JDK8 and javafx 2.2. The geotools map pane is an
> embedded Swing Object. I have reproduced the problem in a Swing
> environment
> as well.
>
> Any suggestions are greatly appreciated,
> Hal
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Problems-to-rendering-the-map-using-JMapPane-tp5020512p5099050.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
>
>
> --
> Att...
> Jairo de Almeida
> email: [email protected]
>
> nome skype: jairodealmeida
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users