/* * Method Overview: Constructs a JSON Value object of a line * Parameters: Required values of the object to create * Return: None */ public void createJSONable(int id, string command, List <Vector3> myPoints, string annotation_name, List <float> annotation_information) { JSONable to_add = new JSONable(); to_add.id = id; to_add.command = command; to_add.myPoints = myPoints; to_add.annotation_name = annotation_name; to_add.annotation_information = annotation_information; JSONs_to_create.Enqueue(to_add); }
// Update is called once per frame void Update() { if (JSONs_to_create.Count() > 0) { if (!isJsonBeingCreated) { isJsonBeingCreated = true; JSONable to_create = JSONs_to_create.First(); if (CREATE_ANNOTATION_COMMAND.Equals(to_create.command, System.StringComparison.Ordinal)) { if (to_create.annotation_name == null) { constructLineJSONMessage(to_create.id, to_create.command, to_create.myPoints); } else { constructIconAnnotationJSONMessage(to_create.id, to_create.command, to_create.annotation_name, to_create.annotation_information); } } else if (UPDATE_ANNOTATION_COMMAND.Equals(to_create.command, System.StringComparison.Ordinal)) { if (to_create.annotation_name == null) { constructLineJSONMessage(to_create.id, to_create.command, to_create.myPoints); } else { constructIconAnnotationJSONMessage(to_create.id, to_create.command, to_create.annotation_name, to_create.annotation_information); } } else if (DELETE_ANNOTATION_COMMAND.Equals(to_create.command, System.StringComparison.Ordinal)) { constructDeleteJSONMessage(to_create.id, to_create.command); } JSONs_to_create.Dequeue(); } } }
private static string serializeDataToString(JSONable objectToSerialize) { return(objectToSerialize.getJSON().Print()); }