ColorConverterFactory change proposal
-------------------------------------
Key: GEOT-2940
URL: http://jira.codehaus.org/browse/GEOT-2940
Project: GeoTools
Issue Type: Bug
Affects Versions: 2.6.0
Environment: I made the proposed changes under windows XP sp2 and sun
java jdk-1.5.0_15.
Reporter: Xavier Rodriguez
Priority: Minor
Attachments: ColorConverterFactory.java
I need to display in a map some features with their color according to the
value of their ID. To achieve that, I defined the SLD for that layer like that:
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">
<ogc:PropertyName>ID</ogc:PropertyName>
</CssParameter>
<CssParameter name="stroke-width">
<ogc:Literal>2</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
I found out that this solution is not working depending on the dataSource ID
type. To solve that, I added an extra "If" that handles a Long data type. The
added code is the following. I also attach a the ColorConverterFactory.java.
// long to color
if ( source.equals( Long.class ) ) {
return new Converter() {
public Object convert(Object source, Class target) throws Exception {
Integer rgba = new Integer((int)((Long)source).longValue());
int alpha = 0xff000000 & rgba;
return new Color(rgba, alpha != 0 );
}
};
}
--
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
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel