use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class SurveyStats method calcNumberSubFullLegs.
public static int calcNumberSubFullLegs(Station station) {
List<Leg> legs = Survey.getAllLegs(station);
int numFullLegs = 0;
for (Leg leg : legs) {
if (leg.hasDestination()) {
numFullLegs++;
}
}
return numFullLegs;
}
use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class SurveyStats method calcNumberSubSplays.
public static int calcNumberSubSplays(Station station) {
List<Leg> legs = Survey.getAllLegs(station);
int numSplays = 0;
for (Leg leg : legs) {
if (!leg.hasDestination()) {
numSplays++;
}
}
return numSplays;
}
use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class CrossSection method getProjection.
public Space<Coord2D> getProjection() {
Space<Coord2D> projection = new Space<>();
projection.addStation(station, Coord2D.ORIGIN);
for (Leg leg : station.getUnconnectedOnwardLegs()) {
// first of all normalise to match the angle of the cross section
Leg rotated = leg.rotate(-angle);
Coord3D coord3D = Space3DUtils.toCartesian(Coord3D.ORIGIN, rotated);
Coord2D coord2D = new Coord2D(coord3D.x, -coord3D.z);
Line<Coord2D> line = new Line<>(Coord2D.ORIGIN, coord2D);
projection.addLeg(rotated, line);
}
return projection;
}
use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class SurvexExporter method formatPromotedFrom.
private static void formatPromotedFrom(StringBuilder builder, Leg[] precursors) {
builder.append("{from: ");
boolean first = true;
for (Leg precursor : precursors) {
if (first) {
first = false;
} else {
builder.append(", ");
}
builder.append(TableCol.DISTANCE.format(precursor.getDistance()));
builder.append(" ");
builder.append(TableCol.AZIMUTH.format(precursor.getAzimuth()));
builder.append(" ");
builder.append(TableCol.INCLINATION.format(precursor.getInclination()));
}
builder.append("}");
}
use of org.hwyl.sexytopo.model.survey.Leg 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);
}
Aggregations