/** * Returns a shape that can be used to draw the mark at the x, y coordinates with appropriated * rotation and size (according to the current style) * * @param x the x coordinate where the mark will be drawn * @param y the y coordinate where the mark will be drawn * @return a shape that can be used to draw the mark */ public Shape getTransformedShape(float x, float y) { return getTransformedShape(x, y, 0, rotation); }
public Rectangle getGraphicDimensions() { if (graphic instanceof MarkStyle2D) { return ((MarkStyle2D) graphic).getTransformedShape(0f, 0f).getBounds(); } else if (graphic instanceof GraphicStyle2D) { BufferedImage i = ((GraphicStyle2D) graphic).getImage(); return new Rectangle(i.getWidth(), i.getHeight()); } else if (graphic instanceof IconStyle2D) { final Icon icon = ((IconStyle2D) graphic).getIcon(); return new Rectangle(icon.getIconWidth(), icon.getIconWidth()); } else { throw new RuntimeException( "Can't render graphic which is not a MarkStyle2D or a GraphicStyle2D"); } }
Shape shape2 = style.getTransformedShape(point[0], point[1]);
ms2d.getTransformedShape( (float) x, (float) y, (float) rotation, (float) graphicRotation); if (transformedShape != null) {
public void testAlternativeMarkSizeCalculation() { MarkStyle2D ms = new MarkStyle2D(); ms.setSize(1); GeneralPath gp = new GeneralPath(); gp.moveTo(500, 0); gp.lineTo(-500, 0); gp.moveTo(200, -275); gp.lineTo(200, 275); ms.setShape(gp); Shape shape = ms.getTransformedShape(0, 0); Rectangle2D rect = shape.getBounds2D(); assertEquals(1.0, rect.getHeight(), 0.0001); assertEquals(1000.0 / 550.0, rect.getWidth(), 0.0001); MarkStyle2D.setMaxMarkSizeEnabled(true); shape = ms.getTransformedShape(0, 0); rect = shape.getBounds2D(); assertEquals(550.0 / 1000.0, rect.getHeight(), 0.0001); assertEquals(1.0, rect.getWidth(), 0.0001); }
while (!(citer.isDone())) { if (citer.currentSegment(coords) != PathIterator.SEG_MOVETO) { transformedShape = ms2d.getTransformedShape(coords[0], coords[1]); if (transformedShape != null) { if (ms2d.getFill() != null) {
/** * Returns a shape that can be used to draw the mark at the x, y coordinates * with appropriated rotation and size (according to the current style) * * @param x the x coordinate where the mark will be drawn * @param y the y coordinate where the mark will be drawn * * @return a shape that can be used to draw the mark */ public Shape getTransformedShape(float x, float y) { return getTransformedShape(x, y, rotation); }
public Rectangle getGraphicDimensions() { if (graphic instanceof MarkStyle2D) { return ((MarkStyle2D)graphic).getTransformedShape(0f, 0f).getBounds(); } else if (graphic instanceof GraphicStyle2D) { BufferedImage i = ((GraphicStyle2D)graphic).getImage(); return new Rectangle(i.getWidth(),i.getHeight()); } else if(graphic instanceof IconStyle2D) { final Icon icon = ((IconStyle2D) graphic).getIcon(); return new Rectangle(icon.getIconWidth(), icon.getIconWidth()); } else { throw new RuntimeException("Can't render graphic which is not a MarkStyle2D or a GraphicStyle2D"); } }
Shape transformedShape = ms2d.getTransformedShape((float) x, (float) y, (float) rotation); if (transformedShape != null) { if (ms2d.getFill() != null) {
Shape transformedShape = ms2d.getTransformedShape((float) x, (float) y, (float) rotation); if (transformedShape != null) { if (ms2d.getFill() != null) {
Shape shape2 = style.getTransformedShape(point[0], point[1]);
while (!(citer.isDone())) { citer.currentSegment(coords); transformedShape = ms2d.getTransformedShape(coords[0], coords[1]); if (transformedShape != null) {
citer.currentSegment(coords); Shape transformedShape = ms2d.getTransformedShape(coords[0], coords[1]);
citer.currentSegment(coords); Shape transformedShape = ms2d.getTransformedShape(coords[0], coords[1]);
while (!(citer.isDone())) { citer.currentSegment(coords); transformedShape = ms2d.getTransformedShape(coords[0], coords[1]); if (transformedShape != null) {