Stores a pointarray as varints in the buffer @register_npoints, controls whether an npoints entry is added to the buffer (used to skip npoints for point types) @dimension, states the dimensionality of object this array is part of (0 = point, 1 = linear, 2 = areal)
108{
110 uint32_t i, j;
114 int npoints = 0;
115 size_t npoints_offset = 0;
116 uint32_t max_points_left = pa->
npoints;
117
118 LWDEBUGF(2,
"Entered %s", __func__);
119
120
121 if ( pa->
npoints == 0 && register_npoints )
122 {
125 return 0;
126 }
127
128
129
130
131
132
134 {
135
136
138 b_p = &b;
139 }
140 else
141 {
142
144 if ( register_npoints )
145 {
146
147
148
150
151
152
153
155 }
156 }
157
158 for ( i = 0; i < pa->
npoints; i++ )
159 {
161 int64_t diff = 0;
162
163
164 for ( j = 0; j < ndims; j++ )
165 {
166
167
168
169
170 nextdelta[j] = (int64_t) llround(globals->
factor[j] * dbl_ptr[j]) - ts->
accum_rels[j];
171 LWDEBUGF(4,
"deltavalue: %lld, ", nextdelta[j]);
172 diff += llabs(nextdelta[j]);
173 }
174
175
176
177
178 if ( i > 0 && diff == 0 && max_points_left > minpoints )
179 {
180 max_points_left--;
181 continue;
182 }
183
184
185 npoints++;
186
187
188 for ( j = 0; j < ndims; j++ )
189 {
192 }
193
194
196 {
197 for ( j = 0; j < ndims; j++ )
198 {
201
204 }
205 }
206
207 }
208
210 {
211
212
213 if ( register_npoints )
215
217
218
220 }
221 else
222 {
223
224
225 if ( register_npoints )
227 }
228
229 return 0;
230}
void bytebuffer_destroy_buffer(bytebuffer_t *s)
Free the bytebuffer_t and all memory managed within it.
void bytebuffer_append_bytebuffer(bytebuffer_t *write_to, bytebuffer_t *write_from)
Writes a uint8_t value to the buffer.
void bytebuffer_append_byte(bytebuffer_t *s, const uint8_t val)
Writes a uint8_t value to the buffer.
void bytebuffer_append_uvarint(bytebuffer_t *b, const uint64_t val)
Writes a unsigned varInt to the buffer.
void bytebuffer_append_varint(bytebuffer_t *b, const int64_t val)
Writes a signed varInt to the buffer.
void bytebuffer_init_with_size(bytebuffer_t *s, size_t size)
Allocate just the internal buffer of an existing bytebuffer_t struct.
#define FLAGS_NDIMS(flags)
#define LWDEBUGF(level, msg,...)
static uint8_t * getPoint_internal(const POINTARRAY *pa, uint32_t n)
int64_t bbox_min[MAX_N_DIMS]
int64_t accum_rels[MAX_N_DIMS]
int64_t bbox_max[MAX_N_DIMS]
size_t varint_u64_encode_buf(uint64_t val, uint8_t *buf)