Search in sources :

Example 86 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class Space3DUtilsTest method testTransform1MUp.

@Test
public void testTransform1MUp() {
    Leg up1MLeg = new Leg(1, 0, 90);
    Coord3D result = Space3DUtils.toCartesian(Coord3D.ORIGIN, up1MLeg);
    Coord3D expected = new Coord3D(0, 0, 1);
    assertEquals(expected, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 87 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class Space3DUtilsTest method testTransform1MDown.

@Test
public void testTransform1MDown() {
    Leg up1MLeg = new Leg(1, 0, -90);
    Coord3D result = Space3DUtils.toCartesian(Coord3D.ORIGIN, up1MLeg);
    Coord3D expected = new Coord3D(0, 0, -1);
    assertEquals(expected, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 88 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class Space3DUtilsTest method testTransform3N3E3S3W.

@Test
public void testTransform3N3E3S3W() {
    Leg n3 = new Leg(3, 0, 0);
    Coord3D result = Space3DUtils.toCartesian(Coord3D.ORIGIN, n3);
    Leg e3 = new Leg(3, 90, 0);
    result = Space3DUtils.toCartesian(result, e3);
    Leg s3 = new Leg(3, 180, 0);
    result = Space3DUtils.toCartesian(result, s3);
    Leg w3 = new Leg(3, 270, 0);
    result = Space3DUtils.toCartesian(result, w3);
    assertEquals(Coord3D.ORIGIN, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 89 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class StationRenameTest method testBacksights.

@Test
public void testBacksights() {
    Leg fore1 = new Leg(10, 180, +42);
    Leg back1 = new Leg(10, 0, -42);
    Assert.assertTrue("Legs should be perfectly-equal backsights", SurveyUpdater.areLegsBacksights(fore1, back1));
    Leg back2 = new Leg(15, 90, 0);
    Assert.assertFalse("Legs should not be considered backsights for each other", SurveyUpdater.areLegsBacksights(fore1, back2));
}
Also used : Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 90 with Leg

use of org.hwyl.sexytopo.model.survey.Leg in project sexytopo by richsmith.

the class SurveyUpdaterTest method testEditLegWorks.

@Test
public void testEditLegWorks() {
    Leg leg = new Leg(5, 0, 0);
    Survey survey = new Survey("Test Survey");
    SurveyUpdater.update(survey, leg);
    Leg newEdit = new Leg(6, 0, 0);
    SurveyUpdater.editLeg(survey, leg, newEdit);
    Assert.assertEquals(survey.getAllLegs().size(), 1);
    Assert.assertEquals(survey.getAllLegs().get(0).getDistance(), 6, ALLOWED_DOUBLE_DELTA);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Aggregations

Leg (org.hwyl.sexytopo.model.survey.Leg)94 Station (org.hwyl.sexytopo.model.survey.Station)30 Test (org.junit.Test)30 Survey (org.hwyl.sexytopo.model.survey.Survey)23 Coord3D (org.hwyl.sexytopo.model.graph.Coord3D)17 Line (org.hwyl.sexytopo.model.graph.Line)8 ArrayList (java.util.ArrayList)7 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)7 JSONArray (org.json.JSONArray)6 JSONObject (org.json.JSONObject)6 Space (org.hwyl.sexytopo.model.graph.Space)4 TextView (android.widget.TextView)3 GraphToListTranslator (org.hwyl.sexytopo.control.util.GraphToListTranslator)3 TableCol (org.hwyl.sexytopo.model.table.TableCol)3 JSONException (org.json.JSONException)3 AlertDialog (android.app.AlertDialog)2 ParseException (java.text.ParseException)2 HashMap (java.util.HashMap)2 LRUD (org.hwyl.sexytopo.model.table.LRUD)2 SuppressLint (android.annotation.SuppressLint)1