use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyUpdater method moveLeg.
public static void moveLeg(Survey survey, Leg leg, Station newSource) {
Station originating = survey.getOriginatingStation(leg);
originating.getOnwardLegs().remove(leg);
newSource.addOnwardLeg(leg);
survey.setSaved(false);
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyUpdater method renameStation.
public static void renameStation(Survey survey, Station station, String name) {
Station existing = survey.getStationByName(name);
if (existing != null) {
throw new IllegalArgumentException("New station name is not unique");
}
station.setName(name);
Log.d("Renamed station " + station.getName() + " -> " + name);
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyUpdater method update.
public static synchronized boolean update(Survey survey, Leg leg, InputMode inputMode) {
Station activeStation = survey.getActiveStation();
Log.d("Adding leg " + leg);
activeStation.getOnwardLegs().add(leg);
survey.setSaved(false);
survey.addLegRecord(leg);
boolean justCreatedNewStation = false;
switch(inputMode) {
case FORWARD:
justCreatedNewStation = createNewStationIfTripleShot(survey, false);
break;
case BACKWARD:
justCreatedNewStation = createNewStationIfTripleShot(survey, true);
break;
case COMBO:
justCreatedNewStation = createNewStationIfBacksight(survey) || createNewStationIfTripleShot(survey, false);
case CALIBRATION_CHECK:
// do nothing :)
break;
}
if (justCreatedNewStation) {
Log.d("Created new station " + survey.getActiveStation().getName());
}
return justCreatedNewStation;
}
use of org.hwyl.sexytopo.model.survey.Station 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);
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class GraphView method openCommentDialog.
private void openCommentDialog(final Station station) {
final EditText input = new EditText(getContext());
input.setLines(8);
input.setGravity(Gravity.START | Gravity.TOP);
input.setText(station.getComment());
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setView(input).setTitle(station.getName()).setPositiveButton(R.string.save, (dialog, which) -> station.setComment(input.getText().toString())).setNegativeButton("Cancel", (dialog, which) -> {
/* Do nothing */
});
AlertDialog dialog = builder.create();
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
dialog.show();
}
Aggregations