Search in sources :

Example 1 with GraphActivity

use of org.hwyl.sexytopo.control.activity.GraphActivity in project sexytopo by richsmith.

the class ConnectedSurveysTest method testSecondaryConnectedSurveyGetsTranslatedCorrectly.

@Test
public void testSecondaryConnectedSurveyGetsTranslatedCorrectly() throws Exception {
    Survey currentSurvey = getBasicSurvey("current");
    Survey joinedSurvey0 = getBasicSurvey("joined-0");
    Survey joinedSurvey1 = getBasicSurvey("joined-1");
    connectTwoSurveys(currentSurvey, currentSurvey.getActiveStation(), joinedSurvey0, joinedSurvey0.getOrigin());
    connectTwoSurveys(joinedSurvey0, joinedSurvey0.getActiveStation(), joinedSurvey1, joinedSurvey1.getOrigin());
    GraphActivity activity = new PlanActivity();
    Space<Coord2D> planProjection = Projection2D.PLAN.project(currentSurvey);
    Map<Survey, Space<Coord2D>> translated = ConnectedSurveys.getTranslatedConnectedSurveys(activity, currentSurvey, planProjection);
    Assert.assertEquals(translated.size(), 2);
    Survey translatedSurvey = getNamedSurvey(translated, "joined-1");
    Space<Coord2D> projection = translated.get(translatedSurvey);
    assert projection != null;
    Coord2D newStationPoint = getStationPosition(projection, "2");
    Assert.assertEquals(-3.0, newStationPoint.y, SexyTopo.ALLOWED_DOUBLE_DELTA);
}
Also used : Space(org.hwyl.sexytopo.model.graph.Space) Survey(org.hwyl.sexytopo.model.survey.Survey) GraphActivity(org.hwyl.sexytopo.control.activity.GraphActivity) PlanActivity(org.hwyl.sexytopo.control.activity.PlanActivity) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Test(org.junit.Test)

Example 2 with GraphActivity

use of org.hwyl.sexytopo.control.activity.GraphActivity in project sexytopo by richsmith.

the class ConnectedSurveysTest method testConnectedSurveyGetsTranslatedCorrectly.

@Test
public void testConnectedSurveyGetsTranslatedCorrectly() throws Exception {
    Survey currentSurvey = getBasicSurvey("current");
    Survey joinedSurvey = getBasicSurvey("joined");
    connectTwoSurveys(currentSurvey, currentSurvey.getActiveStation(), joinedSurvey, joinedSurvey.getOrigin());
    GraphActivity activity = new PlanActivity();
    Space<Coord2D> planProjection = Projection2D.PLAN.project(currentSurvey);
    Map<Survey, Space<Coord2D>> translated = ConnectedSurveys.getTranslatedConnectedSurveys(activity, currentSurvey, planProjection);
    Assert.assertEquals(translated.size(), 1);
    Survey translatedSurvey = getNamedSurvey(translated, "joined");
    Space<Coord2D> projection = translated.get(translatedSurvey);
    assert projection != null;
    Coord2D newStationPoint = getStationPosition(projection, "2");
    Assert.assertEquals(-2.0, newStationPoint.y, SexyTopo.ALLOWED_DOUBLE_DELTA);
}
Also used : Space(org.hwyl.sexytopo.model.graph.Space) Survey(org.hwyl.sexytopo.model.survey.Survey) GraphActivity(org.hwyl.sexytopo.control.activity.GraphActivity) PlanActivity(org.hwyl.sexytopo.control.activity.PlanActivity) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Test(org.junit.Test)

Example 3 with GraphActivity

use of org.hwyl.sexytopo.control.activity.GraphActivity in project sexytopo by richsmith.

the class ConnectedSurveysTest method testConnectedSurveySketchGetsTranslatedCorrectly.

@Test
public void testConnectedSurveySketchGetsTranslatedCorrectly() {
    Survey currentSurvey = getBasicSurvey("current");
    Survey joinedSurvey = getBasicSurvey("joined");
    Sketch sketch = joinedSurvey.getPlanSketch();
    PathDetail pathDetail = sketch.startNewPath(new Coord2D(0, 0));
    pathDetail.lineTo(new Coord2D(0, 1));
    sketch.finishPath();
    connectTwoSurveys(currentSurvey, currentSurvey.getActiveStation(), joinedSurvey, joinedSurvey.getOrigin());
    GraphActivity activity = new PlanActivity();
    Space<Coord2D> planProjection = Projection2D.PLAN.project(currentSurvey);
    Map<Survey, Space<Coord2D>> translated = ConnectedSurveys.getTranslatedConnectedSurveys(activity, currentSurvey, planProjection);
    Sketch translatedSketch = translated.keySet().iterator().next().getPlanSketch();
    PathDetail translatedPathDetail = translatedSketch.getPathDetails().toArray(new PathDetail[] {})[0];
    List<Coord2D> coords = translatedPathDetail.getPath();
    Assert.assertEquals(new Coord2D(0, -1), coords.get(0));
    Assert.assertEquals(new Coord2D(0, 0), coords.get(1));
}
Also used : Space(org.hwyl.sexytopo.model.graph.Space) Survey(org.hwyl.sexytopo.model.survey.Survey) GraphActivity(org.hwyl.sexytopo.control.activity.GraphActivity) PathDetail(org.hwyl.sexytopo.model.sketch.PathDetail) PlanActivity(org.hwyl.sexytopo.control.activity.PlanActivity) Sketch(org.hwyl.sexytopo.model.sketch.Sketch) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Test(org.junit.Test)

Aggregations

GraphActivity (org.hwyl.sexytopo.control.activity.GraphActivity)3 PlanActivity (org.hwyl.sexytopo.control.activity.PlanActivity)3 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)3 Space (org.hwyl.sexytopo.model.graph.Space)3 Survey (org.hwyl.sexytopo.model.survey.Survey)3 Test (org.junit.Test)3 PathDetail (org.hwyl.sexytopo.model.sketch.PathDetail)1 Sketch (org.hwyl.sexytopo.model.sketch.Sketch)1