use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class Border method updateCtrlPtHandlers.
private void updateCtrlPtHandlers(final IShape selectedShape) {
if (selectedShape instanceof IBezierCurve) {
final IBezierCurve pts = (IBezierCurve) selectedShape;
initialisePointHandler(ctrlPt1Handlers, pt -> new CtrlPointHandler(pt), pts.getFirstCtrlPts());
initialisePointHandler(ctrlPt2Handlers, pt -> new CtrlPointHandler(pt), pts.getSecondCtrlPts());
}
}
use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class TestParsingPSbezier method testParamArrowsArrows.
@Test
public void testParamArrowsArrows() {
parser("\\psbezier[arrows=<->](1,2)(3,4)(5,6)(7,8)");
final IBezierCurve bc = getShapeAt(0);
assertEquals(ArrowStyle.LEFT_ARROW, bc.getArrowStyle(0));
assertEquals(ArrowStyle.RIGHT_ARROW, bc.getArrowStyle(1));
}
use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class TestParsingPSbezier method testParse4Coordinates.
@Test
public void testParse4Coordinates() {
parser("\\psbezier(5,10)(1,2)(3,4)(5,6)");
final IBezierCurve bc = getShapeAt(0);
assertEquals(2, bc.getNbPoints());
assertEquals(5d * IShape.PPC, bc.getPtAt(0).getX(), 0.0001);
assertEquals(-10d * IShape.PPC, bc.getPtAt(0).getY(), 0.0001);
assertEquals(5d * IShape.PPC, bc.getPtAt(1).getX(), 0.0001);
assertEquals(-6d * IShape.PPC, bc.getPtAt(1).getY(), 0.0001);
assertEquals(9d * IShape.PPC, bc.getSecondCtrlPtAt(0).getX(), 0.0001);
assertEquals(-18d * IShape.PPC, bc.getSecondCtrlPtAt(0).getY(), 0.0001);
assertEquals(3d * IShape.PPC, bc.getFirstCtrlPtAt(1).getX(), 0.0001);
assertEquals(-4d * IShape.PPC, bc.getFirstCtrlPtAt(1).getY(), 0.0001);
}
use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class TestParsingPSbezier method testParse7Coordinates.
@Test
public void testParse7Coordinates() {
parser("\\psbezier(5,10)(1,2)(3,4)(5,6)(7,8)(9,10)(11,12)");
final IBezierCurve bc = getShapeAt(0);
assertEquals(3, bc.getNbPoints());
assertEquals(5d * IShape.PPC, bc.getPtAt(0).getX(), 0.0001);
assertEquals(-10d * IShape.PPC, bc.getPtAt(0).getY(), 0.0001);
assertEquals(5d * IShape.PPC, bc.getPtAt(1).getX(), 0.0001);
assertEquals(-6d * IShape.PPC, bc.getPtAt(1).getY(), 0.0001);
assertEquals(11d * IShape.PPC, bc.getPtAt(2).getX(), 0.0001);
assertEquals(-12d * IShape.PPC, bc.getPtAt(2).getY(), 0.0001);
assertEquals(9d * IShape.PPC, bc.getSecondCtrlPtAt(0).getX(), 0.0001);
assertEquals(-18d * IShape.PPC, bc.getSecondCtrlPtAt(0).getY(), 0.0001);
assertEquals(7d * IShape.PPC, bc.getSecondCtrlPtAt(1).getX(), 0.0001);
assertEquals(-8d * IShape.PPC, bc.getSecondCtrlPtAt(1).getY(), 0.0001);
assertEquals(3d * IShape.PPC, bc.getFirstCtrlPtAt(1).getX(), 0.0001);
assertEquals(-4d * IShape.PPC, bc.getFirstCtrlPtAt(1).getY(), 0.0001);
assertEquals(9d * IShape.PPC, bc.getFirstCtrlPtAt(2).getX(), 0.0001);
assertEquals(-10d * IShape.PPC, bc.getFirstCtrlPtAt(2).getY(), 0.0001);
}
use of net.sf.latexdraw.models.interfaces.shape.IBezierCurve in project latexdraw by arnobl.
the class TestParsingPSbezier method testParamArrowsArrowsNoneNone.
@Test
public void testParamArrowsArrowsNoneNone() {
parser("\\psbezier[arrows=<->]{-}(1,2)(3,4)(5,6)(7,8)");
final IBezierCurve bc = getShapeAt(0);
assertEquals(ArrowStyle.NONE, bc.getArrowStyle(0));
assertEquals(ArrowStyle.NONE, bc.getArrowStyle(1));
}
Aggregations