use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class Space3DTransformerTest method testTransform3N3E3S3W.
@Test
public void testTransform3N3E3S3W() {
Leg n3 = new Leg(3, 0, 0);
Coord3D result = transformer.transform(Coord3D.ORIGIN, n3);
Leg e3 = new Leg(3, 90, 0);
result = transformer.transform(result, e3);
Leg s3 = new Leg(3, 180, 0);
result = transformer.transform(result, s3);
Leg w3 = new Leg(3, 270, 0);
result = transformer.transform(result, w3);
assertEquals(Coord3D.ORIGIN, result);
}
use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class Space3DTransformerTest method testTransform1MEast.
@Test
public void testTransform1MEast() {
Leg east1MLeg = new Leg(1, 90, 0);
Coord3D result = transformer.transform(Coord3D.ORIGIN, east1MLeg);
Coord3D expected = new Coord3D(1, 0, 0);
assertEquals(expected, result);
}
use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class Space3DTransformerTest method testTransform2MNorth.
@Test
public void testTransform2MNorth() {
Leg north2MLeg = new Leg(2, 0, 0);
Coord3D result = transformer.transform(Coord3D.ORIGIN, north2MLeg);
Coord3D expected = new Coord3D(0, 2, 0);
assertEquals(expected, result);
}
use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class MeasurementProtocol method go.
public void go(DataInputStream inStream, DataOutputStream outStream) throws Exception {
Log.device(context.getString(R.string.device_log_ready_for_measurements));
byte[] packet = readPacket(inStream);
if (packet == null) {
return;
}
acknowledge(outStream, packet);
if (isDataPacket(packet)) {
if (arePacketsTheSame(packet, previousPacket)) {
Log.device("(Duplicated measurement #" + ++duplicateCount + ")");
} else {
duplicateCount = 0;
Log.device(context.getString(R.string.device_log_received));
Leg leg = parseDataPacket(packet);
dataManager.updateSurvey(leg);
}
}
previousPacket = packet;
}
use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.
the class PocketTopoTxtImporter method extractOffset.
public static Coord2D extractOffset(Survey survey, String text, Space<Coord2D> projection) {
String stationsSection = getNamedSubSection(text, "STATIONS");
String[] lines = TextTools.toArrayOfLines(stationsSection);
Station guessedAnchorStation = survey.getOrigin();
Coord2D offset = getOffsetForNamedStation(lines, guessedAnchorStation);
if (offset == null) {
if (guessedAnchorStation.getConnectedOnwardLegs().size() > 0) {
Leg onward = guessedAnchorStation.getConnectedOnwardLegs().get(0);
guessedAnchorStation = onward.getDestination();
offset = getOffsetForNamedStation(lines, guessedAnchorStation);
Coord2D position = projection.getStationMap().get(guessedAnchorStation);
offset = offset.minus(position.flipVertically());
}
}
if (offset == null) {
// ¯\_(ツ)_/¯
offset = Coord2D.ORIGIN;
}
return offset;
}
Aggregations