use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurvexImporter method parse.
public static void parse(String text, Survey survey) {
Map<String, Station> nameToStation = new HashMap<>();
Station origin = survey.getOrigin();
nameToStation.put(origin.getName(), origin);
String[] lines = text.split("\n");
for (String line : lines) {
if (line.trim().equals("")) {
continue;
}
String comment = "";
if (line.contains(";")) {
comment = line.substring(line.indexOf(";") + 1).trim();
}
String[] fields = line.trim().split("\t");
addLegToSurvey(survey, nameToStation, fields, comment);
}
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class SurveyStats method calcHeightRange.
public static double calcHeightRange(Survey survey) {
Space3DTransformer transformer = new Space3DTransformer();
Space<Coord3D> space = transformer.transformTo3D(survey);
Map<Station, Coord3D> stationsToCoords = space.getStationMap();
if (stationsToCoords.size() <= 1) {
return 0;
}
double min = Double.MAX_VALUE, max = Double.MIN_VALUE;
for (Coord3D point : space.getStationMap().values()) {
max = Math.max(max, point.getZ());
min = Math.min(min, point.getZ());
}
return max - min;
}
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) {
Station newStation = new Station(getNextStationName(survey));
Leg newLeg = Leg.upgradeSplayToConnectedLeg(leg, newStation);
editLeg(survey, leg, newLeg);
survey.setActiveStation(newStation);
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class GraphView method findNearestStationWithinDelta.
private static Station findNearestStationWithinDelta(Space<Coord2D> space, Coord2D target, float delta) {
float shortest = Float.MAX_VALUE;
Station best = null;
for (Station station : space.getStationMap().keySet()) {
Coord2D point = space.getStationMap().get(station);
// noinspection ConstantConditions
float distance = Space2DUtils.getDistance(point, target);
if (distance > delta) {
continue;
}
if (best == null || (distance < shortest)) {
best = station;
shortest = distance;
}
}
return best;
}
use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.
the class GraphView method checkForStation.
private Station checkForStation(Coord2D touchPointOnView) {
float selectionTolerance = SELECTION_SENSITIVITY_IN_PIXELS / surveyToViewScale;
Coord2D touchPointOnSurvey = viewCoordsToSurveyCoords(touchPointOnView);
Station newSelectedStation = findNearestStationWithinDelta(projection, touchPointOnSurvey, selectionTolerance);
// this could be null if nothing is near
return newSelectedStation;
}
Aggregations