use of org.hwyl.sexytopo.model.sketch.Colour in project sexytopo by richsmith.
the class SketchJsonTranslater method toPathDetail.
public static PathDetail toPathDetail(JSONObject json) throws JSONException {
Colour colour = Colour.valueOf(json.getString(COLOUR_TAG));
JSONArray array = json.getJSONArray(POINTS_TAG);
List<Coord2D> path = new ArrayList<>();
for (JSONObject object : Util.toList(array)) {
path.add(toCoord2D(object));
}
PathDetail pathDetail = new PathDetail(path, colour);
float epsilon = Space2DUtils.simplificationEpsilon(pathDetail);
List<Coord2D> simplifiedPath = Space2DUtils.simplify(path, epsilon);
pathDetail.setPath(simplifiedPath);
return pathDetail;
}
use of org.hwyl.sexytopo.model.sketch.Colour in project sexytopo by richsmith.
the class SketchJsonTranslater method toTextDetail.
public static TextDetail toTextDetail(JSONObject json) throws JSONException {
Colour colour = Colour.valueOf(json.getString(COLOUR_TAG));
Coord2D location = toCoord2D(json.getJSONObject(POSITION_TAG));
String text = json.getString(TEXT_TAG);
float scale = (float) (json.has(SIZE_TAG) ? json.getDouble(SIZE_TAG) : 0);
TextDetail textDetail = new TextDetail(location, text, colour, scale);
return textDetail;
}
Aggregations