Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Problem with custom SLD style

I was meaning in the layers view; see in your stack trace this line?
- at net.refractions.udig.ui.graphics.Glyph$6.getImageData(Glyph.java:363)

That Glyph class is only used by the Layers view so it can have something to show for your layer. I think if your style is so much fun; it should focus on just showing the correct shape (point, line, polygon). At least for the short term :-)  I could try and ask it to go through your function and return the first color it sees - in your example that would be #FFBB55.  That would at least allow it to show something different if you have more than one style.

Jody

On 06/08/2010, at 11:14 PM, Lukasz Stawicki wrote:

> Jody,
> 
> This error appears even if I do not have 'Legend' layer created.
> 
> regards
> 
> Lukasz
> 
> Cytowanie Jody Garnett <jody.garnett@xxxxxxxxx>:
> 
>> It is just for the legend graphic I think.
>> 
>> 
>> 
>> On 06/08/2010, at 7:31 PM, Lukasz Stawicki <stl@xxxxxxxxxx> wrote:
>> 
>>> Jody,
>>> 
>>> I feel that catching an error and then drawing b&w is not a perfect solution - as I refer inside the function to attributes of feature I want to draw, maybe just use the real feature to be drawn, not the fake one?
>>> 
>>> Here is problematic part of my SLD. It is for some electrodevice, and I do not know default uDig dataset at all, so you would need to change property name and literals for limits.
>>> 
>>> Lukasz
>>> 
>>> 
>>>                   <sld:LineSymbolizer>
>>>                       <sld:Stroke>
>>>                           <sld:CssParameter name="stroke">
>>>                               <ogc:Function name="if_then_else">
>>>                                   <ogc:Function name="lessThan">
>>>                                       <ogc:PropertyName>VOLTAGE_ID</ogc:PropertyName>
>>>                                       <ogc:Literal>3</ogc:Literal>
>>>                                   </ogc:Function>
>>>                                   <ogc:Literal>#FFBB55</ogc:Literal>
>>>                                   <ogc:Function name="if_then_else">
>>>                                       <ogc:Function name="lessThan">
>>>                                           <ogc:PropertyName>VOLTAGE_ID</ogc:PropertyName>
>>>                                           <ogc:Literal>7</ogc:Literal>
>>>                                       </ogc:Function>
>>>                                       <ogc:Literal>#F78484</ogc:Literal>
>>>                                       <ogc:Literal>#5C993C</ogc:Literal>
>>>                                   </ogc:Function>
>>>                               </ogc:Function>
>>>                           </sld:CssParameter>
>>>                           <sld:CssParameter name="stroke-linecap">
>>>                               <ogc:Literal>butt</ogc:Literal>
>>>                           </sld:CssParameter>
>>>                           <sld:CssParameter name="stroke-linejoin">
>>>                               <ogc:Literal>miter</ogc:Literal>
>>>                           </sld:CssParameter>
>>>                           <sld:CssParameter name="stroke-opacity">
>>>                               <ogc:Literal>1</ogc:Literal>
>>>                           </sld:CssParameter>
>>>                           <sld:CssParameter name="stroke-width">
>>>                               <ogc:Literal>3</ogc:Literal>
>>>                           </sld:CssParameter>
>>>                           <sld:CssParameter name="stroke-dasharray">4 4</sld:CssParameter>
>>>                       </sld:Stroke>
>>>                   </sld:LineSymbolizer>
>>> 
>>> 
>>> Cytowanie Jody Garnett <jody.garnett@xxxxxxxxx>:
>>> 
>>>> Oh cool.
>>>> 
>>>> Yeah the glphy code creates a fake feature in the hopes of drawing
>>>> something "in your style". We should put some catch statements around
>>>> that and perhaps draw the feature in B&W if we were unable to figure
>>>> out  the style?
>>>> 
>>>> Lukasz can you sort out a way for us to reproduce the problem with the
>>>> default dataset? perhaps just an SLD we can cut and paste into the
>>>> style editor?
>>>> 
>>>> Jody
>>>> 
>>>> 2010/8/6 Lukasz Stawicki <stl@xxxxxxxxxx>:
>>>>> Hi,
>>>>> 
>>>>> I used <ogc:Function name="Categorize"> instead of if_then_else. Anyway, it
>>>>> crashes in CategorizeFunction.java line 152:
>>>>> 
>>>>> String lookupValue = lookupExp.evaluate(object, String.class);
>>>>> 
>>>>> Object is null - I debugged it up and finally digged what a object is
>>>>> evaluated. net.refractions.udig.ui.graphics.Glyph.java, line 363.
>>>>> 
>>>>> 
>>>>>               d.drawDirect( image, display,
>>>>>                       d.feature(d.line(new int[]{0,12, 6,3, 11,12, 15,3})),
>>>>>                       rule );
>>>>> 
>>>>> Line is created for line symbolizer, and as this line is not a feature, it
>>>>> causes side-effects. I also checked that if_then_else comes into problems
>>>>> just in the same place.
>>>>> 
>>>>> Any help would be greatly appreciated.
>>>>> 
>>>>> regards
>>>>> 
>>>>> Lukasz
>>>>> 
>>>>> Cytowanie Jody Garnett <jody.garnett@xxxxxxxxx>:
>>>>> 
>>>>>> Please keep discussion on the list (that way I can be corrected by others
>>>>>> :-D ).
>>>>>> 
>>>>>> Sorry for the quick message before; was focused on getting a bug report
>>>>>> in. I was not being intentionally opaque - the geotools website is down for
>>>>>> me as well.
>>>>>> 
>>>>>> Looking at the code the functions are:
>>>>>> - CategorizeFunction
>>>>>> - InterpolateFunction
>>>>>> - RecodeFunction
>>>>>> 
>>>>>> Example docs for the first one:
>>>>>> Implementation of "Categorize" as a normal function.
>>>>>> 
>>>>>> This implementation is compatible with the Function interface; the
>>>>>> parameter list can be used to set the threshold values etc...
>>>>>> 
>>>>>> This function expects:
>>>>>> 
>>>>>> PropertyName; use "Rasterdata" to indicate this is a color map
>>>>>> Literal: lookup value
>>>>>> Literal: threshold 1
>>>>>> Literal: value 1
>>>>>> Literal: threshold 2
>>>>>> Literal: value 2
>>>>>> Literal: (Optional) succeeding or preceding
>>>>>> For more details please look at the Symbology Encoding specification
>>>>>> (which provides the definition of these functions and examples.
>>>>>> 
>>>>>> Best thing to do is look at test cases:
>>>>>> -
>>>>>> http://svn.osgeo.org/geotools/trunk/modules/library/render/src/test/java/org/geotools/filter/
>>>>>> 
>>>>>> Here is an example from the test cases:
>>>>>> 
>>>>>>       final String[] categories = {"low", "mid", "high", "super"};
>>>>>>       final Double[] thresholds = {0.0, 50.0, 100.0};
>>>>>>       setupParameters(categories, thresholds);
>>>>>> 
>>>>>>       Function fn = finder.findFunction("categorize", parameters);
>>>>>> 
>>>>>> Cheers,
>>>>>> Jody
>>>>>> 
>>>>>> 
>>>>>> On 05/08/2010, at 7:00 PM, Lukasz Stawicki wrote:
>>>>>> 
>>>>>>> Jody,
>>>>>>> 
>>>>>>> I know I can use more <sld:Rule...> entries instead of using
>>>>>>> <ogc:Function name="if_then_else"> but this will make my SLD file 10 times
>>>>>>> longer (and unable to maintain it). What are the other options for managing
>>>>>>> colors?
>>>>>>> 
>>>>>>> regards
>>>>>>> 
>>>>>>> Lukasz
>>>>>>> 
>>>>>>> 
>>>>>>> Cytowanie Jody Garnett <jody.garnett@xxxxxxxxx>:
>>>>>>> 
>>>>>>>> The GeoTools website was hacked last month; I think the DNS is being
>>>>>>>> updated now to point to a new server.
>>>>>>>> 
>>>>>>>> As for your example; you are doing a lot of work to map colours?  There
>>>>>>>> is a couple of color lookup functions available now
>>>>>>>> which should make it easier.
>>>>>>>> 
>>>>>>>> I have reported your issue here:
>>>>>>>> - https://jira.codehaus.org/browse/GEOT-3234
>>>>>>>> 
>>>>>>>> On 05/08/2010, at 4:14 PM, Lukasz Stawicki wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> java.lang.IllegalArgumentException: Filter Function problem for
>>>>>>>>> function if_then_else argument #0 - expected type boolean
>>>>>>>>>       at
>>>>>>>>> org.geotools.filter.function.FilterFunction_if_then_else.evaluate(FilterFunction_if_then_else.java:45)
>>>>>>>>>       at
>>>>>>>>> org.geotools.filter.expression.ExpressionAbstract.evaluate(ExpressionAbstract.java:63)
>>>>>>>>>       at org.geotools.styling.SLD.color(SLD.java:1312)
>>>>>>>>>       at org.geotools.styling.SLD.color(SLD.java:96)
>>>>>>>>>       at org.geotools.styling.SLD.lineColor(SLD.java:84)
>>>>>>>>>       at org.geotools.styling.SLD.color(SLD.java:188)
>>>>>>>>>       at net.refractions.udig.ui.Drawing.paint(Drawing.java:308)
>>>>>>>>>       at net.refractions.udig.ui.Drawing.drawFeature(Drawing.java:246)
>>>>>>>>>       at net.refractions.udig.ui.Drawing.drawFeature(Drawing.java:223)
>>>>>>>>>       at net.refractions.udig.ui.Drawing.drawDirect(Drawing.java:150)
>>>>>>>>>       at
>>>>>>>>> net.refractions.udig.ui.graphics.Glyph$6.getImageData(Glyph.java:363)
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 
> 



Back to the top