Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [udig-devel] Catalog and styles

Found it... It's not uDig, the Geotools SLDTransformer is broken (on trunk).

This is an excerpt from my original SLD:

<sld:Rule>
    <sld:Name>admin0</sld:Name>
    <sld:Title>LINE_ROAD_ADMIN_0</sld:Title>
    <sld:Abstract>Abstract</sld:Abstract>
    <ogc:Filter>
        <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>feat_type</ogc:PropertyName>
            <ogc:Literal>LINE_ROAD_ADMIN_0</ogc:Literal>
        </ogc:PropertyIsEqualTo>
    </ogc:Filter>
    <sld:MinScaleDenominator>300000</sld:MinScaleDenominator>
    <sld:MaxScaleDenominator>6000000</sld:MaxScaleDenominator>
    <sld:LineSymbolizer>
       ...
    </sld:LineSymbolizer>
</sld:Rule> 

This gets parsed into a Style, which is added to the StyleBlackboard. But the Memento created by SLDTransformer looks like this:

<sld:Rule>
    <sld:Name>admin0</sld:Name>
    <sld:Title>LINE_ROAD_ADMIN_0</sld:Title>
    <sld:Abstract>Abstract</sld:Abstract>
        <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>feat_type</ogc:PropertyName>
            <ogc:Literal>LINE_ROAD_ADMIN_0</ogc:Literal>
        </ogc:PropertyIsEqualTo>
    <sld:MinScaleDenominator>300000</sld:MinScaleDenominator>
    <sld:MaxScaleDenominator>6000000</sld:MaxScaleDenominator>
    <sld:LineSymbolizer>
       ...
    </sld:LineSymbolizer>
</sld:Rule> 


i.e. the <ogc:Filter> tags are missing, and after reopening uDig and loading the memento from the *.umap file, this is what is left:

<sld:Rule>
    <sld:Name>admin0</sld:Name>
    <sld:Title>LINE_ROAD_ADMIN_0</sld:Title>
    <sld:Abstract>Abstract</sld:Abstract>
    <sld:MinScaleDenominator>300000</sld:MinScaleDenominator>
    <sld:MaxScaleDenominator>6000000</sld:MaxScaleDenominator>
    <sld:LineSymbolizer>
       ...
    </sld:LineSymbolizer>
</sld:Rule> 


Moreover, my original

<sld:SemanticTypeIdentifier>generic:geometry</sld:SemanticTypeIdentifier>

gets transformed into 

<sld:SemanticTypeIdentifier>generic:geometry</sld:SemanticTypeIdentifier>  <sld:SemanticTypeIdentifier>ANY</sld:SemanticTypeIdentifier>

I'm not sure if that is a problem.

To fix this problem, I changed SLDTransformer.SLDTranslator.visit(Rule), replacing

filterTranslator.encode(filter)

by

element("Filter", filter).


With that change, my styles work as they should even after resurrection from the memento.

As an aside, I still think the behaviour of uDig is a bit counterintuitive. You can edit an SLD in the Change Style dialog, but when you close and reopen the dialog, what you get back is not the content you edited, but the result of a roundtrip SLD -> Style -> SLD transformation, and even if the SLDTransformer were 100 % correct, you would lose all XML comments and formatting.

Regards,

Harald



> -----Ursprüngliche Nachricht-----
> Von: udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx 
> [mailto:udig-devel-bounces@xxxxxxxxxxxxxxxxxxxxx] Im Auftrag 
> von Jesse Eichar
> Gesendet: Donnerstag, 13. November 2008 13:44
> An: User-friendly Desktop Internet GIS
> Betreff: Re: [udig-devel] Catalog and styles
> 
> That is indeed odd.  At least on 1.1  If the IGeoResource 
> resolved to  
> a Style then when a layer is created the style is set on that 
> layer.   
> When a map is closed the style is written into the map file 
> and when the map is openned again the style is read from the 
> file.  The catalog shouldn't interfere with styling except 
> during saving.  However.  I have noticed that a few types of 
> styles can cause problems.  On 1.1 I made some changes so 
> filters with a Logic filter that with a null filter child 
> won't cause a failure.  But perhaps on trunk that bug still exists.
> 
> So I guess I suggest looking at the style and check the error log.
> 
> Jesse
> 
> 
> On 12-Nov-08, at 6:38 PM, Wellmann, Harald wrote:
> 
> > How does the catalog interact with services and associated styles?
> >
> > I'm working with my own IService (which resolves to 
> DataStore) and my 
> > own IGeoResources (which resolve to FeatureSource and Style). The 
> > style is constructed from an SLD resource in my plugin. I 
> want all my 
> > resources to have a predefined style, and the user is not 
> supposed to 
> > change it.
> >
> > This works fine when I first create a map. When I close and restart 
> > uDig, somehow the catalog intervenes, and the control flow is 
> > different, my default style creation never gets executed, 
> and my map 
> > layers are rendered with some fallback style created by uDig.
> >
> > How can I make sure that the catalog not only remembers my services 
> > but also the associated styles? Or how can I disable the 
> catalog? (I 
> > must admit I do not really understand what it is good for, at least 
> > not for file-based datastores...)
> >
> > Regards,
> >
> > Harald
> >
> > *******************************************
> > innovative systems GmbH Navigation-Multimedia
> > Geschaeftsfuehrung: Edwin Summers - Kevin Brown - Regis Baudot Sitz 
> > der Gesellschaft: Hamburg - Registergericht: Hamburg HRB 59980
> >
> > *******************************************
> > Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte 
> > Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
> > E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den 
> > Absender und loeschen Sie diese Mail. Das unerlaubte Kopieren sowie 
> > die unbefugte Weitergabe dieser Mail ist nicht gestattet.
> > This e-mail may contain confidential and/or privileged 
> information.  
> > If you are not the intended recipient (or have received 
> this e-mail in 
> > error) please notify the sender immediately and delete this 
> e- mail. 
> > Any unauthorized copying, disclosure or distribution of the 
> contents 
> > in this e-mail is strictly forbidden.
> > *******************************************
> > _______________________________________________
> > User-friendly Desktop Internet GIS (uDig) 
> http://udig.refractions.net 
> > http://lists.refractions.net/mailman/listinfo/udig-devel
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig) 
> http://udig.refractions.net 
> http://lists.refractions.net/mailman/listinfo/udig-devel
> 


Back to the top