[udig-devel] Problem with my MapGraphic implementation. Please Help
Ingmar Eveslage
eveslage at gmail.com
Mon Oct 8 08:57:15 PDT 2007
Hello,
I have a problem with the plugin I developed. I implemented a MapGraphic
Extension which draw rectangles on a given position on the map.
I also implemented a thread which modifies the data that is drawn and then
calls the Layer.refresh(Envelope) function to draw the MapGraphic again with
the updated data. Then the thread takes a short break, modifies the data
again and refreshes the layer again, and so on.
The MapGrahpics implementation uses double buffering and draws the hidden
painted picture (a java.awt.image.BufferedImage) in the last line of the
override draw(MapGraphicContext context) function.
All works fine, but because the MapGraphic.draw function takes some time (i
paint many rectangles, and sometime circles) it has not finished before the
"updating-thread" calls Layer.refresh again. if this happens the MapGraphics
layer gets totally blank. As i said: only if the Layer.refresh call is
before the MapGrahics.draw function finishes its last redraw.
This is very distracting, because the MapGraphic layer with all my
rectangles and circles begin to flicker and sometimes when there are many
updates the MapGraphic layer gets deleted short after its ready with
painting.
I hope someone can help me. I tried to find a way to suspend the updating
thread until the MapGraphic layer completed the draw method, but i didn't
find the right api call. after hours of debugging i could not even find the
place where the layer gets blank.
So please help me.
Thanks forward
Ingmar
For info:
I use Eclipse 3.2 and the uDig SDK 1.1RC11 on a Intel Mac.
--
View this message in context: http://www.nabble.com/Problem-with-my-MapGraphic-implementation.-Please-Help-tf4588290.html#a13096935
Sent from the udig-devel mailing list archive at Nabble.com.
More information about the udig-devel
mailing list