@@ -178,6 +178,17 @@ int mg_session_write_point_2d(mg_session *session, const mg_point_2d *point) {
178
178
return 0 ;
179
179
}
180
180
181
+ int mg_session_write_point_3d (mg_session * session , const mg_point_3d * point ) {
182
+ MG_RETURN_IF_FAILED (
183
+ mg_session_write_uint8 (session , (uint8_t )(MG_MARKER_TINY_STRUCT4 )));
184
+ MG_RETURN_IF_FAILED (mg_session_write_uint8 (session , MG_SIGNATURE_POINT_3D ));
185
+ MG_RETURN_IF_FAILED (mg_session_write_integer (session , point -> srid ));
186
+ MG_RETURN_IF_FAILED (mg_session_write_float (session , point -> x ));
187
+ MG_RETURN_IF_FAILED (mg_session_write_float (session , point -> y ));
188
+ MG_RETURN_IF_FAILED (mg_session_write_float (session , point -> z ));
189
+ return 0 ;
190
+ }
191
+
181
192
int mg_session_write_value (mg_session * session , const mg_value * value ) {
182
193
switch (value -> type ) {
183
194
case MG_VALUE_TYPE_NULL :
@@ -230,11 +241,8 @@ int mg_session_write_value(mg_session *session, const mg_value *value) {
230
241
return mg_session_write_duration (session , value -> duration_v );
231
242
case MG_VALUE_TYPE_POINT_2D :
232
243
return mg_session_write_point_2d (session , value -> point_2d_v );
233
- // mg_session_set_error(session, "tried to send value of type
234
- // 'point_2d'"); // TODO(gitbuda): remove return MG_ERROR_INVALID_VALUE;
235
244
case MG_VALUE_TYPE_POINT_3D :
236
- mg_session_set_error (session , "tried to send value of type 'point_3d'" );
237
- return MG_ERROR_INVALID_VALUE ;
245
+ return mg_session_write_point_3d (session , value -> point_3d_v );
238
246
case MG_VALUE_TYPE_UNKNOWN :
239
247
mg_session_set_error (session , "tried to send value of unknown type" );
240
248
return MG_ERROR_INVALID_VALUE ;
0 commit comments