59 int hasm = 0, hasz = 0;
60 double length = 0.0, length_so_far = 0.0;
61 double m_range = m_end - m_start;
66 lwerror(
"lwmline_measured_from_lmwline: only multiline types supported");
74 for ( i = 0; i < lwmline->
ngeoms; i++ )
90 for ( i = 0; i < lwmline->ngeoms; i++ )
92 double sub_m_start, sub_m_end;
93 double sub_length = 0.0;
101 sub_m_start = (m_start + m_range * length_so_far / length);
102 sub_m_end = (m_start + m_range * (length_so_far + sub_length) / length);
106 length_so_far += sub_length;
115 if ( ! mline )
return;
120 for ( i = 0; i < mline->
ngeoms; i++ )
LWLINE * lwline_measured_from_lwline(const LWLINE *lwline, double m_start, double m_end)
Add a measure dimension to a line, interpolating linearly from the start to the end value...
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
double ptarray_length_2d(const POINTARRAY *pts)
Find the 2d length of the given POINTARRAY (even if it's 3d)
void lwline_free(LWLINE *line)
LWGEOM * lwmline_as_lwgeom(const LWMLINE *obj)
LWMLINE * lwmline_measured_from_lwmline(const LWMLINE *lwmline, double m_start, double m_end)
Re-write the measure ordinate (or add one, if it isn't already there) interpolating the measure betwe...
void lwmline_free(LWMLINE *mline)
void lwmline_release(LWMLINE *lwmline)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
LWMLINE * lwmline_construct_empty(int srid, char hasz, char hasm)
void lwgeom_release(LWGEOM *lwgeom)
Free the containing LWGEOM and the associated BOX.
void * lwalloc(size_t size)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
LWMLINE * lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj)