Search in sources :

Example 6 with CrossSectionDetail

use of org.hwyl.sexytopo.model.sketch.CrossSectionDetail in project sexytopo by richsmith.

the class SketchJsonTranslater method toJson.

public static synchronized JSONObject toJson(Sketch sketch) throws JSONException {
    JSONObject json = new JSONObject();
    JSONArray pathDetailArray = new JSONArray();
    for (PathDetail pathDetail : sketch.getPathDetails()) {
        pathDetailArray.put(toJson(pathDetail));
    }
    json.put(PATHS_TAG, pathDetailArray);
    JSONArray textDetailArray = new JSONArray();
    for (TextDetail textDetail : sketch.getTextDetails()) {
        textDetailArray.put(toJson(textDetail));
    }
    json.put(LABELS_TAG, textDetailArray);
    JSONArray symbolDetailArray = new JSONArray();
    for (SymbolDetail symbolDetail : sketch.getSymbolDetails()) {
        symbolDetailArray.put(toJson(symbolDetail));
    }
    json.put(SYMBOLS_TAG, symbolDetailArray);
    JSONArray crossSectionDetailArray = new JSONArray();
    for (CrossSectionDetail crossSectionDetail : sketch.getCrossSectionDetails()) {
        crossSectionDetailArray.put(toJson(crossSectionDetail));
    }
    json.put(CROSS_SECTIONS_TAG, crossSectionDetailArray);
    return json;
}
Also used : SymbolDetail(org.hwyl.sexytopo.model.sketch.SymbolDetail) JSONObject(org.json.JSONObject) PathDetail(org.hwyl.sexytopo.model.sketch.PathDetail) JSONArray(org.json.JSONArray) CrossSectionDetail(org.hwyl.sexytopo.model.sketch.CrossSectionDetail) TextDetail(org.hwyl.sexytopo.model.sketch.TextDetail)

Aggregations

CrossSectionDetail (org.hwyl.sexytopo.model.sketch.CrossSectionDetail)6 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)4 ArrayList (java.util.ArrayList)3 Station (org.hwyl.sexytopo.model.survey.Station)3 CrossSection (org.hwyl.sexytopo.model.sketch.CrossSection)2 PathDetail (org.hwyl.sexytopo.model.sketch.PathDetail)2 SymbolDetail (org.hwyl.sexytopo.model.sketch.SymbolDetail)2 TextDetail (org.hwyl.sexytopo.model.sketch.TextDetail)2 JSONArray (org.json.JSONArray)2 JSONObject (org.json.JSONObject)2 SuppressLint (android.annotation.SuppressLint)1 Bitmap (android.graphics.Bitmap)1 Paint (android.graphics.Paint)1 Rect (android.graphics.Rect)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Sketch (org.hwyl.sexytopo.model.sketch.Sketch)1 JSONException (org.json.JSONException)1