PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ asx3d3_mline_coordindex_sb()

static int asx3d3_mline_coordindex_sb ( const LWMLINE mgeom,
stringbuffer_t sb 
)
static

if the linestring is closed, we put the start point index for the last vertex to denote use first point and don't increment the index

Definition at line 132 of file lwout_x3d.c.

133{
134 LWLINE *geom;
135 uint32_t i, j, k, si;
136 POINTARRAY *pa;
137 uint32_t np;
138
139 j = 0;
140 for (i=0; i < mgeom->ngeoms; i++)
141 {
142 geom = (LWLINE *) mgeom->geoms[i];
143 pa = geom->points;
144 np = pa->npoints;
145 si = j; /* start index of first point of linestring */
146 for (k=0; k < np ; k++)
147 {
148 if (k)
149 {
150 stringbuffer_aprintf(sb, " ");
151 }
155 if (!lwline_is_closed(geom) || k < (np -1) )
156 {
157 stringbuffer_aprintf(sb, "%u", j);
158 j += 1;
159 }
160 else
161 {
162 stringbuffer_aprintf(sb,"%u", si);
163 }
164 }
165 if (i < (mgeom->ngeoms - 1) )
166 {
167 stringbuffer_aprintf(sb, " -1 "); /* separator for each linestring */
168 }
169 }
170 return LW_SUCCESS;
171}
#define LW_SUCCESS
Definition liblwgeom.h:97
int lwline_is_closed(const LWLINE *line)
Definition lwline.c:455
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.
POINTARRAY * points
Definition liblwgeom.h:483
LWLINE ** geoms
Definition liblwgeom.h:547
uint32_t ngeoms
Definition liblwgeom.h:552
uint32_t npoints
Definition liblwgeom.h:427

References LWMLINE::geoms, LW_SUCCESS, lwline_is_closed(), LWMLINE::ngeoms, POINTARRAY::npoints, LWLINE::points, and stringbuffer_aprintf().

Referenced by asx3d3_multi_sb().

Here is the call graph for this function:
Here is the caller graph for this function: