use of org.hwyl.sexytopo.model.survey.Station 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;
}
use of org.hwyl.sexytopo.model.survey.Station 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);
}
}
use of org.hwyl.sexytopo.model.survey.Station 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);
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyUpdater method createNewStationIfBacksight.
private static boolean createNewStationIfBacksight(Survey survey) {
// Examine splays of the current active station to determine if the previous two were a
// foreward and backsight; if so, promote to a new named station
Station activeStation = survey.getActiveStation();
List<Leg> activeLegs = activeStation.getOnwardLegs();
if (activeLegs.size() < 2) {
return false;
}
List<Leg> lastPair = survey.getLastNLegs(2);
if (lastPair.size() < 2) {
return false;
}
for (Leg leg : lastPair) {
if (!activeLegs.contains(leg)) {
return false;
}
}
Leg fore = lastPair.get(lastPair.size() - 2);
// TODO: check for "reverse mode" to see if backsight comes first?
Leg back = lastPair.get(lastPair.size() - 1);
if (areLegsBacksights(fore, back)) {
Station newStation = new Station(getNextStationName(survey));
newStation.setExtendedElevationDirection(activeStation.getExtendedElevationDirection());
Leg newLeg = averageBacksights(fore, back);
newLeg = Leg.manuallyUpgradeSplayToConnectedLeg(newLeg, newStation);
survey.undoAddLeg();
survey.undoAddLeg();
activeStation.getOnwardLegs().add(newLeg);
survey.addLegRecord(newLeg);
survey.setActiveStation(newStation);
return true;
}
return false;
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyUpdater method createNewStationIfTripleShot.
private static boolean createNewStationIfTripleShot(Survey survey, boolean backsightMode) {
int requiredNumber = SexyTopo.NUM_OF_REPEATS_FOR_NEW_STATION;
Station activeStation = survey.getActiveStation();
List<Leg> activeLegs = activeStation.getOnwardLegs();
if (activeLegs.size() < requiredNumber) {
return false;
}
List<Leg> lastNLegs = survey.getLastNLegs(requiredNumber);
if (lastNLegs.size() < requiredNumber) {
return false;
}
// check all the last legs are from the active station
for (Leg leg : lastNLegs) {
if (!activeLegs.contains(leg)) {
return false;
}
}
if (areLegsAboutTheSame(lastNLegs)) {
Station newStation = new Station(getNextStationName(survey));
newStation.setExtendedElevationDirection(activeStation.getExtendedElevationDirection());
Leg newLeg = averageLegs(lastNLegs);
newLeg = Leg.upgradeSplayToConnectedLeg(newLeg, newStation, lastNLegs.toArray(new Leg[] {}));
if (backsightMode) {
newLeg = newLeg.reverse();
}
for (int i = 0; i < requiredNumber; i++) {
survey.undoAddLeg();
}
activeStation.getOnwardLegs().add(newLeg);
survey.addLegRecord(newLeg);
survey.setActiveStation(newStation);
return true;
}
return false;
}
Aggregations