Hi,
I'm trying to use app-schema with a target schema that, unfortunately,
uses a DirectPosition as
the feature "geometry". I don't have any control over the schema so I
have to try and make it work
anyways.

What I get overall is that my points are turned into their WKT
representation when the
GML encoding happens. Which is not what I want.

Looking a bit more deeply I see that the attribute is correctly bound
to DirectPosition:
ComplexTypeImpl http://www.opengis.net/gml:DirectPositionType extends
doubleList(axisLabels:NCNameList,srsDimension:positiveInteger,srsName:anyURI,uomLabels:NCNameList)
but nowhere in the code there is an attempt to use converters to turn
the JTS Point into a DirectPosition.

Now, I tracked down the issue to XPath.convertValue:

private Object convertValue(final AttributeDescriptor descriptor,
final Object value) {
        final AttributeType type = descriptor.getType();
        Class<?> binding = type.getBinding();

        if (type instanceof ComplexType && binding == Collection.class) {
            if (!(value instanceof Collection) && isSimpleContentType(type)) {
                ArrayList<Property> list = new ArrayList<Property>();
                if (value == null && !descriptor.isNillable()) {
                    return list;
                }
                list.add(buildSimpleContent(type, value));
                return list;
            }
        }
        if (binding == String.class && value instanceof Collection) {
            // if it's a single value in a collection, strip the square brackets
            String collectionString = value.toString();
            return collectionString.substring(1, collectionString.length() - 1);
        }
        return FF.literal(value).evaluate(value, binding);
    }

type is a complex type, but binding for some reason is exactly Collection.class,
which results in the wrong code path being chosen (the right one, imho, would
be the usage of the last line, FF.literal(value).evaluate(value, binding), which
could be expressed also as Converters.convert(value, binding)).

Now... does anybody know why the binding ends up being a collection instead
of org.opengis.geometry.DirectPosition?
I still haven't quite tracked down where the bindings are built...

Cheers
Andrea

-----------------------------------------------------
Ing. Andrea Aime
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584962313
fax:     +39 0584962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-----------------------------------------------------

------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized
environment for deploying applications. Does it make network security 
easier or more difficult to achieve? Read this whitepaper to separate the 
two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to