Search in sources :

Example 41 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class SurveyStats method calcNumberSubFullLegs.

public static int calcNumberSubFullLegs(Station station) {
    List<Leg> legs = Survey.getAllLegs(station);
    int numFullLegs = 0;
    for (Leg leg : legs) {
        if (leg.hasDestination()) {
            numFullLegs++;
        }
    }
    return numFullLegs;
}
Also used : Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 42 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class SurveyStats method calcNumberSubSplays.

public static int calcNumberSubSplays(Station station) {
    List<Leg> legs = Survey.getAllLegs(station);
    int numSplays = 0;
    for (Leg leg : legs) {
        if (!leg.hasDestination()) {
            numSplays++;
        }
    }
    return numSplays;
}
Also used : Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 43 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class CrossSection method getProjection.

public Space<Coord2D> getProjection() {
    Space<Coord2D> projection = new Space<>();
    projection.addStation(station, Coord2D.ORIGIN);
    for (Leg leg : station.getUnconnectedOnwardLegs()) {
        // first of all normalise to match the angle of the cross section
        Leg rotated = leg.rotate(-angle);
        Coord3D coord3D = Space3DUtils.toCartesian(Coord3D.ORIGIN, rotated);
        Coord2D coord2D = new Coord2D(coord3D.x, -coord3D.z);
        Line<Coord2D> line = new Line<>(Coord2D.ORIGIN, coord2D);
        projection.addLeg(rotated, line);
    }
    return projection;
}
Also used : Space(org.hwyl.sexytopo.model.graph.Space) Line(org.hwyl.sexytopo.model.graph.Line) Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 44 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class SurvexExporter method formatPromotedFrom.

private static void formatPromotedFrom(StringBuilder builder, Leg[] precursors) {
    builder.append("{from: ");
    boolean first = true;
    for (Leg precursor : precursors) {
        if (first) {
            first = false;
        } else {
            builder.append(", ");
        }
        builder.append(TableCol.DISTANCE.format(precursor.getDistance()));
        builder.append(" ");
        builder.append(TableCol.AZIMUTH.format(precursor.getAzimuth()));
        builder.append(" ");
        builder.append(TableCol.INCLINATION.format(precursor.getInclination()));
    }
    builder.append("}");
}
Also used : Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 45 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class SurveyUpdater method editStation.

public static void editStation(Survey survey, Station toEdit, Station edited) {
    boolean weAreRenamingAStation = !edited.getName().equals(toEdit);
    if (weAreRenamingAStation) {
        Station existing = survey.getStationByName(edited.getName());
        if (existing != null) {
            throw new IllegalArgumentException("New station name is not unique");
        }
    }
    if (toEdit == survey.getOrigin()) {
        survey.setOrigin(edited);
    } else {
        Leg referringLeg = survey.getReferringLeg(toEdit);
        Leg editedLeg = new Leg(referringLeg, edited);
        editLeg(survey, referringLeg, editedLeg);
    }
    if (survey.getActiveStation() == toEdit) {
        survey.setActiveStation(edited);
    }
    survey.setSaved(false);
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Leg(org.hwyl.sexytopo.model.survey.Leg)

Aggregations

Leg (org.hwyl.sexytopo.model.survey.Leg)94 Station (org.hwyl.sexytopo.model.survey.Station)30 Test (org.junit.Test)30 Survey (org.hwyl.sexytopo.model.survey.Survey)23 Coord3D (org.hwyl.sexytopo.model.graph.Coord3D)17 Line (org.hwyl.sexytopo.model.graph.Line)8 ArrayList (java.util.ArrayList)7 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)7 JSONArray (org.json.JSONArray)6 JSONObject (org.json.JSONObject)6 Space (org.hwyl.sexytopo.model.graph.Space)4 TextView (android.widget.TextView)3 GraphToListTranslator (org.hwyl.sexytopo.control.util.GraphToListTranslator)3 TableCol (org.hwyl.sexytopo.model.table.TableCol)3 JSONException (org.json.JSONException)3 AlertDialog (android.app.AlertDialog)2 ParseException (java.text.ParseException)2 HashMap (java.util.HashMap)2 LRUD (org.hwyl.sexytopo.model.table.LRUD)2 SuppressLint (android.annotation.SuppressLint)1