Hi Andrea and list,

The next chapter in the app-schema + WMS saga.

In the streaming renderer code there are some assumptions in conflict with polymorphism. In particular, I'm struggling with following code:

|private Filter createBBoxFilters(FeatureType schema, String[] attributes,
List<ReferencedEnvelope> bboxes) throws IllegalFilterException {
        Filter filter = Filter.INCLUDE;
        final int length = attributes.length;
        PropertyDescriptor attType;

        for (int j = 0; j < length; j++) {
            attType = schema.getDescriptor(attributes[j]);

            // DJB: added this for better error messages!
            if (attType == null) {
                if (LOGGER.isLoggable(Level.FINE))
LOGGER.fine(new StringBuffer("Could not find '").append(
                            attributes[j]).append("' in the FeatureType (")
                            .append(schema.getName()).append(")")
                            .toString());
                throw new IllegalFilterException(new StringBuffer(
                "Could not find '").append(
                        attributes[j] + "' in the FeatureType (").append(
                                schema.getName()).append(")").toString());
            }

            if (attType instanceof GeometryDescriptor) {
String localName = ((GeometryDescriptor) attType).getLocalName(); Filter gfilter = new FastBBOX(localName, bboxes.get(0), filterFactory);

                if (filter == Filter.INCLUDE) {
                    filter = gfilter;
                } else {
                    filter = filterFactory.or( filter, gfilter );
                }

                if(bboxes.size() > 0) {
                    for (int k = 1; k < bboxes.size(); k++) {
filter = filterFactory.or( filter, new FastBBOX(localName, bboxes.get(k), filterFactory) );
                    }
                }
            }
        }

        return filter;
    }|
Two things

1. I tried writing code that can get accessors from x-paths attributes against a complex type, but this isn't possible because of polymorphism. With polymorphism, you cannot verify whether a certain attribute exists using just only a type. Validation of attributes can be different per feature. The attributes aren't only validated at this stage (which is a strange place), but also in the geoserver itself.

2. Why is a BBOX created for each geometry type it can find? Isn't it enough to create a BBOX for the geometry type that is used for rendering? In most cases there would only be one, but why doing it in a loop then?

Regards

--
*Niels Charlier*

Software Engineer
CSIRO Earth Science and Resource Engineering
Phone: +61 8 6436 8914

Australian Resources Research Centre
26 Dick Perry Avenue, Kensington WA 6151
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to