[Gdal-dev] Expose Array Based Coordinate Transformation Methods in CoordinateTransformation (#1615)

Tamas Szekeres szekerest at gmail.com
Mon May 7 17:16:52 EDT 2007


According to the previous posts a new typemap had be introduced to
implement this feature. The current implementation looks like this:

#ifdef SWIGCSHARP
  %apply (double *inout) {(double*)};
#endif
  void TransformPoints( int nCount, double *x, double *y, double *z ) {
    OCTTransform( self, nCount, x, y, z );
  }
#ifdef SWIGCSHARP
  %clear (double*);
#endif

I would propose to implement the 'double *inout' typemap for passing
variable length arrays to the TransformPoints function. The nCount
parameter should be used to create the intermediary array of the
proper size inside the typemap implementation. At this time I've made
the %apply internal to C# not disturbing the others with unexpected
warnings during the interface generation.
However in the future if folks would want to use this item from the
other languages as well, and this typemap will widely be implemented I
would propose to remove the #ifdefs from this implementation.


Best regards,

Tamas




2007/5/6, Ari Jolma <ari.jolma at tkk.fi>:
> Tamas Szekeres kirjoitti:
> > Hi All,
> >
> > I had a first crack at adding CoordinateTransformation.TransformPoints
> > to the SWIG interface to provide the transformation of the given
> > number of points passed as arrays of coordinates.
> > I've tested the code for the C# bindings and worked pretty well. If
> > someone have further issues please give me a comment at:
> > http://trac.osgeo.org/gdal/ticket/1615
>
> Sorry, I'll comment here. This is from point of view of Perl bindings.
>
> You are using typemap "double argout[ANY]" which seems to require that
> you know the ANY beforehand. The same typemap is implicitly used
> elsewhere in GCPsToGeoTransform where ANY is 6.
>
> This case seems to require a malloc, a copy to the malloced array, and
> after the call a copy to a new Perl array, and  freeing of the malloced
> array.
>
> I need to at least define a new typemap and that seems to mean that I
> can't use "double argout[ANY]". The new typemap could be something like
> "double *inout", but I don't know how the nCount gets set (and there are
> possibly three values for it since there are three input arrays). I'd be
> inclined to use something like "int, double *, double *, double *"
> typemap since this kind of data is easiest to keep in one 2D array in Perl.
>
> At this point, however, I'd like to postpone implementing this method in
> the Perl bindings.
>
> Regards,
>
> Ari
>
> >
> > Best regards,
> >
> > Tamas
> > _______________________________________________
> > Gdal-dev mailing list
> > Gdal-dev at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/gdal-dev
>
>
>



More information about the Gdal-dev mailing list