use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyStats method calcHeightRangeArray.
public static float[] calcHeightRangeArray(Survey survey) {
Space3DTransformer transformer = new Space3DTransformer();
Space<Coord3D> space = transformer.transformTo3D(survey);
Map<Station, Coord3D> stationsToCoords = space.getStationMap();
if (stationsToCoords.size() <= 1) {
return new float[] { 0, 0 };
}
float min = Float.MAX_VALUE, max = Float.MIN_VALUE;
for (Coord3D point : space.getStationMap().values()) {
max = Math.max(max, point.z);
min = Math.min(min, point.z);
}
return new float[] { min, max };
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class LegMover method getValidDestinations.
public static List<Station> getValidDestinations(Survey survey, Leg leg) {
List<Station> stations = survey.getAllStations();
Station originatingStation = survey.getOriginatingStation(leg);
stations.remove(originatingStation);
removeDownstreamStations(leg, stations);
return stations;
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SpaceMover method move.
@SuppressWarnings("ConstantConditions")
public static Space<Coord2D> move(Space<Coord2D> space, Coord2D delta) {
Space<Coord2D> moved = new Space<>();
Map<Station, Coord2D> stationMap = space.getStationMap();
for (Station station : stationMap.keySet()) {
Coord2D point = stationMap.get(station);
moved.addStation(station, point.plus(delta));
}
Map<Leg, Line<Coord2D>> legMap = space.getLegMap();
for (Leg leg : legMap.keySet()) {
Line<Coord2D> line = space.getLegMap().get(leg);
Line<Coord2D> shiftedLine = new Line<>(line.getStart().plus(delta), line.getEnd().plus(delta));
moved.addLeg(leg, shiftedLine);
}
return moved;
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class TestSurveyCreator method createBranch.
public static void createBranch(Survey survey, int numStations) {
for (int i = 0; i < numStations; i++) {
float distance = 5 + random.nextInt(10);
float azimuth = 40 + random.nextInt(100);
float inclination = -20 + random.nextInt(40);
Leg leg = new Leg(distance, azimuth, inclination);
SurveyUpdater.updateWithNewStation(survey, leg);
Station newStation = survey.getMostRecentLeg().getDestination();
createLruds(survey, newStation);
}
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyUpdater method updateWithNewStation.
public static void updateWithNewStation(Survey survey, Leg leg) {
Station activeStation = survey.getActiveStation();
if (!leg.hasDestination()) {
Station newStation = new Station(StationNamer.generateNextStationName(survey, activeStation));
leg = Leg.manuallyUpgradeSplayToConnectedLeg(leg, newStation);
}
// FIXME; could the below be moved into Survey? And from elsewhere in this file?
activeStation.getOnwardLegs().add(leg);
survey.setSaved(false);
survey.addLegRecord(leg);
survey.setActiveStation(leg.getDestination());
}
Aggregations