You may wish to use a swing GlassPane and draw a second map consisting of
just the single feature, or better yet draw the feature into a buffered
image once, and then draw that buffered image in different locations as the
user drags. When they release you can update the data, and refresh the map.



--
Jody Garnett

On 30 May 2016 at 03:23, Anna Amat <[email protected]> wrote:

>
>
> Hi,
>
> Following the SelectionLab example I have build an application that allows
> selecting one feature and performing a drag and drop to a new position on
> the map (overiding the onMouseDragged and onMouseReleased of the
> CursorTool).
>
> However, I have problems with the refreshing of the gui while the user is
> moving the feature.
>
> This is the code I'm using:
>
> public void moveSelectedFeatures(DirectPosition2D pt) {
>         WKTReader2 wkt = new WKTReader2();
>         try {
>             featureSelected.setDefaultGeometry(wkt.read("POINT(" + (int)
> Math.round(pt.getX()) + " " + (int) Math.round(pt.getY()) +")"));
>                  ((FeatureLayer)
> mapContent.layers().get(1)).setStyle(style);
>             MapLayerEvent mple = new
> MapLayerEvent(mapContent.layers().get(1), MapLayerEvent.DATA_CHANGED);
>
>         } catch (ParseException e) {
>             e.printStackTrace();
>         }
>     }
>
>
> If I use the repaint of the map it is very slow. I see a second on blank
> image and then the new position on the map. Is there a way to repaint only
> the feature that is selected?
>
>
> Thank you for your help.
>
> Anna.
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> GeoTools-GT2-Users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to