Hello Martin, I've applied the changes we discussed in last e-mails. Now the transform builders are constructed from the List <MappedPostition> (Thanks to your work in parent class it was very easy). One problem was with RubberSheeting transformation, because MappedPositionList didn't solve it as I realized after deeper look. The problem mostly affects the MapTriangulationFactory class so if you are interested in it you can look there (after I'll commit) or I can make a better explanation if you want.
So I've renamed old MappedPosition to ExtendedPosition then I've reorganized the RubberSheetTransformation and I moved all the code that requires ExtendedPosition into algorithm package (just for internal use) and there is just MapTriangulationFactory class that depends on ExtendedPosition so we can change it easily when we think up how. I'm ready to commit these changes right after the trunk build will be fixed. Cheers, Jan. ______________________________________________________________ > Od: [EMAIL PROTECTED] > Komu: Jan Jezek <[EMAIL PROTECTED]> > CC: geotools-devel <[email protected]> > Datum: 13.11.2006 18:35 > Předmět: Re: [Geotools-devel] More on calculator package > >Jan Jezek a écrit : >> * Make Inner class under MappedTriangulatioFactory that will look like old MappedPosition and will be used just for generating map of source and destination triangles. >> OR >> * Rewrite TriangulationFactory to be able to work with new MappedPosition instead of DirectPosition. >> > I prefer the first approach, but may be you can help me how to do this better. >> So what do you think? > > >A third approach is to make MappedPosition extends DirectPosition2D (or GeneralDirectPosition) like you did :). But while convenient to implement, I'm not sure if it is conceptually correct or not. For now I'm not sure because I don't know yet the full builder code enough. This is why the old MappedPosition is still around for now. > >An other approach which should be efficient and avoid copy is: > > * Changes the Triangulation factory code in order to work with > List<DirectPosition> instead of array of type DirectPosition[]. > > * Write a small class like the one below: > >class MappedPositionList<DirectPosition> extends AbstractList { > private final List<MappedPosition> positions; > > MappedPositionList(List<MappedPosition> positions) { > this.positions = positions; > } > > public int size() { > return positions.size(); > } > > public DirectPosition get(int index) { > MappedPosition p = positions.get(index); > return p.getTargetPoint(); > } >} > > >Thats all. As you can see, writing List wrappers is pretty easy (we are probably going to have a bunch of casts in the code with J2SE 1.4 instead of 1.5). We may add a 'boolean' argument in order to select between source and target points. With such wrappers, there is no copy operation at all - we just create different "view" of the mapped position list. This view can be given to the triangulation factory methods. > >Thats why I usually like to recommand usage of Collections over arrays in API. > >What do you think? > > Martin > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
