Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] [jira] Created: (UDIG-729) Getting color for new created layer from color palette leads to exceptions

Getting color for new created layer from color palette leads to exceptions
--------------------------------------------------------------------------

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

  Components: style  
    Versions: UDIG 1.1    
    Reporter: Vitali Diatchkov
 Assigned to: Justin Deoliveira 
     Fix For: UDIG 1.1


The problem is inside of ColourScheme class.  While new layers are added to the map, ColourScheme  aquires the new color from palette (BrewerPalette class). The number of colors in palette is limited, but when the number of layers overflows this limit, there is no checkings that there are no free colors in the palette and exception happens :

ava.lang.NullPointerException
	at org.geotools.brewer.color.BrewerPalette.getColors(BrewerPalette.java:101)
	at org.geotools.brewer.color.BrewerPalette.getColor(BrewerPalette.java:59)
	at net.refractions.udig.ui.palette.ColourScheme.getColour(ColourScheme.java:220)
	at net.refractions.udig.project.internal.impl.LayerFactoryImpl$1.process(LayerFactoryImpl.java:456)
	at net.refractions.udig.core.internal.ExtensionPointUtil.process(ExtensionPointUtil.java:82)
	at net.refractions.udig.project.internal.impl.LayerFactoryImpl.createLayer(LayerFactoryImpl.java:434)
	at net.refractions.udig.project.internal.commands.AddLayersCommand.run(AddLayersCommand.java:59)
....

This leads to different following exceptions during working with map editor.

What is the desired behaviour of ColourScheme ?

I suspect the one of the obvious behavior is:
1) when the number of layers equal to the number of colors in palette, then the index of the palette is nulling and the next new  layer gets the color from the beginning of the palette. ColourScheme is responsible for the appropriate mapping. Colors are cycled.

Other approaches?..

P.S. temporarily fixed this exception inside of  LayerFactoryImpl.createDefaultStyles(..) but ColourScheme  shoud be improved.



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