Search in sources :

Example 91 with Leg

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

the class SurveyUpdaterTest method testEditStationWorks.

@Test
public void testEditStationWorks() {
    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)

Example 92 with Leg

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

the class SurveyUpdaterTest method testUpdateWithThreeSimilarLegsLeadsToNewStation.

@Test
public void testUpdateWithThreeSimilarLegsLeadsToNewStation() {
    Leg leg = new Leg(5, 0, 0);
    Leg similarLeg = new Leg(5, 0.001f, 0);
    Leg anotherSimilarLeg = new Leg(5, 0, 0.001f);
    Survey survey = new Survey("Test Survey");
    SurveyUpdater.update(survey, leg);
    SurveyUpdater.update(survey, similarLeg);
    SurveyUpdater.update(survey, anotherSimilarLeg);
    Assert.assertEquals(survey.getAllStations().size(), 2);
}
Also used : Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 93 with Leg

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

the class SurveyUpdaterTest method testMoveLegWorks.

@Test
public void testMoveLegWorks() {
    Survey survey = BasicTestSurveyCreator.createStraightNorth();
    Leg toMove = survey.getStationByName("2").getOnwardLegs().get(0);
    Station originatingStation = survey.getOriginatingStation(toMove);
    Station destinationStation = survey.getStationByName("1");
    Assert.assertNotEquals(originatingStation, destinationStation);
    SurveyUpdater.moveLeg(survey, toMove, destinationStation);
    Assert.assertTrue(destinationStation.getOnwardLegs().contains(toMove));
    Assert.assertFalse(originatingStation.getOnwardLegs().contains(toMove));
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 94 with Leg

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

the class SurveyStatsTest method testLegCountsWithSplays.

@Test
public void testLegCountsWithSplays() {
    Survey survey = BasicTestSurveyCreator.createStraightNorthWith2EBranchFromS2();
    Station subStation = survey.getStationByName("2");
    survey.setActiveStation(subStation);
    Leg leg2 = new Leg(5, 0, 0);
    SurveyUpdater.update(survey, leg2);
    Assert.assertEquals(5, SurveyStats.calcNumberSubStations(subStation));
    Assert.assertEquals(5, SurveyStats.calcNumberSubLegs(subStation));
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) 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