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);
}
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);
}
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);
}
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);
}
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);
}
}
}
Aggregations