The revolutionary project management tool is here! Plan visually with a single glance and make sure your projects get done.
/* macros */
#define gaiaGetPoint(xy,v,x,y) \
{*x = xy[(v) * 2]; \
*y = xy[(v) * 2 + 1];}
#define gaiaSetPoint(xy,v,x,y) \
{xy[(v) * 2] = x; \
xy[(v) * 2 + 1] = y;}
typedef struct gaiaPointStruct
{
/* an OpenGis POINT */
double X; /* X,Y coordinates */
double Y;
double Z; /* Z coordinate */
double M; /* M measure */
int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
struct gaiaPointStruct *Next; /* for double-linked list */
struct gaiaPointStruct *Prev; /* for double-linked list */
} gaiaPoint;[i] [b]//What is this piece[/b][/i]
typedef gaiaPoint *gaiaPointPtr;[i] [b]//What is this piece[/b][/i]
public class gaiaPointStruct
{
/* an OpenGis POINT */
public double X; /* X,Y coordinates */
public double Y;
public double Z; /* Z coordinate */
public double M; /* M measure */
public int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
public gaiaPointStruct Next; /* for double-linked list */
public gaiaPointStruct Prev; /* for double-linked list */
} gaiaPoint;
typedef gaiaPoint *gaiaPointPtr;
using System;
using MyApplication1;
namespace MyApplication1
{
public class gaiaPoint
{
/* an OpenGis POINT */
public double X; /* X,Y coordinates */
public double Y;
public double Z; /* Z coordinate */
public double M; /* M measure */
public int DimensionModel; /* (x,y), (x,y,z), (x,y,m) or (x,y,z,m) */
public gaiaPoint Next; /* for double-linked list */
public gaiaPoint Prev; /* for double-linked list */
public static void gaiaSetPoint(double [] xy, int v, double x, double y) {
xy[(v) * 2] = x;
xy[(v) * 2 + 1] = y;
}
public static double gaiaGetPointX(double [] xy, int v){
return (xy[(v) * 2]);
}
public static double gaiaGetPointY(double [] xy, int v){
return (xy[(v) * 2 + 1]);
}
}
}
class MyProgram
{
static void Main(string[] args)
{
gaiaPoint gaiaPointPtr;
}
}
public static void gaiaGetPoint(ref double [] xy, int v, double x, double y)
{
xy[(v) * 2] = x;
xy[(v) * 2 + 1] = y;
}
public static void gaiaSetPoint(double [] xy, int v, ref double x, ref double y)
{
x = (xy[(v) * 2]);
y = (xy[(v) * 2 + 1]);
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
C# does not support macros - so it is a problem
here are soime suggestions:
http://stackoverflow.com/questions/6228045/convert-c-define-macro-to-c
http://stackoverflow.com/questions/1656098/c-to-c-conversion-of-define-macros
http://www.gamedev.net/topic/255134-converting-c-macros-to-c/
struct should be translated as a class - seems reasonable