accommodate for drawing text shapes

This commit is contained in:
Anton Georgiev 2015-05-26 11:58:37 -04:00
parent 1a7c0076a0
commit 0982e28449

View File

@ -175,11 +175,13 @@ public class Util {
} }
public Map<String, Object> extractAnnotation(JsonObject annotationElement) { public Map<String, Object> extractAnnotation(JsonObject annotationElement) {
//NON-TEXT SHAPE
if (annotationElement.has(Constants.ID) if (annotationElement.has(Constants.ID)
&& annotationElement.has("transparency") && annotationElement.has("transparency")
&& annotationElement.has("color") && annotationElement.has("color")
&& annotationElement.has("status") && annotationElement.has("status")
&& annotationElement.has("whiteboardId") && annotationElement.has("whiteboardId")
&& annotationElement.has("type")
&& annotationElement.has("thickness") && annotationElement.has("thickness")
&& annotationElement.has("points")){ && annotationElement.has("points")){
@ -216,6 +218,55 @@ public class Util {
return finalAnnotation; return finalAnnotation;
} }
// TEXT SHAPE
else if (annotationElement.has(Constants.ID)
&& annotationElement.has("text")
&& annotationElement.has("fontColor")
&& annotationElement.has("status")
&& annotationElement.has("textBoxWidth")
&& annotationElement.has("fontSize")
&& annotationElement.has("type")
&& annotationElement.has("calcedFontSize")
&& annotationElement.has("textBoxHeight")
&& annotationElement.has("calcedFontSize")
&& annotationElement.has("whiteboardId")
&& annotationElement.has("dataPoints")
&& annotationElement.has("x")
&& annotationElement.has("y")){
Map<String, Object> finalAnnotation = new HashMap<String, Object>();
String text = annotationElement.get("text").getAsString();
int fontColor = annotationElement.get("fontColor").getAsInt();
String status = annotationElement.get(Constants.STATUS).getAsString();
Float textBoxWidth = annotationElement.get("textBoxWidth").getAsFloat();
int fontSize = annotationElement.get("fontSize").getAsInt();
String type = annotationElement.get("type").getAsString();
Float calcedFontSize = annotationElement.get("calcedFontSize").getAsFloat();
Float textBoxHeight = annotationElement.get("textBoxHeight").getAsFloat();
String id = annotationElement.get(Constants.ID).getAsString();
String whiteboardId = annotationElement.get("whiteboardId").getAsString();
Float x = annotationElement.get("x").getAsFloat();
Float y = annotationElement.get("y").getAsFloat();
String dataPoints = annotationElement.get("dataPoints").getAsString();
finalAnnotation.put("text", text);
finalAnnotation.put("fontColor", fontColor);
finalAnnotation.put(Constants.STATUS, status);
finalAnnotation.put("textBoxWidth", textBoxWidth);
finalAnnotation.put("fontSize", fontSize);
finalAnnotation.put("type", type);
finalAnnotation.put("calcedFontSize", calcedFontSize);
finalAnnotation.put("textBoxHeight", textBoxHeight);
finalAnnotation.put(Constants.ID, id);
finalAnnotation.put("whiteboardId", whiteboardId);
finalAnnotation.put("x", x);
finalAnnotation.put("y", y);
finalAnnotation.put("dataPoints", dataPoints);
return finalAnnotation;
}
return null; return null;
} }
} }