Skip to content

Vendor options options map for rules

Ian Turton edited this page Apr 12, 2021 · 9 revisions

Description

The one bit of API change that actually requires a proposal can be summarized in: add an options map to Rule, just like the one already available for FeatureTypeStyle and Symbolizer

public interface Rule {
   // ...

    /** Determines if a vendor option with the specific key has been set on this Rule. */
    boolean hasOption(String key);

    /**
     * Map of vendor options for the Rule.
     *
     * <p>Client code looking for the existence of a single option should use {@link
     * #hasOption(String)}
     */
    Map<String, String> getOptions();
}

The usage in SLD 1.0 and 1.1 will be similar to symbolizers and rules, e.g.:

  <Rule>
    <Name>Test rule</Name>
    <PolygonSymbolizer>
      <Fill>
        <CssParameter name="fill">#A66A13</CssParameter>
      </Fill>
      <Stroke>
        <CssParameter name="stroke">#464646</CssParameter>
        <CssParameter name="stroke-width">0.6</CssParameter>
      </Stroke>
    </PolygonSymbolizer>
    <VendorOption name="myVendorOption">theValue</VendorOption>
  </Rule>

Support will be added in both SLD 1.0 and SLD 1.1 parsers, as well as in the SLD 1.0 encoder (SLD 1.1 encoding support is missing in GeoTools, binding classes are not symmetric).

Assigned to Release

Assigned to GeoTools 26. Since it's a simple addition to the API, and alternative implementations of Rule (besides RuleImpl) are not known, we might ask for a backport.

Status

Choose one of:

  • Under Discussion
  • In Progress
  • Completed
  • Rejected,
  • Deferred

Voting:

  • Andrea Aime: +1
  • Ian Turton: +1
  • Jody Garnett: +1
  • Nuno Oliveira: +1
  • Simone Giannecchini: +0
  • Torben Barsballe:

Tasks

This section is used to make sure your proposal is complete (did you remember documentation?) and has enough paid or volunteer time lined up to be a success. Use initials to indicate volunteer, or ⚠️ where volunteer is neededs. Proposals that lack resources to be successful are unlikely to be approved.

  1. Update implementation
  2. Verify with test case
  3. Remove deprecated code
  4. Documentation changes
    • API change make a note upgrading page.
    • Update the user guide with code example

API Change

Before:

import org.geotools.filter.Filter;
public void exampleMethod( DataStore store, Filter filter){
    FeatureCollection collection = store.getFeatures( filter )
     ...   
}

After:

import org.opengis.filter.Filter;
public void exampleMethod( Source source, Filter filter){
    Collection collection = source.content( filter )
    ...   
}
Clone this wiki locally