[jira] Created: (UDIG-1641) RenderContextImpl throws exception

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (UDIG-1641) RenderContextImpl throws exception

JIRA jira@codehaus.org
RenderContextImpl throws exception
----------------------------------

                 Key: UDIG-1641
                 URL: http://jira.codehaus.org/browse/UDIG-1641
             Project: uDIG
          Issue Type: Bug
          Components: framework
    Affects Versions: UDIG 1.2.RC2
         Environment: Observed on Ubuntu 9.10 32 bit, but OS-independent
            Reporter: Ugo Taddei
            Assignee: Jody Garnett


RenderContextImpl throws exception when using a MapViewer and (indirectly) calling refesh on the render manager. This only happens when the control (UI) on which the renderer renders has zero dimensions (as it is the case when it hasn't being shown yet).

The fix is something like check for illegal dimensions before returning the image.

/**
     * Provide a BufferedImage of the correct size for the map display.
     *
     * @return BufferedImage for use by the Renderer
     */
    public BufferedImage getImage() {
   
    if (getImageSize().width < 1 || getImageSize().height < 1){
             return dummyImage;
    }
   
        return getImage(getImageSize().width, getImageSize().height);
    }

Something similar is done in getImage(int,int)

--
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

       
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
Reply | Threaded
Open this post in threaded view
|

[jira] Reopened: (UDIG-1641) RenderContextImpl fails when MapViewer not shown yet

JIRA jira@codehaus.org

     [ http://jira.codehaus.org/browse/UDIG-1641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ugo Taddei reopened UDIG-1641:
------------------------------


Fix in RenderContextImpl should be

public BufferedImage getImage() {
        Dimension size = getImageSize();
        if( size == null || size.width < 1 || size.height <1 ){
            return dummyImage; // dummy image
        }
        return getImage(size.width, size.height); // will create if needed
    }

rather than

public BufferedImage getImage() {
        Dimension size = getImageSize();
        if( size == null || size.width < 1 || size.height <1 ){
            return null; // dummy image
        }
        return getImage(size.width, size.height); // will create if needed
    }

getImage is returning null (probaly a typo, as the comment is OK).

The code generated a

java.lang.NullPointerException
        at net.refractions.udig.project.internal.render.impl.CompositeRendererImpl.refreshImage(CompositeRendererImpl.java:320)
        at net.refractions.udig.project.internal.render.impl.CompositeRendererImpl.refreshImage(CompositeRendererImpl.java:296)
        at net.refractions.udig.project.ui.internal.RenderManagerAdapters$3.updateImage(RenderManagerAdapters.java:193)
        at net.refractions.udig.project.ui.internal.RenderManagerAdapters$3.zorderChanged(RenderManagerAdapters.java:154)
        at net.refractions.udig.project.internal.ContextModelListenerAdapter.notifyChanged(ContextModelListenerAdapter.java:97)
        at net.refractions.udig.project.ui.internal.RenderManagerAdapters$3.notifyChanged(RenderManagerAdapters.java:142)
        at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280)
        at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255)
        at org.eclipse.emf.common.notify.impl.NotifyingListImpl.move(NotifyingListImpl.java:1309)
        at net.refractions.udig.project.internal.impl.LayerImpl.setZorder(LayerImpl.java:467)
        at de.fraunhofer.iais.kd.********


> RenderContextImpl fails when MapViewer not shown yet
> ----------------------------------------------------
>
>                 Key: UDIG-1641
>                 URL: http://jira.codehaus.org/browse/UDIG-1641
>             Project: uDIG
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: UDIG 1.2.RC2
>         Environment: Observed on Ubuntu 9.10 32 bit, but OS-independent
>            Reporter: Ugo Taddei
>            Assignee: Jody Garnett
>             Fix For: UDIG 1.2.RC3
>
>
> RenderContextImpl throws exception when using a MapViewer and (indirectly) calling refesh on the render manager. This only happens when the control (UI) on which the renderer renders has zero dimensions (as it is the case when it hasn't being shown yet).
> The fix is something like check for illegal dimensions before returning the image.
> /**
>      * Provide a BufferedImage of the correct size for the map display.
>      *
>      * @return BufferedImage for use by the Renderer
>      */
>     public BufferedImage getImage() {
>    
>     if (getImageSize().width < 1 || getImageSize().height < 1){
>              return dummyImage;
>     }
>    
>         return getImage(getImageSize().width, getImageSize().height);
>     }
> Something similar is done in getImage(int,int)

--
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

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