[GRASS-dev] convergence angle

Glynn Clements glynn at gclements.plus.com
Tue Oct 21 07:38:05 EDT 2008


Hamish wrote:

> I am trying to add this as "g.region -n" now, some questions:
> 
> 1) local_proto.h: what's next in this series:
> #define PRINT_REG    0x01
> #define PRINT_SH     0x02
> #define PRINT_LL     0x04
> #define PRINT_EXTENT 0x08
> #define PRINT_CENTER 0x10
> #define PRINT_METERS 0x20
> #define PRINT_3D     0x40
> #define PRINT_MBBOX  0x80
> 
> #define PRINT_NANGLE 0x ???

#define PRINT_NANGLE 0x100

> 2) #include <projects.h> to get LP, FACTOR, and pj_factors() ?

Yes.

> 3) The compiler complains that arg 2 of pj_factors(, oproj.pj,) is of
> an incompatible pointer type. If I make it *oproj.pj it doesn't complain
> but the output fact.conv is always 0.00000.

This is a bug in GRASS' gprojects.h. It uses projPJ* where it should
use projPJ. projPJ is already a pointer:

	#if !defined(PROJECTS_H)
	    ...
	    typedef void *projPJ;
	    ...
	#else
	    ...
	    typedef PJ *projPJ;
	    ...
	#endif

I've applied this in 7.0:

	--- include/gprojects.h	(revision 33947)
	+++ include/gprojects.h	(working copy)
	@@ -32,7 +32,7 @@
	 
	 struct pj_info
	 {
	-    projPJ *pj;
	+    projPJ pj;
	     double meters;
	     int zone;
	     char proj[100];

It doesn't result in a warning in GRASS because PROJECTS_H isn't
defined, so the void* version is used, and implicit casts to/from
void* never generate a warning.

Your code should be using oproj.pj, not *oproj.pj.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list