@Override public String toString() { String str = "nodes:" + pointList.getSize() + "; " + pointList.toString(); if (instructions != null && !instructions.isEmpty()) str += ", " + instructions.toString(); if (hasErrors()) str += ", " + errors.toString(); return str; }
@Test public void testBresenhamToLeft() { BresenhamLine.calcPoints( 47.57383, 9.61984, 47.57382, 9.61890, emitter, 47, 9, 0.00647, 0.00964); assertEquals(points.toString(), 1, points.getSize()); } }
@Test public void testSimplifyCheckPointOrder() { PointList pointList = new PointList(); pointList.parse2DJSON(points2); assertEquals(13, pointList.getSize()); new DouglasPeucker().setMaxDistance(.5).simplify(pointList); assertEquals(11, pointList.getSize()); assertFalse(pointList.toString(), pointList.toString().contains("NaN")); assertEquals("(50.203764443183644,9.961074440801317), (50.20318963087774,9.960999562464645), (50.202952888673984,9.96094144793469), (50.20267889356641,9.96223002587773), (50.201853928011374,9.961859918278305), " + "(50.20138565901039,9.961668810881722), (50.20128507617008,9.96216874485095), (50.20088553877664,9.961953795595925), (50.200686794534775,9.961899033827313), (50.20014066696481,9.961716680863127), (50.199798499043254,9.961588158344957)", pointList.toString()); } }
@Test public void testSimplifyCheckPointCount() { PointList pointList = new PointList(); pointList.parse2DJSON(points1); DouglasPeucker dp = new DouglasPeucker().setMaxDistance(.5); assertEquals(32, pointList.getSize()); dp.simplify(pointList); assertEquals(20, pointList.getSize()); assertFalse(pointList.toString(), pointList.toString().contains("NaN")); pointList.clear(); pointList.parse2DJSON(points1); dp.simplify(pointList, 0, pointList.size() -1); assertEquals(20, pointList.getSize()); pointList.clear(); pointList.parse2DJSON(points1); int removed1 = dp.simplify(pointList.copy(10, 20)); pointList.clear(); pointList.parse2DJSON(points1); int removed2 = dp.simplify(pointList, 10, 19); assertEquals(removed1, removed2); }
@Override public String toString() { String str = "nodes:" + pointList.getSize() + "; " + pointList.toString(); if (instructions != null && !instructions.isEmpty()) str += ", " + instructions.toString(); if (hasErrors()) str += ", " + errors.toString(); return str; }
@Override public String toString() { String str = "nodes:" + pointList.getSize() + "; " + pointList.toString(); if (instructions != null && !instructions.isEmpty()) str += ", " + instructions.toString(); if (hasErrors()) str += ", " + errors.toString(); return str; }
@Override public String toString() { String str = "nodes:" + pointList.getSize() + "; " + pointList.toString(); if (instructions != null && !instructions.isEmpty()) str += ", " + instructions.toString(); if (hasErrors()) str += ", " + errors.toString(); return str; }