Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] [jira] Created: (UDIG-890) Default SWT line join style not suitable to render Features of type Line

Default SWT line join style not suitable to render Features of type Line
------------------------------------------------------------------------

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

  Components: map  
    Versions: UDIG 1.1.RC1    
 Environment: SWT enabled OSes (ie, Not Linux)
    Reporter: Mark Presling
 Assigned to: Jesse Eichar 
 Attachments: snapshot21.png, snapshot22.png, snapshot23.png

SWTGraphics.paint( Shape s) uses GC.drawPath() to render a Feature. If that feature is a line that has a small 'kink' or 'zig-zag' in it the line can be rendered incorrectly. See attached screenshot.

Adding gc.setLineJoin(SWT.JOIN_ROUND) to the draw command fixes this. The problem is that the default style of JOIN_MITER leaves a big long pointy exterior on the outside of the corner where the line turns back on itself.

Here is the patch that I used to correct this issue:
    public void draw( Shape s ) {
        if( Display.getCurrent() == null )
            SWT.error (SWT.ERROR_THREAD_INVALID_ACCESS);
        Path path = convertToPath(s, display);
        if( path!=null ){
            gc.setLineJoin(SWT.JOIN_ROUND);
            gc.drawPath(path);
            path.dispose();
        }
        
    }

Images:
1. snapshot23 - the offending piece of data
2. snapshot21 - what it should look like
3. snapshot22 - what it does look like with line join of miter


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



Back to the top