Search in sources :

Example 21 with Station

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

the class TherionImporterTest method testElevationDirectionExtraction.

@Test
public void testElevationDirectionExtraction() throws Exception {
    Survey survey = new Survey("Test");
    TherionImporter.updateCentreline(LINES, survey);
    Station stationTwo = survey.getStationByName("2");
    Direction stationTwoDirection = stationTwo.getExtendedElevationDirection();
    Assert.assertEquals(Direction.LEFT, stationTwoDirection);
    Station stationThree = survey.getStationByName("3");
    Direction stationThreeDirection = stationThree.getExtendedElevationDirection();
    Assert.assertEquals(Direction.LEFT, stationThreeDirection);
    Station stationFive = survey.getStationByName("5");
    Direction stationFiveDirection = stationFive.getExtendedElevationDirection();
    Assert.assertEquals(Direction.RIGHT, stationFiveDirection);
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Direction(org.hwyl.sexytopo.model.graph.Direction) Test(org.junit.Test)

Example 22 with Station

use of org.hwyl.sexytopo.model.survey.Station 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 23 with Station

use of org.hwyl.sexytopo.model.survey.Station 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 24 with Station

use of org.hwyl.sexytopo.model.survey.Station 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)

Example 25 with Station

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

the class ExtendedElevationProjectionTest method testProject5MNorth.

@Test
public void testProject5MNorth() {
    Survey survey = BasicTestSurveyCreator.createStraightNorth();
    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)

Aggregations

Station (org.hwyl.sexytopo.model.survey.Station)85 Leg (org.hwyl.sexytopo.model.survey.Leg)32 Survey (org.hwyl.sexytopo.model.survey.Survey)30 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)20 Test (org.junit.Test)19 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)9 SuppressLint (android.annotation.SuppressLint)8 AlertDialog (android.app.AlertDialog)8 JSONException (org.json.JSONException)7 Line (org.hwyl.sexytopo.model.graph.Line)6 SurveyConnection (org.hwyl.sexytopo.model.survey.SurveyConnection)6 JSONObject (org.json.JSONObject)6 View (android.view.View)5 Set (java.util.Set)5 Direction (org.hwyl.sexytopo.model.graph.Direction)5 Space (org.hwyl.sexytopo.model.graph.Space)5 JSONArray (org.json.JSONArray)5 Context (android.content.Context)4 HashSet (java.util.HashSet)4