tuple* free_list=0;
int minpoints;
-
+int checkclosed;
+double *first_point=NULL;
+double *last_point=NULL;
/* External functions */
extern void init_parser(const char *);
if ( the_geom.stack->uu.nn.num < minpoints){
error("geometry requires more points");
}
+ if ( checkclosed && first_point && last_point) {
+ if ( memcmp(first_point, last_point,
+ sizeof(double)*the_geom.ndims) )
+ {
+ error("geometry contains non-closed rings");
+ }
+ }
the_geom.stack = the_geom.stack->uu.nn.stack_next;
}
tuple* p = alloc_tuple(write_point_2,the_geom.lwgi?8:16);
p->uu.points[0] = x;
p->uu.points[1] = y;
+
+ /* keep track of point */
+ if ( checkclosed ) {
+ if ( ! the_geom.stack->uu.nn.num )
+ first_point = p->uu.points;
+ last_point = p->uu.points;
+ }
+
inc_num();
check_dims(2);
}
p->uu.points[0] = x;
p->uu.points[1] = y;
p->uu.points[2] = z;
+
+ /* keep track of point */
+ if ( checkclosed ) {
+ if ( ! the_geom.stack->uu.nn.num )
+ first_point = p->uu.points;
+ last_point = p->uu.points;
+ }
+
inc_num();
check_dims(3);
}
p->uu.points[1] = y;
p->uu.points[2] = z;
p->uu.points[3] = m;
+
+ /* keep track of point */
+ if ( checkclosed ) {
+ if ( ! the_geom.stack->uu.nn.num )
+ first_point = p->uu.points;
+ last_point = p->uu.points;
+ }
+
inc_num();
check_dims(4);
}
alloc_stack_tuple(POINTTYPE,write_type,1);
minpoints=1;
+ checkclosed=0;
}
void
alloc_stack_tuple(LINETYPE,write_type,1);
minpoints=2;
+ checkclosed=0;
}
void
alloc_stack_tuple(POLYGONTYPE, write_type,1);
minpoints=3;
+ checkclosed=1;
}
void