use of org.hwyl.sexytopo.model.graph.Coord2D in project sexytopo by richsmith.
the class GraphView method drawCrossSections.
private void drawCrossSections(Canvas canvas, Set<CrossSectionDetail> crossSectionDetails, int alpha) {
for (CrossSectionDetail sectionDetail : crossSectionDetails) {
Coord2D centreOnSurvey = sectionDetail.getPosition();
Coord2D centreOnView = surveyCoordsToViewCoords(centreOnSurvey);
drawStationCross(canvas, stationPaint, (float) centreOnView.getX(), (float) centreOnView.getY(), STATION_DIAMETER, alpha);
String description = sectionDetail.getCrossSection().getStation().getName() + " X-section";
if (getDisplayPreference(GraphActivity.DisplayPreference.SHOW_STATION_LABELS)) {
stationPaint.setAlpha(alpha);
canvas.drawText(description, (float) centreOnView.getX(), (float) centreOnView.getY(), stationPaint);
}
Space<Coord2D> projection = sectionDetail.getProjection();
drawLegs(canvas, projection, alpha);
}
}
use of org.hwyl.sexytopo.model.graph.Coord2D 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 : toList(array)) {
path.add(toCoord2D(object));
}
PathDetail pathDetail = new PathDetail(path, colour);
return pathDetail;
}
use of org.hwyl.sexytopo.model.graph.Coord2D in project sexytopo by richsmith.
the class SketchJsonTranslater method toJson.
public static JSONObject toJson(PathDetail pathDetail) throws JSONException {
JSONObject json = new JSONObject();
json.put(COLOUR_TAG, pathDetail.getColour().toString());
JSONArray points = new JSONArray();
for (Coord2D coord : pathDetail.getPath()) {
points.put(toJson(coord));
}
json.put(POINTS_TAG, points);
return json;
}
use of org.hwyl.sexytopo.model.graph.Coord2D 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);
TextDetail textDetail = new TextDetail(location, text, colour);
return textDetail;
}
use of org.hwyl.sexytopo.model.graph.Coord2D in project sexytopo by richsmith.
the class SketchJsonTranslater method toCrossSectionDetail.
public static CrossSectionDetail toCrossSectionDetail(Survey survey, JSONObject json) throws JSONException {
Coord2D position = toCoord2D(json.getJSONObject(POSITION_TAG));
double angle = json.getDouble(ANGLE_TAG);
String stationdId = json.getString(STATION_ID_TAG);
Station station = survey.getStationByName(stationdId);
CrossSectionDetail crossSectionDetail = new CrossSectionDetail(new CrossSection(station, angle), position);
return crossSectionDetail;
}
Aggregations