result->points = pa;
result->is3d = lwgeom_is3d(type);
-//elog(NOTICE,"npoints in deserialize line = %i",npoints);
return result;
}
int t;
char *loc;
-elog(NOTICE,"lwline_serialize::entry");
+if (line == NULL)
+ elog(ERROR,"lwline_serialize:: given null line");
+
hasSRID = (line->SRID != -1);
if (hasSRID)
size += 16 * line->points->npoints; //x,y
}
- size+=4; // npoints
-elog(NOTICE,"lwline_serialize:: size = %i",size);
+ size+=4; // npoints
result = palloc(size);
loc +=4;
//copy in points
+elog(NOTICE," line serialize - size = %i", size);
+
if (line->is3d)
{
for (t=0; t< line->points->npoints;t++)
loc += 16; // size of a 2d point
}
}
- printBYTES((unsigned char *)result, size);
+ //printBYTES((unsigned char *)result, size);
return result;
}
// we've read the type (1 byte) and SRID (4 bytes, if present)
npoints = get_uint32(loc);
-elog(NOTICE,"npoint in lwline_findlength= %i",npoints);
result += 4; //npoints
if (lwgeom_is3d(type) )
nrings = get_uint32(loc);
result->nrings = nrings;
loc +=4;
-elog(NOTICE,"lwpoly_deserialize:: polygon with %i rings",nrings);
result->rings = (POINTARRAY**) palloc(nrings* sizeof(POINTARRAY*));
for (t =0;t<nrings;t++)
size += 16*total_points;
result = palloc(size);
- elog(NOTICE,"lwpoly_serialize size = %i", size);
result[0] = lwgeom_makeType(poly->is3d,hasSRID, POLYGONTYPE);
loc = result+1;
{
POINTARRAY *pa = poly->rings[t];
npoints = poly->rings[t]->npoints;
-elog(NOTICE,"doing ring #%i with %i points",t,npoints);
memcpy(loc, &npoints, sizeof(int32)); //npoints this ring
loc+=4;
if (poly->is3d)
{
for (u=0;u<npoints;u++)
{
-elog(NOTICE,"pt %i",u);
getPoint2d_p(pa, u, loc);
loc+= 16;
}
SRID = -1;
#ifdef DEBUG
- elog(NOTICE,"LWGEOMFromWKB: entry with SRID=%i\n",SRID);
+ elog(NOTICE,"LWGEOMFromWKB: entry with SRID=%i",SRID);
#endif
// need to do this because there might be a bunch of endian flips!
simpletype = wkb_simpletype(wkbtype);
#ifdef DEBUG
- elog(NOTICE,"wkb_to_lwgeom: entry with SRID=%i, dims=%i, simpletype=%i\n",SRID,(int) dims, (int) simpletype);
+ elog(NOTICE,"wkb_to_lwgeom: entry with SRID=%i, dims=%i, simpletype=%i",SRID,(int) dims, (int) simpletype);
#endif
break;
case LINETYPE:
line = wkb_line_to_lwline(wkb, SRID);
- printLWLINE(line);
- elog(NOTICE,"have line with %i points",line->points->npoints);
+ //printLWLINE(line);
result = lwline_serialize(line);
- elog(NOTICE,"serialized it");
+// elog(NOTICE,"line serialized");
*size = lwline_findlength(result);
- elog(NOTICE,"serialized length=%i",*size);
pfree_line(line);
break;
case POLYGONTYPE:
poly = wkb_poly_to_lwpoly(wkb, SRID);
- printLWPOLY(poly);
+// printLWPOLY(poly);
result = lwpoly_serialize(poly);
- elog(NOTICE,"serialized polygon");
*size = lwpoly_findlength(result);
- elog(NOTICE,"serialized polygon has length = %i",*size);
pfree_polygon(poly);
break;
case MULTIPOINTTYPE:
simpletype = wkb_simpletype(wkbtype);
#ifdef DEBUG
- elog(NOTICE,"wkb_point_to_lwpoint: entry with SRID=%i, dims=%i, simpletype=%i\n",SRID,(int) dims, (int) simpletype);
+ elog(NOTICE,"wkb_point_to_lwpoint: entry with SRID=%i, dims=%i, simpletype=%i",SRID,(int) dims, (int) simpletype);
#endif
flipPoints(wkb+9,npoints,dims);
pa = pointArray_construct(wkb+9, dims, npoints);
-printPA(pa);
return lwline_construct(dims, SRID, pa);
}
// read a ring
if (need_flip)
flipPoints(loc+4,npoints,dims);
-elog(NOTICE,"wkb_poly_to_lwpoly:: doing ring %i with %i points", t, npoints);
pa = pointArray_construct(loc+4, dims, npoints);
loc += 4;
char *multigeom = NULL;
#ifdef DEBUG
- elog(NOTICE,"lwgeom_to_wkb: entry with simpletype=%i, dims=%i\n",(int) simple_type,(int) lwgeom_is3d( serialized_form[0]) );
+ elog(NOTICE,"lwgeom_to_wkb: entry with simpletype=%i, dims=%i",(int) simple_type,(int) lwgeom_is3d( serialized_form[0]) );
#endif
pfree_line(line);
break;
case POLYGONTYPE:
- elog(NOTICE,"lwgeom_to_wkb :: deserializing polygon");
poly = lwpoly_deserialize(serialized_form);
- printLWPOLY(poly);
+// printLWPOLY(poly);
result = lwpoly_to_wkb(poly, desiredWKBEndian, wkblength);
pfree_polygon(poly );
break;
bool need_flip = requiresflip( desiredWKBEndian );
#ifdef DEBUG
- elog(NOTICE,"lwpoint_to_wkb: pa dims = %i\n", (int)pt->point->is3d );
+ elog(NOTICE,"lwpoint_to_wkb: pa dims = %i", (int)pt->point->is3d );
#endif
wkbtype = constructWKBType(POINTTYPE, pt->point->is3d);
#ifdef DEBUG
- elog(NOTICE,"lwpoint_to_wkb: entry with wkbtype=%i, pa dims = %i\n",wkbtype, (int)pt->point->is3d );
+ elog(NOTICE,"lwpoint_to_wkb: entry with wkbtype=%i, pa dims = %i",wkbtype, (int)pt->point->is3d );
#endif
uint32 wkbtype ;
bool need_flip = requiresflip( desiredWKBEndian );
-
-printLWLINE(line);
-
*wkbsize = 1+ 4+4+ line->points->npoints * ptsize; //endian, type, npoints, points
result = palloc(*wkbsize);