| 952 | } |
| 953 | |
| 954 | int lineObj_add(lineObj *self, pointObj *p) { |
| 955 | if(self->numpoints == 0) { /* new */ |
| 956 | self->point = (pointObj *)malloc(sizeof(pointObj)); |
| 957 | if(!self->point) |
| 958 | return MS_FAILURE; |
| 959 | } else { /* extend array */ |
| 960 | self->point = (pointObj *)realloc(self->point, sizeof(pointObj)*(self->numpoints+1)); |
| 961 | if(!self->point) |
| 962 | return MS_FAILURE; |
| 963 | } |
| 964 | |
| 965 | self->point[self->numpoints].x = p->x; |
| 966 | self->point[self->numpoints].y = p->y; |
| 967 | #ifdef USE_POINT_Z_M |
| 968 | self->point[self->numpoints].m = p->m; |
| 969 | #endif |
| 970 | self->numpoints++; |
| 971 | |
| 972 | return MS_SUCCESS; |
| 973 | } |
| 974 | |
| 975 | |
| 976 | /********************************************************************** |