| 80 | |
| 81 | template<typename T> |
| 82 | static T *construct( const typename T::Basis &basis, object o ) |
| 83 | { |
| 84 | typename T::PointContainer points; |
| 85 | int s = extract<int>( o.attr( "__len__" )() ); |
| 86 | for( int i=0; i<s; i++ ) |
| 87 | { |
| 88 | object e = o[i]; |
| 89 | int es = extract<int>( e.attr( "__len__" )() ); |
| 90 | if( es!=2 ) |
| 91 | { |
| 92 | throw Exception( "Each entry in the point sequence must contain two values." ); |
| 93 | } |
| 94 | object xo = e[0]; |
| 95 | object yo = e[1]; |
| 96 | typename T::XType x = extract<typename T::XType>( xo ); |
| 97 | typename T::YType y = extract<typename T::YType>( yo ); |
| 98 | points.insert( typename T::PointContainer::value_type( x, y ) ); |
| 99 | } |
| 100 | return new T( basis, points ); |
| 101 | } |
| 102 | |
| 103 | template<typename T> |
| 104 | static boost::python::tuple points( const T &s ) |
no test coverage detected