[GRASS-SVN] r33472 - in grass/branches/develbranch_6: include
swig/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 16 18:07:39 EDT 2008
Author: hamish
Date: 2008-09-16 18:07:39 -0400 (Tue, 16 Sep 2008)
New Revision: 33472
Modified:
grass/branches/develbranch_6/include/gis.h
grass/branches/develbranch_6/include/imagery.h
grass/branches/develbranch_6/swig/python/python_grass6.i
Log:
SWIG fixes: (merge from trunk)
Add Python version of G_gisinit()
Un-nest structure declarations to make headers SWIG-friendly
Modified: grass/branches/develbranch_6/include/gis.h
===================================================================
--- grass/branches/develbranch_6/include/gis.h 2008-09-16 21:28:05 UTC (rev 33471)
+++ grass/branches/develbranch_6/include/gis.h 2008-09-16 22:07:39 UTC (rev 33472)
@@ -277,16 +277,17 @@
double bottom;
};
+struct _Color_Value_
+{
+ DCELL value;
+ unsigned char red;
+ unsigned char grn;
+ unsigned char blu;
+};
+
struct _Color_Rule_
{
- struct
- {
- DCELL value;
- unsigned char red;
- unsigned char grn;
- unsigned char blu;
- } low, high;
-
+ struct _Color_Value_ low, high;
struct _Color_Rule_ *next;
struct _Color_Rule_ *prev;
};
Modified: grass/branches/develbranch_6/include/imagery.h
===================================================================
--- grass/branches/develbranch_6/include/imagery.h 2008-09-16 21:28:05 UTC (rev 33471)
+++ grass/branches/develbranch_6/include/imagery.h 2008-09-16 22:07:39 UTC (rev 33472)
@@ -6,23 +6,27 @@
/* File/directory name lengths */
#define INAME_LEN GNAME_MAX /* coupled to raster map name length */
+struct Ref_Color
+{
+ unsigned char *table; /* color table for min-max values */
+ unsigned char *index; /* data translation index */
+ unsigned char *buf; /* data buffer for reading color file */
+ int fd; /* for image i/o */
+ CELL min, max; /* min,max CELL values */
+ int n; /* index into Ref_Files */
+};
+
+struct Ref_Files
+{
+ char name[INAME_LEN]; /* length is not in sync with other definitions */
+ char mapset[INAME_LEN];
+};
+
struct Ref
{
int nfiles;
- struct Ref_Files
- {
- char name[INAME_LEN]; /* length is not in sync with other definitions */
- char mapset[INAME_LEN];
- } *file;
- struct Ref_Color
- {
- unsigned char *table; /* color table for min-max values */
- unsigned char *index; /* data translation index */
- unsigned char *buf; /* data buffer for reading color file */
- int fd; /* for image i/o */
- CELL min, max; /* min,max CELL values */
- int n; /* index into Ref_Files */
- } red, grn, blu;
+ struct Ref_Files *file;
+ struct Ref_Color red, grn, blu;
};
struct Tape_Info
@@ -42,53 +46,61 @@
int *status;
};
+struct One_Sig
+{
+ char desc[100];
+ int npoints;
+ double *mean; /* one mean for each band */
+ double **var; /* covariance band-band */
+ int status; /* may be used to 'delete' a signature */
+ float r, g, b; /* color */
+ int have_color;
+};
+
struct Signature
{
int nbands;
int nsigs;
char title[100];
- struct One_Sig
- {
- char desc[100];
- int npoints;
- double *mean; /* one mean for each band */
- double **var; /* covariance band-band */
- int status; /* may be used to 'delete' a signature */
- float r, g, b; /* color */
- int have_color;
- } *sig;
+ struct One_Sig *sig;
};
+struct SubSig
+{
+ double N;
+ double pi;
+ double *means;
+ double **R;
+ double **Rinv;
+ double cnst;
+ int used;
+};
+
+struct ClassData
+{
+ int npixels;
+ int count;
+ double **x; /* pixel list: x[npixels][nbands] */
+ double **p; /* prob p[npixels][subclasses] */
+};
+
+struct ClassSig
+{
+ long classnum;
+ char *title;
+ int used;
+ int type;
+ int nsubclasses;
+ struct SubSig *SubSig;
+ struct ClassData ClassData;
+};
+
struct SigSet
{
int nbands;
int nclasses;
char *title;
- struct ClassSig
- {
- long classnum;
- char *title;
- int used;
- int type;
- int nsubclasses;
- struct SubSig
- {
- double N;
- double pi;
- double *means;
- double **R;
- double **Rinv;
- double cnst;
- int used;
- } *SubSig;
- struct ClassData
- {
- int npixels;
- int count;
- double **x; /* pixel list: x[npixels][nbands] */
- double **p; /* prob p[npixels][subclasses] */
- } ClassData;
- } *ClassSig;
+ struct ClassSig *ClassSig;
};
#define SIGNATURE_TYPE_MIXED 1
Modified: grass/branches/develbranch_6/swig/python/python_grass6.i
===================================================================
--- grass/branches/develbranch_6/swig/python/python_grass6.i 2008-09-16 21:28:05 UTC (rev 33471)
+++ grass/branches/develbranch_6/swig/python/python_grass6.i 2008-09-16 22:07:39 UTC (rev 33472)
@@ -32,3 +32,8 @@
%include "interfaces/dig_structs.i"
%include "interfaces/dig_types.i"
+%pythoncode %{
+def G_gisinit(pgm):
+ G__gisinit(GIS_H_VERSION, pgm)
+
+%}
More information about the grass-commit
mailing list