PS. forgot to mention that another, simpler option for doing grid /
feature layer creation on a separate thread is to use the Java
On 6 December 2012 16:00, Michael Bedward <michael.bedward@...> wrote:
> Hi Jairo,
> I've had a quick look at your program. I don't have time to examine it
> in detail (MainFrame.java is 1600 lines of code) but here are some
> general observations which I hope will help to get it working...
> The code for adding grid layers and updating the MapContent (via your
> LayerController class) and screen display is very complex and involves
> multiple repaint() calls in different methods / classes. This code
> could be refactored to be much simpler with any required repaint
> requests centralized.
> JMapPane should repaint automatically when a new layer is added to the
> map content (unless you override the event system to prevent this) so
> you might find you don't need to explicitly call repaint.
> You should always avoid doing processing, such as creating the vector
> grid and the associated FeatureLayer, on the event dispatch thread.
> Ideally you would use a separate thread (e.g. provided by an
> ExecutorService) and pass it a Callable object to do the grid creation
> etc. If you need to know when the grid layer has been created you can
> use a CountDownLatch or polling of a Future object (returned when the
> task is submitted to the executor service). But once again, the map
> pane should receive an event from MapContent when a layer is added so
> perhaps you might not need to do any polling other than to set a busy
> cursor etc.
> I think if you work on reducing the complexity of the code and keep
> processing off the event dispatch thread the display problems will be
> I'm happy to try to answer further specific questions about it, but
> don't have time to help you rewrite / refactor the code - that would
> be a case for commercial support (some links for support options are
> on the GeoTools web site).
> Hope that helps a bit,
> On 6 December 2012 02:31, Jairo de Almeida <jairodealmeida@...> wrote:
>> Hi Michael
>> Sorry to reply to you directly,
>> I separated a simple project in this link:
>> And this link have a data used:
>> I'm creating a rectangles layer with the tool from my application
>> I Created a grid with 200 rows and 200 cols and 10 m
>> Two i create a grid with 10 rows and 10 cols and 200m
>> When i click in the map panel with this grid tool my map renderer don't is
>> 2012/12/5 Michael Bedward <michael.bedward@...>
>>> Hi Jairo,
>>> Please reply to the list, not to me directly
>>> > You're right, don't is correct repaint panel in paintComponent method,
>>> > But is this was a crazy tentative to solve this problem
>>> > The rendering problem persist
>>> > http://s10.postimage.org/ghj8au16x/geotools_image2.png
>>> > I don't have any idea to solve this problem, Could you help me?
>>> It's hard to say more without being able to reproduce the problem
>>> here. If you can provide a *small* example (code plus data) which
>>> displays the problem I'll have a look at it.
>> Sem mais...
>> Jairo de Almeida
>> email: jairodealmeida@...
>> msn: jairodealmeida@...
>> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
>> Remotely access PCs and mobile devices and provide instant support
>> Improve your efficiency, and focus on delivering more value-add services
>> Discover what IT Professionals Know. Rescue delivers
>> GeoTools-GT2-Users mailing list