From: Jody G. <jga...@re...> - 2004-08-31 22:12:33
|
Martin Davis wrote: >Hmmm... Jody, your suggestion must have flashed past without >registering. Perhaps at the time I was focussed on other things. > > No prob - at the time we wanted some (any) feedback from the community before changing things. Sounds like we are getting the feedback this week. >I'm thinking that the best thing to do is to extend the >CoordinateSequence interface with only the functions that are required >to allow JTS to work efficiently with user-defined implementations (e.g. >to provide some of the more common and simpler functions as simple scans >of the coordinate sequence). If further functionality is required (as >in your case) the client can easily extend the basic interface. > > Actually what you have bellow is perfect - nobody ended up using any kinds of attributes other than doubles. (The other thing CoordinateSequence needed to provide client code to work with user-defined CoordinateSequence implementations - and you improved interface provides that). >So the improved CoordinateSequence interface would look like: > >interface CoordinateSequence >{ > size(); > public Coordinate getCoordinate(); > public Coordinate[] getCoordinateArray(); > public Object clone(); > > // new methods > > public int getDimension(); > public double getOrdinate(int index, int ordinate); > public double getX(int index); > public double getY(int index); > public double getZ(int index); >} > >Does that work for everybody? > > I think so - I am afraid I don't have all the code in my head anymore. Here let me think ... The only thing to check is CoordinateSequenceFactory: - we needed to tell the Dimension of a Geometry, not all Geometry classes allowed access to a CoordinateSequence, was the reason the CoordinateSequenceFactory extention mentioned in the last email. - oh and I suppose we need to change CoordinateSequenceFactory so users can specify their additional ordiantes So something like the following: interface CoordinateSequence { CoordinateSequence create( Coordinate arg ); CoordianteSequecne create( double[] xyz[] ); int getDimension(); } Thanks Martin, that is all I can think of (and I need to get back to work). Jody |