|
From: Jody G. <jod...@gm...> - 2015-03-04 22:33:23
|
Thanks for the description wbh, I am not sure I know enough about how gt-swing has set things up. I assume you want to get a new background image drawn each time pan and/or zoom occurs. Jody -- Jody Garnett On 3 March 2015 at 18:41, wbh <wan...@16...> wrote: > Jody, > sorry for the unclear description..... > ------------------what I want--------------------------- > App receives a serie of vehicle GPS data, each of which is drew by a > filled circle. But only the last GPS should be displayed on the > DirectLayer, representing the current position of the vehicle > -----------------what I do-------------------------- > Step 1 use socket to receive and send vehicle's position (Lon, Lat) > Step 2 extend DirectLayer to GpsDirectLayer, which have an ArrayList to > store all of the GPS point > Step 3 when socket receives the first GPS, get the background image of > the GPS will cover before draw it. This background image contains the map > which is covered by GPS > Step 4 Draw the first GPS by a filled circle > Step 5 When socket receives the second GPS, we need to : > (1) erase the first GPS. Draw the background image, which is saved at step > 3. So the first GPS is covered by this image > (2) Draw the second GPS > -------------------my problem------------------ > When PAN and ZOOM, all layers are redrawn (I think). So the background > image in Step 3 is no longer available. I mean, the map GPS covers is moved > by PAN or ZOOM. > ------------------How I solve-------------------- > when PAN and ZOOM, set this background image to null (so it won't be > drawn). So I have to listen the PAN and ZOOM operation, and set the > background image (it is a member variable of GpsDirectLayer) to null there > > I am not sure whether I describe my problem clearly this time > > 在 2015-03-04 06:05:57,"Jody Garnett" <jod...@gm...> 写道: > > I am not quite sure what you are stuck on. I guess that setting the > background to null asks the demo to draw it again? > > -- > Jody Garnett > > On 2 March 2015 at 18:19, wbh <wan...@16...> wrote: > >> Plus, after debug, my idea, that setting the background of the GPS is >> null after PAN or ZOOM, solves my problem. >> However, I feel this is not the best way. >> Can anybody tell me how to solve my problem? >> >> >> >> >> 在 2015-03-02 21:41:40,"wbh" <wan...@16...> 写道: >> >> Dears, >> I have a simple app which displays the vehicle's current position. >> -------------------my way------------------------ >> 1 use socket to receive and send vehicle's position (Lon, Lat) >> 2 extend DirectLayer to GpsDirectLayer, which have an ArrayList to store >> all of the GPS point >> 3 when socket receives a GPS, add it to the ArrayList and call Draw() >> method of GpsDirectLayer. In this method, erase the previous point and draw >> the latest GPS. (Thanks Michael Bedward for the FlyingSaucer demo ^^) >> 4 In eras() method, get the background of the GPS (use Raster) before >> draw it >> -------------------my problem------------------ >> If no PAN, ZOOM operation, all goes well. But when PAN and ZOOM, all >> layers are redrawn (I think). So the stored raster for the background is no >> longer available (or needed). >> What can I do to avoid this? >> My first idea is set the background is null when PAN or ZOOM is >> performed, is that the correct way? >> Thanks in advance! >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> GeoTools-GT2-Users mailing list >> Geo...@li... >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> > > > |