Search in sources :

Example 16 with PathDetail

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

Example 17 with PathDetail

use of org.hwyl.sexytopo.model.sketch.PathDetail in project sexytopo by richsmith.

the class XviImporter method parseSketchlineBlock.

public static List<PathDetail> parseSketchlineBlock(double scale, String contents) throws Exception {
    String sketchBlock = getBlockContents(contents, SKETCHLINE_COMMAND);
    List<String> entries = parseBlockEntries(sketchBlock);
    List<PathDetail> pathDetails = new ArrayList<>();
    for (String entry : entries) {
        PathDetail pathDetail = parseSketchEntry(scale, entry);
        pathDetails.add(pathDetail);
    }
    return pathDetails;
}
Also used : PathDetail(org.hwyl.sexytopo.model.sketch.PathDetail) ArrayList(java.util.ArrayList)

Example 18 with PathDetail

use of org.hwyl.sexytopo.model.sketch.PathDetail in project sexytopo by richsmith.

the class XviImporterTest method testParseSketchEntryGetsRightColour.

@Test
public void testParseSketchEntryGetsRightColour() throws Exception {
    String simpleText = "red 0 0";
    PathDetail pathDetail = XviImporter.parseSketchEntry(1, simpleText);
    Assert.assertEquals(Colour.RED, pathDetail.getColour());
}
Also used : PathDetail(org.hwyl.sexytopo.model.sketch.PathDetail) Test(org.junit.Test)

Example 19 with PathDetail

use of org.hwyl.sexytopo.model.sketch.PathDetail in project sexytopo by richsmith.

the class XviImporterTest method testParseSketchEntryFailsForUnevenData.

@Test(expected = IllegalArgumentException.class)
public void testParseSketchEntryFailsForUnevenData() throws Exception {
    String simpleText = "red 0 0 1";
    PathDetail pathDetail = XviImporter.parseSketchEntry(1, simpleText);
}
Also used : PathDetail(org.hwyl.sexytopo.model.sketch.PathDetail) Test(org.junit.Test)

Aggregations

PathDetail (org.hwyl.sexytopo.model.sketch.PathDetail)19 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)9 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 Colour (org.hwyl.sexytopo.model.sketch.Colour)5 Sketch (org.hwyl.sexytopo.model.sketch.Sketch)5 SymbolDetail (org.hwyl.sexytopo.model.sketch.SymbolDetail)3 TextDetail (org.hwyl.sexytopo.model.sketch.TextDetail)3 JSONArray (org.json.JSONArray)3 JSONObject (org.json.JSONObject)3 BrushColour (org.hwyl.sexytopo.model.sketch.BrushColour)2 CrossSectionDetail (org.hwyl.sexytopo.model.sketch.CrossSectionDetail)2 SuppressLint (android.annotation.SuppressLint)1 Bitmap (android.graphics.Bitmap)1 Paint (android.graphics.Paint)1 HashSet (java.util.HashSet)1 List (java.util.List)1 GraphActivity (org.hwyl.sexytopo.control.activity.GraphActivity)1 PlanActivity (org.hwyl.sexytopo.control.activity.PlanActivity)1 Space (org.hwyl.sexytopo.model.graph.Space)1