Opened 17 years ago

Closed 17 years ago

Last modified 15 years ago

#1578 closed task (fixed)

Wrap GDALColorTable and GDALColorEntry with C API

Reported by: Mateusz Łoskot Owned by: hobu
Priority: normal Milestone: 1.5.0
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: api
Cc: warmerdam, tamas

Description (last modified by warmerdam)

The GDALColorTable and GDALColorEntry should be wrapped with C API in order to avoid potential problems with crossing modules boundaries under Windows system, as well as to keep GDAL API consistent without forcing users to mix C++ API when they use C API, for some features.

Change History (15)

comment:1 by warmerdam, 17 years ago

Cc: hobu added
Description: modified (diff)

GDALColorEntry is a C structure already.

There are already GDALColorTable related C functions. I'm not sure why they aren't used by gdal/swig/include/ColorTable.i

comment:2 by warmerdam, 17 years ago

Cc: warmerdam added; hobu removed
Owner: changed from warmerdam to hobu

Howard has volunteered to fix up swig/include/ColorTable.i to use the C API.

Reassigning.

comment:3 by hobu, 17 years ago

Status: newassigned

ColorTable.i rewritten in r11501 I'm confused about ColorEntry though... isn't it just a struct? We have it defined as such in gdal.i

comment:4 by hobu, 17 years ago

Cc: tamas added

ah, I see it is brought up to swig only for C#. Tamas, do you have any comment? Should we define the GDALColorEntry struct in gdal.i for all languages instead of just .NET? Do you remember why you defined it in gdal.i?

in reply to:  4 comment:5 by tamas, 17 years ago

Replying to hobu:

ah, I see it is brought up to swig only for C#. Tamas, do you have any comment? Should we define the GDALColorEntry struct in gdal.i for all languages instead of just .NET? Do you remember why you defined it in gdal.i?

At that time I wouldn't want to affect the others by adding the new ColorEntry class. However gdal.i is the right place to implement such things, and someday the '#if defined(SWIGCSHARP)' can be removed when the other bindings would require this functionality. Generally I prefer to provide the implementation this way, and *would object* to treat this class as a fixed sized array for example.

comment:6 by hobu, 17 years ago

Milestone: 1.5.0

Tamas or Frank,

Any objection to making the GDALColorEntry struct available to all swig languages? SWIG should take care of all access to it, as it is fairly simple.

Howard

comment:7 by warmerdam, 17 years ago

I can live with exposing it through swig, though I hate the amount of gunk swig produces for stuff like this.

comment:8 by hobu, 17 years ago

done. r11640

in reply to:  6 comment:9 by tamas, 17 years ago

Replying to hobu:

Tamas or Frank,

Any objection to making the GDALColorEntry struct available to all swig languages? SWIG should take care of all access to it, as it is fairly simple.

Howard

I don't object. I prefer to expose classes instead of arrays whenever it is possible to keep the interface unambiguous.

Tamas

in reply to:  8 comment:10 by Ari Jolma, 17 years ago

Replying to hobu:

done. r11640

If you gentlemen do not object, I'd like to put #ifndef SWIGPERL around the GDALColorEntry struct, i.e., prevent it becoming an object in Geo::GDAL.

comment:11 by hobu, 17 years ago

Ari,

Is there a problem having this defined specific to Perl? Is it just the name? Without having this defined, a user in Perl won't be able to interact with ColorTables and its entries, correct?

Howard

comment:12 by hobu, 17 years ago

I see Ari made this change already in r11661

in reply to:  11 comment:13 by Ari Jolma, 17 years ago

Replying to hobu:

Ari,

Is there a problem having this defined specific to Perl? Is it just the name? Without having this defined, a user in Perl won't be able to interact with ColorTables and its entries, correct?

Yes they can see http://map.hut.fi/doc/Geo-GDAL/html/class_geo_1_1_g_d_a_l_1_1_color_table.html

The main reason is that there are Perl typemaps for color entry and they convert the rgba values between a perl array and gdal color entry struct. The new color entry class broke the perl wrappers and I couln'd figure out how to integrate the old wrappers and the new class so I just nuked the new class. :)

Howard

comment:14 by hobu, 17 years ago

Resolution: fixed
Status: assignedclosed

looks like no further problems with this. Closing for now...

comment:15 by Even Rouault, 15 years ago

Problem similar to Perl bindings with Java. Solved by r16007. See #2331

Note: See TracTickets for help on using tickets.