73 char* encoded_polyline = NULL;
79 encoded_polyline =
lwalloc(1 *
sizeof(
char));
80 encoded_polyline[0] = 0;
81 return encoded_polyline;
89 delta[0] = round(prevPoint->
y * scale);
90 delta[1] = round(prevPoint->
x * scale);
93 for (i = 1; i < pa->
npoints; i++)
96 delta[2 * i] = round(point->
y * scale) - round(prevPoint->
y * scale);
98 round(point->
x * scale) - round(prevPoint->
x * scale);
104 for (i = 0; i < pa->
npoints * 2; i++)
110 delta[i] = ~(delta[i]);
115 for (i = 0; i < pa->
npoints * 2; i++)
117 int numberToEncode = delta[i];
119 while (numberToEncode >= 0x20)
123 int nextValue = (0x20 | (numberToEncode & 0x1f)) + 63;
127 numberToEncode >>= 5;
130 numberToEncode += 63;
138 return encoded_polyline;
stringbuffer_t * stringbuffer_create(void)
Allocate a new stringbuffer_t.
char * stringbuffer_getstringcopy(stringbuffer_t *s)
Returns a newly allocated string large enough to contain the current state of the string...
int stringbuffer_aprintf(stringbuffer_t *s, const char *fmt,...)
Appends a formatted string to the current string buffer, using the format and argument list provided...
const POINT2D * getPoint2d_cp(const POINTARRAY *pa, int n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from...
void stringbuffer_destroy(stringbuffer_t *s)
Free the stringbuffer_t and all memory managed within it.
void * lwalloc(size_t size)