[Simple-support] simple xml with jts geometry classes?
Brought to you by:
niallg
|
From: Marten B. <mar...@go...> - 2008-05-10 14:42:07
|
Hello, I want to use simple xml to serialize my classes to xml. The project deals with geo information systems and therefore we are using geometry classes of jts (java topology suite, http://www.vividsolutions.com/jts/jtshome.htm). How can I serialize this instances (classes)? My idea was to write my own transform class like (code is written out of my brain!): class jtsGeomTransform implements Transform<Geometry>{ public String write(Geometry geom){ return wktwriter.write(geom); } pulbic Geometry read(String wkt){ return wktreader.read(wkt); } } Where wktwriter/wktreader are parts of jts and convert geometry instances into Strings known as "well known text" and back. The other classes like LineString, Polygon, Point, MultiLineString, MultiPolygon are all derived from Geometry. Questions: 1. Is this the recommend way to solve my problem? 2. How can/must I add my transform classes to the Persister? Thx for helping Marten |