update style interfaces to use geoapi filter - STEMLab/geotools GitHub Wiki

  • Motivation: Avoid deprecated messages using Style interfaces

  • Contact: Jesse Eichar

  • Tagline: Keeping stylish

Description

Avoid deprecated messages

  • "Style" interfaces still use org.geotools.filter.Filter ..
  • There is an existing bug report about removing all use of geotools Filter

Status

This proposal is in response to an email from Jessie. We would like the uDig code to be deprecation free (it serves as a very valuable test of GeoTools API stability if and only if it is possible to do everything without using deprecated code).

API Changes

BEFORE

This change effects imports; also a good chance to remove old FactoryFinder code where it is used to create literals etc...

AnchorPoint.java

import org.opengis.filter.expression.Expression;
interface AnchorPoint {
    ...
    void setAnchorPointX(Expression x);
    Expression getAnchorPointX();
    ...
}

AFTER

AnchorPoint.java

import org.opengis.filter.expression.Expression;
interface AnchorPoint {
    void setAnchorPointX(Expression x);
    Expression getAnchorPointX();
    ...
}

This is also a good chance to make sure the FilterFactoryFinder calls are removed:

interface AnchorPoint {
    private static final java.util.logging.Logger LOGGER = java.util.logging.Logger
        .getLogger("org.geotools.core");
    private FilterFactory filterFactory;
    private Expression anchorPointX = null;
    private Expression anchorPointY = null;

    public AnchorPointImpl() {
        this( CommonFactoryFinder.getFilterFactory( GeoTools.getDefaultHints() ) );
    }
    /**
     * Creates a new instance of DefaultAnchorPoint
     */
    public AnchorPointImpl( FilterFactory filterFactory ) {
        this.filterFactory = filterFactory; 
        try {
            anchorPointX = filterFactory.literal( 0.0 );
            anchorPointY = filterFactory.literal( 0.5 );
        } catch (org.geotools.filter.IllegalFilterException ife) {
            LOGGER.severe("Failed to build defaultAnchorPoint: " + ife);
        }
    }
}

Effected Documentation

The follow documentation pages were revised: