/* * 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 <double> myPoints, string annotation_name, List <double> 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); }
/* * Method Overview: Infinite loop to start the JSON creation * Parameters: None * Return: None */ public void constructGeneralJSON() { while (true) { 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, 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, 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, StringComparison.Ordinal)) { constructDeleteJSONMessage(to_create.id, to_create.command); } JSONs_to_create.Dequeue(); } } } }