Search in sources :

Example 51 with Survey

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

the class TherionImporter method parseTh.

private static Survey parseTh(File file) throws Exception {
    String contents = Loader.slurpFile(file);
    String name = getSurveyName(file);
    Survey survey = new Survey(name);
    List<String> lines = Arrays.asList(contents.split("\n"));
    updateCentreline(lines, survey);
    return survey;
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey)

Example 52 with Survey

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

the class ImportManager method toSurvey.

public static Survey toSurvey(File file) throws Exception {
    Importer importer = chooseImporter(file);
    Survey survey = importer.toSurvey(file);
    return survey;
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) XviImporter(org.hwyl.sexytopo.control.io.thirdparty.xvi.XviImporter) SurvexImporter(org.hwyl.sexytopo.control.io.thirdparty.survex.SurvexImporter) PocketTopoTxtImporter(org.hwyl.sexytopo.control.io.thirdparty.pockettopo.PocketTopoTxtImporter) TherionImporter(org.hwyl.sexytopo.control.io.thirdparty.therion.TherionImporter)

Example 53 with Survey

use of org.hwyl.sexytopo.model.survey.Survey 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;
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Sketch(org.hwyl.sexytopo.model.sketch.Sketch)

Example 54 with Survey

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

the class StartUpActivity method loadActiveSurvey.

public Survey loadActiveSurvey() {
    String activeSurveyName = getPreferences().getString(SexyTopo.ACTIVE_SURVEY_NAME, "Error");
    if (!Util.doesSurveyExist(this, activeSurveyName)) {
        startNewSurvey();
        return createNewActiveSurvey();
    }
    Toast.makeText(getApplicationContext(), getString(R.string.loading_survey) + " " + activeSurveyName, Toast.LENGTH_SHORT).show();
    Survey survey;
    try {
        survey = Loader.loadSurvey(this, activeSurveyName);
    } catch (Exception e) {
        survey = createNewActiveSurvey();
        Toast.makeText(getApplicationContext(), getString(R.string.loading_survey_error), Toast.LENGTH_SHORT).show();
    }
    return survey;
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey)

Example 55 with Survey

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

the class SurveyActivity method updateStats.

private void updateStats() {
    Survey survey = getSurvey();
    // TextView nameField = (TextView)(findViewById(R.id.survey_name));
    // nameField.setText(survey.getName());
    double length = SurveyStats.calcTotalLength(survey);
    setStatsField(R.id.statsFieldLength, TextTools.formatTo2dpWithComma(length));
    double heightRange = SurveyStats.calcHeightRange(survey);
    setStatsField(R.id.statsFieldDepth, TextTools.formatTo2dpWithComma(heightRange));
    int numberOfStations = SurveyStats.calcNumberStations(survey);
    setStatsField(R.id.statsFieldNumberStations, TextTools.formatWithComma(numberOfStations));
    double shortestLeg = SurveyStats.calcShortestLeg(survey);
    setStatsField(R.id.statsFieldShortestLeg, TextTools.formatTo2dpWithComma(shortestLeg));
    double longestLeg = SurveyStats.calcLongestLeg(survey);
    setStatsField(R.id.statsFieldLongestLeg, TextTools.formatTo2dpWithComma(longestLeg));
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey)

Aggregations

Survey (org.hwyl.sexytopo.model.survey.Survey)101 Test (org.junit.Test)56 Station (org.hwyl.sexytopo.model.survey.Station)31 Leg (org.hwyl.sexytopo.model.survey.Leg)24 AlertDialog (android.app.AlertDialog)10 SuppressLint (android.annotation.SuppressLint)9 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)9 ArrayAdapter (android.widget.ArrayAdapter)8 File (java.io.File)6 HashMap (java.util.HashMap)6 View (android.view.View)5 EditText (android.widget.EditText)5 ArrayList (java.util.ArrayList)5 Set (java.util.Set)5 Context (android.content.Context)4 SharedPreferences (android.content.SharedPreferences)4 Editable (android.text.Editable)4 List (java.util.List)4 Map (java.util.Map)4 R (org.hwyl.sexytopo.R)4