// (c) Tuomas J. Lukka and Asko Soukka #include namespace Vob { typedef Transform *(*TransformFactory)(int i); /** A class that manages a set of coordinate systems. */ class Coorder { vector cs; vector params; int maxcs; int nparams(int typecode) ; int nprevious(int typecode) ; TransformFactory transformFactory; Coorder *cs1_tmp ; Coorder *cs2_tmp ; // Not to be ever trusted except inside setPoints() // calls: used to make it possible to use submethods. int ninds; int *inds1; float *points1; int *interpinds; int *inds2; float *points2; bool shouldInterpolate(int cs1, int cs2, int nprev); public: Coorder(TransformFactory fac); ~Coorder(); void clean() { for(unsigned i=0; iget(ind) == 0 && ind < parent->maxcs) ind++; } public: iterator(int ind, Coorder *parent) : ind(ind), parent(parent) { } int operator*() { return ind; } iterator& operator++() { incr(); return *this; } iterator operator++(int) { iterator tmp = *this; incr(); return tmp; } bool operator==(const iterator &it) const { return ind == it.ind; } bool operator!=(const iterator &it) const { return ind != it.ind; } }; /** Return an iterator pointing to the first coordinate system * (not root, i.e. not 0). */ iterator begin(); /** Return an iterator pointing one past the last coordinate system. */ iterator end(); /** Set the coordinate systems. * @param points1 floats: the parameters of the coordinate * systems. * @param inds1 Array of length ninds, * containing descriptions of coordinate systems. * 1) type code, see Coords.cxx for current codes * 2) parent and determining coordinate systems, * as many as the type code requires (usually 1 or 2) * 3) an index to the points1 array, where the parameters * of the coordinate system should be read from. * @param inds2 A second array, similar to inds1, but for points2. */ void Coorder::setPoints( int ninds, int *inds1, float *points1, int *interpinds, int *inds2, float *points2, float fract, bool show1) ; Transform *get(int i) { return cs[i]; } }; }