Search in sources :

Example 61 with Leg

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

the class TestSurveyCreator method createLruds.

public static void createLruds(Survey survey, Station station) {
    for (LRUD lrud : LRUD.values()) {
        Leg splay = lrud.createSplay(survey, station, 1 + random.nextInt(3));
        SurveyUpdater.update(survey, splay);
    }
}
Also used : LRUD(org.hwyl.sexytopo.model.table.LRUD) Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 62 with Leg

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

the class GraphToListTranslator method createMap.

public static Map<TableCol, Object> createMap(SurveyListEntry entry) {
    Station from = entry.getFrom();
    Leg leg = entry.getLeg();
    Map<TableCol, Object> map = new HashMap<>();
    if (leg.hasDestination() && leg.getDestination().hasComment()) {
        map.put(TableCol.COMMENT, leg.getDestination().getComment());
    }
    if (leg.wasShotBackwards()) {
        map.put(TableCol.FROM, leg.getDestination());
        map.put(TableCol.TO, from);
        leg = leg.asBacksight();
    } else {
        map.put(TableCol.FROM, from);
        map.put(TableCol.TO, leg.getDestination());
    }
    map.put(TableCol.DISTANCE, leg.getDistance());
    map.put(TableCol.AZIMUTH, leg.getAzimuth());
    map.put(TableCol.INCLINATION, leg.getInclination());
    return map;
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) HashMap(java.util.HashMap) TableCol(org.hwyl.sexytopo.model.table.TableCol) Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 63 with Leg

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

the class LegMover method removeDownstreamStations.

private static void removeDownstreamStations(Leg leg, List<Station> stations) {
    if (!leg.hasDestination()) {
        return;
    }
    Station station = leg.getDestination();
    stations.remove(station);
    for (Leg onwardLeg : station.getConnectedOnwardLegs()) {
        removeDownstreamStations(onwardLeg, stations);
    }
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 64 with Leg

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

the class SurveyStats method calcLongestLeg.

public static float calcLongestLeg(Survey survey) {
    List<Leg> legs = survey.getAllLegs();
    if (legs.isEmpty()) {
        return 0;
    }
    float max = 0.0f;
    for (Leg leg : legs) {
        max = Math.max(leg.getDistance(), max);
    }
    return max;
}
Also used : Leg(org.hwyl.sexytopo.model.survey.Leg)

Example 65 with Leg

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

the class SurveyUpdater method upgradeSplayToConnectedLeg.

public static void upgradeSplayToConnectedLeg(Survey survey, Leg leg, InputMode inputMode) {
    Station newStation = new Station(getNextStationName(survey));
    Leg newLeg = Leg.manuallyUpgradeSplayToConnectedLeg(leg, newStation);
    if (inputMode == InputMode.BACKWARD) {
        newLeg = newLeg.reverse();
    }
    editLeg(survey, leg, newLeg);
    survey.setActiveStation(newStation);
}
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