Search in sources :

Example 31 with Survey

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

the class OldStyleLoaderTest method testStarredLinesAreIgnored.

@Test
public void testStarredLinesAreIgnored() throws Exception {
    String text = "*data normal from to length compass clino\n" + "1\t2\t9.11\t121\t-23\n";
    Survey survey = new Survey("TestSurvey");
    OldStyleLoader.parse(text, survey);
    assert survey.getAllStations().size() == 2;
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 32 with Survey

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

the class OldStyleLoaderTest method testReversedLegIsParsed.

@Test
public void testReversedLegIsParsed() throws Exception {
    String text = "2\t1\t9.11\t121\t-23\n";
    Survey survey = new Survey("TestSurvey");
    OldStyleLoader.parse(text, survey);
    assert survey.getAllStations().size() == 2;
    assert survey.getOrigin().getConnectedOnwardLegs().get(0).getDestination().getName().equals("2");
    assert survey.getOrigin().getConnectedOnwardLegs().get(0).wasShotBackwards();
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 33 with Survey

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

the class ExtendedElevationProjectionTest method testProject1MNorth1MEast.

@Test
public void testProject1MNorth1MEast() {
    Survey survey = BasicTestSurveyCreator.create5MEast();
    Space<Coord2D> space = Projection2D.EXTENDED_ELEVATION.project(survey);
    Map<Station, Coord2D> stationMap = space.getStationMap();
    Map<Leg, Line<Coord2D>> legMap = space.getLegMap();
    Station two = survey.getStationByName("2");
    Coord2D twoCoord = stationMap.get(two);
    Coord2D expected = new Coord2D(5, 0);
    Assert.assertEquals(expected, twoCoord);
    Leg splayLeft = two.getUnconnectedOnwardLegs().get(0);
    Line<Coord2D> splayLeftLine = legMap.get(splayLeft);
    expected = new Coord2D(5, 0);
    assert splayLeftLine != null;
    Assert.assertEquals(expected, splayLeftLine.getEnd());
    Leg splayRight = two.getUnconnectedOnwardLegs().get(1);
    Line<Coord2D> splayRightLine = legMap.get(splayRight);
    expected = new Coord2D(5, 0);
    assert splayRightLine != null;
    Assert.assertEquals(expected, splayRightLine.getEnd());
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Line(org.hwyl.sexytopo.model.graph.Line) Survey(org.hwyl.sexytopo.model.survey.Survey) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 34 with Survey

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

the class ExtendedElevationProjectionTest method testProject5MNorthReversed.

@Test
public void testProject5MNorthReversed() {
    Survey survey = BasicTestSurveyCreator.createStraightNorth();
    survey.getStationByName("2").switchDirection();
    Space<Coord2D> space = Projection2D.EXTENDED_ELEVATION.project(survey);
    Map<Station, Coord2D> stationMap = space.getStationMap();
    Station two = survey.getStationByName("2");
    Coord2D twoCoord = stationMap.get(two);
    Coord2D expected = new Coord2D(-5, 0);
    Assert.assertEquals(expected, twoCoord);
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Test(org.junit.Test)

Example 35 with Survey

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

the class ExtendedElevationProjectionTest method testProject5MDown.

@Test
public void testProject5MDown() {
    Survey survey = BasicTestSurveyCreator.create5MDown();
    Space<Coord2D> space = Projection2D.EXTENDED_ELEVATION.project(survey);
    Map<Station, Coord2D> stationMap = space.getStationMap();
    Station two = survey.getStationByName("2");
    Coord2D twoCoord = stationMap.get(two);
    Coord2D expected = new Coord2D(0, 5);
    Assert.assertEquals(expected, twoCoord);
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Test(org.junit.Test)

Aggregations

Survey (org.hwyl.sexytopo.model.survey.Survey)101 Test (org.junit.Test)56 Station (org.hwyl.sexytopo.model.survey.Station)31 Leg (org.hwyl.sexytopo.model.survey.Leg)24 AlertDialog (android.app.AlertDialog)10 SuppressLint (android.annotation.SuppressLint)9 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)9 ArrayAdapter (android.widget.ArrayAdapter)8 File (java.io.File)6 HashMap (java.util.HashMap)6 View (android.view.View)5 EditText (android.widget.EditText)5 ArrayList (java.util.ArrayList)5 Set (java.util.Set)5 Context (android.content.Context)4 SharedPreferences (android.content.SharedPreferences)4 Editable (android.text.Editable)4 List (java.util.List)4 Map (java.util.Map)4 R (org.hwyl.sexytopo.R)4