// polygon.h // // by John D. de Boer typedef struct { long h,v; // e.g. longitude & latitude, respectively } polypoint; typedef struct { bool open; // whether polygon is open or closed string name; // name of polygon short num; // number of points in polygon polypoint pt[0]; // vertex coordinates } polygon; typedef struct { short num; // number of polygons bool changed; // whether editing has been done polygon **poly[0]; // references to individual polygons } polygons; typedef struct { real slop, // used by macpoly.c slop2; // ditto short poly, // selected polygon; -1 if not polygon selected pt; // selected point of selected polygon bool vertex; // to denote whether a drag is a vertex, or a midpoint } polyselect; // Writing & reading polygons void writetextpoly(const polygon **P); void writetextpolys(const polygons **Py); polygon **parsetextpoly(char **T); bool parsetextpolys(const char *S, polygons **Py); bool readrespolys(polygons **Py, const char *Name); // Allocating polygons polygon **newpoly(const polypoint *L); void oldpoly(polygon **P); polygons **newpolys(void); void oldpolys(polygons **Py); // Modifying polygons void movecorner(polygons **Py, int POLY, int PT, const polypoint *L); void insertcorner(polygons **Py, int POLY, int PREV, const polypoint *L); void removecorner(polygons **Py, int POLY, int PT); void addpoly(polygons **Py, const polypoint *L, long DLAT); void removepoly(polygons **Py, int POLY); void insertpoly(polygons **Py, polygon **P); void namepolygon(polygons **Py, int POLY, const char *S); bool polyisopen(const polygons **Py, int POLY); void changepolyopenness(polygons **Py, int POLY); void reversepoly(polygons **Py, int POLY, short *SEL);