use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class PocketTopoTxtImporter method parseSketch.
private static Sketch parseSketch(Survey survey, String text, Space<Coord2D> projection) {
Sketch sketch = new Sketch();
Coord2D offset = extractOffset(survey, text, projection);
List<PathDetail> pathDetails = parsePolylines(text, offset);
sketch.setPathDetails(pathDetails);
return sketch;
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class XviImporter method toSurvey.
public Survey toSurvey(File file) throws Exception {
Survey survey = new Survey(file.getName());
Sketch sketch = getSketch(file);
survey.setPlanSketch(sketch);
return survey;
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class XviImporter method getSketch.
public static Sketch getSketch(File file) throws Exception {
Sketch sketch = new Sketch();
String contents = Loader.slurpFile(file);
Grid grid = instance.parseGrid(contents);
double scale = grid.dy;
List<PathDetail> pathDetails = parseSketchlineBlock(scale, contents);
sketch.setPathDetails(pathDetails);
return sketch;
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class PocketTopoTxtImporter method getPlan.
private static Sketch getPlan(String fullText) {
String text = getSection(fullText, "PLAN");
Sketch plan = parseSketch(text);
return plan;
}
use of org.hwyl.sexytopo.model.sketch.Sketch in project sexytopo by richsmith.
the class SketchJsonTranslater method toSketch.
public static Sketch toSketch(Survey survey, JSONObject json) {
Sketch sketch = new Sketch();
try {
JSONArray pathsArray = json.getJSONArray(PATHS_TAG);
List<PathDetail> pathDetails = new ArrayList<>();
for (JSONObject object : Util.toList(pathsArray)) {
pathDetails.add(toPathDetail(object));
}
sketch.setPathDetails(pathDetails);
} catch (JSONException e) {
Log.e("Failed to load sketch paths: " + e);
}
try {
JSONArray symbolsArray = json.getJSONArray(SYMBOLS_TAG);
List<SymbolDetail> symbolDetails = new ArrayList<>();
for (JSONObject object : Util.toList(symbolsArray)) {
symbolDetails.add(toSymbolDetail(object));
}
sketch.setSymbolDetails(symbolDetails);
} catch (JSONException e) {
Log.e("Failed to load symbols: " + e);
}
try {
JSONArray labelsArray = json.getJSONArray(LABELS_TAG);
List<TextDetail> textDetails = new ArrayList<>();
for (JSONObject object : Util.toList(labelsArray)) {
textDetails.add(toTextDetail(object));
}
sketch.setTextDetails(textDetails);
} catch (JSONException e) {
Log.e("Failed to load sketch labels: " + e);
}
try {
JSONArray crossSectionsArray = json.getJSONArray(CROSS_SECTIONS_TAG);
List<CrossSectionDetail> crossSectionDetails = new ArrayList<>();
for (JSONObject object : Util.toList(crossSectionsArray)) {
crossSectionDetails.add(toCrossSectionDetail(survey, object));
}
sketch.setCrossSectionDetails(crossSectionDetails);
} catch (JSONException e) {
Log.e("Failed to load cross-sections: " + e);
}
return sketch;
}
Aggregations