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;
}
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;
}
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;
}
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;
}
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));
}
Aggregations