[udig-devel] [jira] Created: (UDIG-868) LayerImpl.setFilter() selection highlighting refresh

Mark Presling (JIRA) jira at codehaus.org
Tue Jun 27 02:52:40 PDT 2006


LayerImpl.setFilter() selection highlighting refresh
----------------------------------------------------

         Key: UDIG-868
         URL: http://jira.codehaus.org/browse/UDIG-868
     Project: uDIG
        Type: Bug

  Components: API render  
    Versions: UDIG 1.1.RC1    
 Environment: All
    Reporter: Mark Presling
 Assigned to: Jesse Eichar 
    Priority: Minor


When applying a filter to a layer using Layer.setFilter() to highlight a selected feature you can sometimes end up with multiple highlights if the filters are applied in quick succession.

This appears to be a repaint issue and can be resolved with the following patch to RenderExecutorImpl.RenderJob.run() (note that this is from an older revision of RenderExecutorImpl, but still applies to the current revision):

Index: plugins/net.refractions.udig.project/src/net/refractions/udig/project/internal/render/impl/RenderExecutorImpl.java
===================================================================
--- plugins/net.refractions.udig.project/src/net/refractions/udig/project/internal/render/impl/RenderExecutorImpl.java  (revision 19355)
+++ plugins/net.refractions.udig.project/src/net/refractions/udig/project/internal/render/impl/RenderExecutorImpl.java  (working copy)
@@ -333,6 +333,7 @@
             this.monitor = monitor;
             executor.getRenderer().setState(IRenderer.STARTING);
             try {
+                clearImage(bounds, executor);
                 startRendering(bounds, monitor);
             } catch (Throwable renderError) {

@@ -345,6 +346,25 @@
             return Status.OK_STATUS;
         }

+        protected void clearImage( Envelope bounds2, RenderExecutor executor ) {
+            if( executor.getRenderer() instanceof TilingRenderer && !executor.getContext().getGeoResource().canResolve(FeatureStore.class))
+                return;
+            if (bounds2 != null
+                    && !bounds2.contains(executor.getContext().getViewportModel().getBounds())) {
+                Point min = executor.getContext().worldToPixel(
+                        new Coordinate(bounds.getMinX(), bounds.getMinY()));
+                Point max = executor.getContext().worldToPixel(
+                        new Coordinate(bounds.getMaxX(), bounds.getMaxY()));
+                int width = Math.abs(max.x - min.x);
+                int height = Math.abs(max.y - min.y);
+                Rectangle paintArea = new Rectangle(Math.min(min.x, max.x), Math.min(min.y, max.y),
+                        width, height);
+                executor.getContext().clearImage(paintArea);
+            } else {
+                executor.getContext().clearImage();
+            }
+        }
+
         @Override
         public boolean belongsTo( Object family ) {
             if (executor.getContext() == null)



Note that the clearImage() method is a copy of the one from RedrawJob. This should be refactored out into a single method that both inner classes can get to perhaps.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



More information about the udig-devel mailing list