public void drawLine(int x1, int y1, int x2, int y2) { int width = 0; if (_stroke != null && _stroke instanceof BasicStroke) { width = (int) ((BasicStroke)_stroke).getLineWidth() * 12700; } getEscherGraphics().drawLine(x1,y1,x2,y2, width); // draw(new GeneralPath(new java.awt.geom.Line2D.Float(x1, y1, x2, y2))); }
protected void applyStroke(SimpleShape<?,?> shape) { if (_stroke instanceof BasicStroke){ BasicStroke bs = (BasicStroke)_stroke; shape.setStrokeStyle((double)bs.getLineWidth()); float[] dash = bs.getDashArray(); if (dash != null) { //TODO: implement more dashing styles shape.setStrokeStyle(StrokeStyle.LineDash.DASH); } } }
dash[i] = (float) la.getLinePattern()[i]; stroke = new BasicStroke(stroke.getLineWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10f, dash, 0f);
double lineWidth = Math.max(2.5, stroke.getLineWidth());
case BasicStroke.JOIN_BEVEL: veeX = endX - stroke.getLineWidth() * 0.25f; break; default: case BasicStroke.JOIN_MITER: veeX = endX - stroke.getLineWidth() * 0.5f / arrowRatio; break; case BasicStroke.JOIN_ROUND: veeX = endX - stroke.getLineWidth() * 0.5f; break; g.draw ( new Line2D.Float ( 50.0f, 0.0f, veeX - stroke.getLineWidth() * 0.25f, 0.0f ) ); float veeX = endX - stroke.getLineWidth() * 0.5f / arrowRatio;
double lineWidth = Math.max(2.5, stroke.getLineWidth());
public void draw(Shape shape) { if (shape instanceof Line2D) { Line2D shape2d = (Line2D) shape; int width = 0; if (_stroke != null && _stroke instanceof BasicStroke) { width = (int) ((BasicStroke)_stroke).getLineWidth() * 12700; } drawLine((int)shape2d.getX1(), (int)shape2d.getY1(), (int)shape2d.getX2(), (int)shape2d.getY2(), width); } else { if (logger.check(POILogger.WARN)) logger.log(POILogger.WARN, "draw not fully supported"); } }
private void drawScreenFrame(Graphics2D g2d, int scrId) { if (!isLocalScreen) { return; } g2d.setColor(screenFrameColor); g2d.setStroke(strokeScreenFrame); if (screenFrame == null) { // screenFrame = Screen.getBounds(scrId); Rectangle ubound = scrOCP.getRectangle(); screenFrame.x -= ubound.x; screenFrame.y -= ubound.y; int sw = (int) (strokeScreenFrame.getLineWidth() / 2); screenFrame.x += sw; screenFrame.y += sw; screenFrame.width -= sw * 2; screenFrame.height -= sw * 2; } g2d.draw(screenFrame); }
float lineWidth = basic.getLineWidth(); Rectangle2D bounds = shape.getBounds2D(); return bounds.getWidth() < lineWidth || bounds.getHeight() < lineWidth;
private Geometry getGeometryBounds( Icon icon, Mark mark, Shape shape, double markSize, Object feature) { Geometry bounds; if (icon != null) { bounds = new GeometryBuilder().box(0, 0, icon.getIconWidth(), icon.getIconHeight()); } else { // the shape can be very complicated, go for the MBR. Wanted to use ShapeReader, but it // blindly assumes the shape is a polygon, while it may not be. Building a multipoint // instead AffineTransform at = AffineTransform.getScaleInstance(markSize, -markSize); Shape ts = at.createTransformedShape(shape); Geometry shapeGeometry = JTS.toGeometry(ts); bounds = new MinimumDiameter(shapeGeometry).getMinimumRectangle(); } // grow by the stroke size, if this is a mark if (icon == null && mark != null) { Stroke stroke = factory.getStroke(mark.getStroke(), feature); if (stroke instanceof BasicStroke) { float width = ((BasicStroke) stroke).getLineWidth() / 2 + 1; if (width > 0) { Geometry buffered = bounds.buffer(width); bounds = new MinimumDiameter(buffered).getMinimumRectangle(); } } } return bounds; }
public static double getStyle2DSize(Style2D style) { if (style instanceof GraphicStyle2D) { final BufferedImage image = ((GraphicStyle2D) style).getImage(); return maxSize(image.getWidth(), image.getHeight()); } else if (style instanceof IconStyle2D) { final Icon icon = ((IconStyle2D) style).getIcon(); return maxSize(icon.getIconWidth(), icon.getIconHeight()); } else if (style instanceof LineStyle2D) { LineStyle2D ls = ((LineStyle2D) style); double gsSize = getStyle2DSize(ls.getGraphicStroke()); double strokeSize = 0; if (ls.getStroke() instanceof BasicStroke) { strokeSize = ((BasicStroke) ls.getStroke()).getLineWidth(); } double offset = ls.getPerpendicularOffset(); double lineSize = maxSize(maxSize(gsSize, strokeSize), offset); // a MarkStyle2D is also a LineStyle2D, but we have to account for the symbol size if (style instanceof MarkStyle2D) { MarkStyle2D mark = (MarkStyle2D) style; return mark.getSize() + lineSize; } else { return lineSize; } } else { return 0; } }
stroke = new BasicStroke( bs.getLineWidth() + strokeWidthAdjustment, bs.getEndCap(), bs.getLineJoin(),
float lineWidth = Math.max(2, series.getLineStyle().getLineWidth());
BasicStroke newLineStyle = new BasicStroke( existingLineStyle.getLineWidth() > BOX_OUTLINE_WIDTH * 0.5f ? BOX_OUTLINE_WIDTH * 0.5f : existingLineStyle.getLineWidth(), existingLineStyle.getEndCap(), existingLineStyle.getLineJoin(), double lineOffset = existingLineStyle.getLineWidth() * 0.5; outlinePath.moveTo(startx + lineOffset, starty + lineOffset); outlinePath.lineTo(startx + lineOffset, starty + BOX_SIZE - lineOffset);
public void drawLine(int x1, int y1, int x2, int y2) { int width = 0; if (_stroke != null && _stroke instanceof BasicStroke) { width = (int) ((BasicStroke)_stroke).getLineWidth() * 12700; } getEscherGraphics().drawLine(x1,y1,x2,y2, width); // draw(new GeneralPath(new java.awt.geom.Line2D.Float(x1, y1, x2, y2))); }
private Stroke copyOf(Stroke s) { if (s == null) { return null; } if (s instanceof BasicStroke) { BasicStroke bs = (BasicStroke) s; return new BasicStroke(bs.getLineWidth(), bs.getEndCap(), bs.getLineJoin(), bs.getMiterLimit(), bs.getDashArray(), bs.getDashPhase()); } throw new UnsupportedOperationException("The Stroke type '" + s.getClass().getName() + "' is not supported"); }
private Stroke transformStroke(Stroke stroke) { if (!(stroke instanceof BasicStroke)) return stroke; BasicStroke st = (BasicStroke)stroke; float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant())); float dash[] = st.getDashArray(); if (dash != null) { for (int k = 0; k < dash.length; ++k) dash[k] *= scale; } return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale); }
private Stroke transformStroke(Stroke stroke) { if (!(stroke instanceof BasicStroke)) return stroke; BasicStroke st = (BasicStroke)stroke; float scale = (float)Math.sqrt(Math.abs(transform.getDeterminant())); float[] dash = st.getDashArray(); if (dash != null) { for (int k = 0; k < dash.length; ++k) dash[k] *= scale; } return new BasicStroke(st.getLineWidth() * scale, st.getEndCap(), st.getLineJoin(), st.getMiterLimit(), dash, st.getDashPhase() * scale); }
protected void applyStroke(SimpleShape<?,?> shape) { if (_stroke instanceof BasicStroke){ BasicStroke bs = (BasicStroke)_stroke; shape.setStrokeStyle((double)bs.getLineWidth()); float[] dash = bs.getDashArray(); if (dash != null) { //TODO: implement more dashing styles shape.setStrokeStyle(StrokeStyle.LineDash.DASH); } } }
protected BasicStroke getScaledStroke() { if (ic==null) return stroke; double mag = ic.getMagnification(); if (mag!=1.0) { float width = (float)(stroke.getLineWidth()*mag); //return new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); return new BasicStroke(width, stroke.getEndCap(), stroke.getLineJoin(), stroke.getMiterLimit(), stroke.getDashArray(), stroke.getDashPhase()); } else return stroke; }