Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Problem with my MapGraphic implementation. Please Help

Hi.

It sounds to me like since you want actual animation you may want to use an animation instead. For now the API is rather poor. I plan on integrating the timing framework later on. But for now look into IAnimation and AnimationUpdater to run the animation.

The problem with using an animation is that it something must start it. I'd suggest that when your map graphic is called to render it starts the animation (if it is not already running). Draw commands (and IAnimations) are drawn on the Acetate layer and are removed during certain rendering actions, such as a zoom in. Because of this you may find that you have to put a timestamp on you animation to make sure that it keeps running and isn't disposed of.

I'm not sure this email completely makes sense. Please let me know if you have a question.

Jesse

On Oct 8, 2007, at 8:57 AM, Ingmar Eveslage wrote:


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.

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top