Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] [jira] Reopened: (UDIG-694) LineSymbolizer width not being used in Drawing.paint()

     [ http://jira.codehaus.org/browse/UDIG-694?page=all ]
     
Mark Presling reopened UDIG-694:
--------------------------------


The width is still not being set into the SWTGraphics, and subsequently into the GC when drawing.paint() is called to render a Feature of type Line or Point.

>From the beginning:
1. DrawFeatureCommand.run() calls Drawing.drawFeature()
2. Drawing.drawFeature() calls overloaded Drawing.drawFeature()
3. drawFeature() calls paint()
4. paint() checks for type of symbolizer
5. If it's a LineSymbolizer the width is retrieved from the line symbolizer
6. That width is never set into the ViewportGraphics
7. g.draw() is called to render the shape

The key thing that makes this problem visible is that I have changed the default size of the line symbolizer created by Drawing.getSymbolizers(Class type, Color baseColor) from 2 to 4 so that my road segments are rendered a bit wider than the default. This is because there is no way of setting the stroke width (or type) in the DrawFeatureCommand.

Side effects:
Setting the width with the code snippet originally supplied has a flow on effect. Calling g.setStroke(ViewportGraphics.LINE_SOLID, w) then makes all subsequent line rendering use this new width. This is most evident when you use DrawFeatureCommand to render a line of size 4 and then go and use the ruler tool. The line rendered by this tool is now 4 pixels wide.

Using the following code fixes this:
                try {
                    g.setColor( c );
                    g.setStroke(ViewportGraphics.LINE_SOLID, w);
                    g.draw( shape );
                } finally {
                    g.setStroke(ViewportGraphics.LINE_SOLID, 1);
                }

But obviously this is not elegant.



> LineSymbolizer width not being used in Drawing.paint()
> ------------------------------------------------------
>
>          Key: UDIG-694
>          URL: http://jira.codehaus.org/browse/UDIG-694
>      Project: uDIG
>         Type: Bug

>   Components: map
>     Versions: UDIG 1.1.M5
>  Environment: All
>     Reporter: Mark Presling
>     Assignee: Jesse Eichar
>      Fix For: UDIG 1.1.RC0

>
>
> When using the DrawFeatureCommand to render a LineString feature on the map, I discovered that the net.refractions.udig.ui.Drawing.paint() method does not use the width attribute of the LineSymbolizer.
> Suspect code (line 289-297):
>         if( symb instanceof LineSymbolizer){
>             LineSymbolizer lineSymbolizer = (LineSymbolizer) symb;
>             Color c = SLDs.color( lineSymbolizer );
>             int w = SLDs.width( lineSymbolizer );
>             if( c != null && w > 0 ){
>                 g.setColor( c );
>                 g.draw( shape );
>             }                      
>         }
> Note that 'w' is not used to set the stroke width when rendering the shape.

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