@@ -168,6 +168,16 @@ int mg_session_write_duration(mg_session *session, const mg_duration *dur) {
168
168
return 0 ;
169
169
}
170
170
171
+ int mg_session_write_point_2d (mg_session * session , const mg_point_2d * point ) {
172
+ MG_RETURN_IF_FAILED (
173
+ mg_session_write_uint8 (session , (uint8_t )(MG_MARKER_TINY_STRUCT3 )));
174
+ MG_RETURN_IF_FAILED (mg_session_write_uint8 (session , MG_SIGNATURE_POINT_2D ));
175
+ MG_RETURN_IF_FAILED (mg_session_write_integer (session , point -> srid ));
176
+ MG_RETURN_IF_FAILED (mg_session_write_float (session , point -> x ));
177
+ MG_RETURN_IF_FAILED (mg_session_write_float (session , point -> y ));
178
+ return 0 ;
179
+ }
180
+
171
181
int mg_session_write_value (mg_session * session , const mg_value * value ) {
172
182
switch (value -> type ) {
173
183
case MG_VALUE_TYPE_NULL :
@@ -219,8 +229,9 @@ int mg_session_write_value(mg_session *session, const mg_value *value) {
219
229
case MG_VALUE_TYPE_DURATION :
220
230
return mg_session_write_duration (session , value -> duration_v );
221
231
case MG_VALUE_TYPE_POINT_2D :
222
- mg_session_set_error (session , "tried to send value of type 'point_2d'" );
223
- return MG_ERROR_INVALID_VALUE ;
232
+ 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;
224
235
case MG_VALUE_TYPE_POINT_3D :
225
236
mg_session_set_error (session , "tried to send value of type 'point_3d'" );
226
237
return MG_ERROR_INVALID_VALUE ;
0 commit comments