Search in sources :

Example 6 with Leg

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

the class Space3DTransformerTest method testTransform1MUp.

@Test
public void testTransform1MUp() {
    Leg up1MLeg = new Leg(1, 0, 90);
    Coord3D result = transformer.transform(Coord3D.ORIGIN, up1MLeg);
    Coord3D expected = new Coord3D(0, 0, 1);
    assertEquals(expected, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 7 with Leg

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

the class Space3DTransformerTest method testTransform10mNEUAndBack.

@Test
public void testTransform10mNEUAndBack() {
    Leg northEastAndUp10M = new Leg(10, 45, 45);
    Coord3D result = transformer.transform(Coord3D.ORIGIN, northEastAndUp10M);
    System.out.println("result = " + result);
    Leg reverse = new Leg(10, 225, -45);
    result = transformer.transform(result, reverse);
    assertEquals(Coord3D.ORIGIN, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 8 with Leg

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

the class Space3DTransformerTest method testTransform1MNorth.

@Test
public void testTransform1MNorth() {
    Leg north1MLeg = new Leg(1, 0, 0);
    Coord3D result = transformer.transform(Coord3D.ORIGIN, north1MLeg);
    Coord3D expected = new Coord3D(0, 1, 0);
    assertEquals(expected, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 9 with Leg

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

the class Space3DTransformerTest method testTransform1MDown.

@Test
public void testTransform1MDown() {
    Leg up1MLeg = new Leg(1, 0, -90);
    Coord3D result = transformer.transform(Coord3D.ORIGIN, up1MLeg);
    Coord3D expected = new Coord3D(0, 0, -1);
    assertEquals(expected, result);
}
Also used : Coord3D(org.hwyl.sexytopo.model.graph.Coord3D) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 10 with Leg

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

the class GraphView method drawLegs.

private void drawLegs(Canvas canvas, Space<Coord2D> space, int baseAlpha) {
    boolean showSplays = getDisplayPreference(GraphActivity.DisplayPreference.SHOW_SPLAYS);
    boolean highlightLatestLeg = PreferenceAccess.getBoolean(getContext(), "pref_key_highlight_latest_leg", true);
    boolean fadingNonActive = getDisplayPreference(GraphActivity.DisplayPreference.FADE_NON_ACTIVE);
    Map<Leg, Line<Coord2D>> legMap = space.getLegMap();
    for (Leg leg : legMap.keySet()) {
        if (!showSplays && !leg.hasDestination()) {
            continue;
        }
        Line<Coord2D> line = legMap.get(leg);
        // noinspection ConstantConditions
        Coord2D start = surveyCoordsToViewCoords(line.getStart());
        Coord2D end = surveyCoordsToViewCoords(line.getEnd());
        if (!isLineOnCanvas(start, end)) {
            continue;
        }
        boolean fade = baseAlpha == FADED_ALPHA || (fadingNonActive && !isAttachedToActive(leg));
        Paint paint;
        if (highlightLatestLeg && survey.getMostRecentLeg() == leg) {
            paint = fade ? fadedLatestLegPaint : latestLegPaint;
        } else if (!leg.hasDestination()) {
            paint = fade ? fadedSplayPaint : splayPaint;
        } else {
            paint = fade ? fadedLegPaint : legPaint;
        }
        if (projectionType.isLegInPlane(leg)) {
            canvas.drawLine(start.x, start.y, end.x, end.y, paint);
        } else {
            drawDashedLine(canvas, start, end, DASHED_LINE_INTERVAL, paint);
        }
    }
}
Also used : Line(org.hwyl.sexytopo.model.graph.Line) Coord2D(org.hwyl.sexytopo.model.graph.Coord2D) Paint(android.graphics.Paint) Leg(org.hwyl.sexytopo.model.survey.Leg)

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