From: Andrea A. <and...@ge...> - 2013-06-11 08:46:16
|
On Tue, Jun 4, 2013 at 3:30 PM, Justin Deoliveira <jde...@op...>wrote: > I see, so a generic binding for LineString that would then do some > typechecks and delegate to the proper > >> subclasses? My worry is, at that point, isn't the element used for >> encoding pretty much cast in stone? >> > > Yeah, the binding has to choose what class it binds to unless the schema > gives enough information to trigger the binding explicitly, which it > probably wont. Not sure what you mean by cast in stone? Yes the binding > will be bound to the type of the object, but it can change along with it. > Not sure I understand. > I mean, the bindings report to work against a certain element and class. If I'm running a binding for LineString, the binding is targetting GML.LineStringType, it has no way to decide to target something else, e.g., CircleByCenterPoint, especially because getTargetType() does not receive the element being encoded as a parameter. That's why I'm having difficulties seeing how one can delegate to another binding, it's not just a matter of extracting the right properties out of the object, but also to indicate the right type of target element. > Cool. So given this class hierarchy I think a single MultiCurve binding > acting accordingly based on the concrete curve type makes most sense. The > binding can bind to MultiLineString which indeed will conflict with the > existing binding, but we can easily get around this by having the type > check dance fall back to MultiLineString binding if the geometry passed in > doesn't match any of the known curve types. > How is the fallback going to work, code wise? > > Making it cleaner would be to have all the curve subtypes extend from some > sort of special interface or abstract class. Which api wise might not be a > bad idea for code that has to do checks on geometry type. > I can go for marker interfaces, but how would those work? Cheers Andrea -- == GeoServer training in Milan, 6th & 7th June 2013! Visit http://geoserver.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- |