Right :-)

We have a tutorial for uDig that does a similar "moving dot" problem. 

So it is time to dive into Java2D voodoo and reproduce the idea of a glass pane 
under your control.

Basic idea is to draw into two (or more) separate buffers yourself.

You can look up "volitile" image as a graphics mode; you can daw your two 
buffers (one for the map; and one for your visual feedback) into the live 
buffer employed by the graphics card.

http://download.oracle.com/javase/6/docs/api/java/awt/image/VolatileImage.html

Make sure to only draw your (already built) buffers in the validate( 
graphicsConfiguration ) loop; do not try doing any math or calculation as you 
draw; etc...

-- 
Jody Garnett

On Thursday, 28 April 2011 at 11:28 PM, Francesca Martelli wrote: 
> Thank you Jody, but I would like to draw directly on the screen, since
> the point changes its coordinates frequently and if I create a feature
> collection, each time I change the point, the entire map is repainted
> causing a flickering effect. The application is a kind of GPS navigator:
> there is a map (map context with a number of shapefile in UTM) and I
> need to represent a moving vehicle.
> 
> I have already tried to use the glass pane, but this does not solve the
> problem since it is not possible to clear the glass pane, so old
> positions remain painted over that. The only way I found for cleaning
> the glass pane is to set visibility to false and to true again, but this
> provokes flickering!!!
> 
> So, I was looking for a different approach...
> francesca
> 
> 
> Il giorno gio, 28/04/2011 alle 23.15 +1000, Jody Garnett ha scritto:
> > Perhaps you can define a feature collection (in memory) with your
> > point; declare the correct coordinate reference system for your UTM
> > zone (when you do this).
> > 
> > 
> > And then add that FeatureCollection to the screen as a separate layer?
> > 
> > 
> > There are a number of FeatureCollection implementations available for
> > you to work with:
> > -http://docs.geotools.org/latest/userguide/library/main/collection.html
> > 
> > 
> > The indexed one is very fast to display (but not suitable for use if
> > you are changing your point).
> > 
> > 
> > Jody
> > 
> > On Thu, Apr 28, 2011 at 10:52 PM, Francesca Martelli
> > <[email protected]> wrote:
> >  Hi all,
> >  I have a problem with translation from utm coordinates in
> >  screen pixel
> >  position. I have already seen the tutorials (world2screen,
> >  data2world...), but examples reported there seem do not work
> >  in my case.
> > 
> >  I have a mapContext with shapefiles in a jmappane, and I would
> >  like to
> >  paint a point (with position expressed in UTM coordinates)
> >  over the map.
> > 
> >  Any help is greatly appreciated.
> >  Francesca
> > 
> > 
> >  --
> >  Francesca Martelli, Computer Science Ph.D.
> >  Algorithms and Computational Mathematics Group, IIT - CNR,
> >  Pisa
> >  Phone: +39 050 315 3191 (office), +39 050 315 2333 (fax)
> > http://www.iit.cnr.it/francesca.martelli/
> >  email: [email protected]
> > 
> > 
> > 
> >  
> > ------------------------------------------------------------------------------
> >  WhatsUp Gold - Download Free Network Management Software
> >  The most intuitive, comprehensive, and cost-effective network
> >  management toolset available today. Delivers lowest initial
> >  acquisition cost and overall TCO of any competing solution.
> > http://p.sf.net/sfu/whatsupgold-sd
> >  _______________________________________________
> >  Geotools-gt2-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> 
> 
> -- 
> Francesca Martelli, Computer Science Ph.D.
> Algorithms and Computational Mathematics Group, IIT - CNR, Pisa
> Phone: +39 050 315 3191 (office), +39 050 315 2333 (fax)
> http://www.iit.cnr.it/francesca.martelli/
> email: [email protected]
> 
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to