瀏覽代碼

Revert changing signature of protected ShapeRenderer#drawPath method

pull/601/head
dmitriik 2 月之前
父節點
當前提交
fc62bec233

+ 4
- 2
poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/shape/ShapeDebuggerRenderer.java 查看文件

@@ -19,6 +19,7 @@ package org.apache.poi.xdgf.usermodel.shape;

import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;

import org.apache.poi.xdgf.usermodel.XDGFShape;

@@ -39,9 +40,9 @@ public class ShapeDebuggerRenderer extends ShapeRenderer {
}

@Override
protected void drawPath(XDGFShape shape) {
protected Path2D drawPath(XDGFShape shape) {

super.drawPath(shape);
Path2D path = super.drawPath(shape);
if (_debugAcceptor == null || _debugAcceptor.accept(shape)) {

// show numbers to associate shapes with ids.. doesn't always work
@@ -62,6 +63,7 @@ public class ShapeDebuggerRenderer extends ShapeRenderer {
_graphics.scale(1, -1);
}

return path;
}

}

+ 22
- 8
poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/shape/ShapeRenderer.java 查看文件

@@ -60,23 +60,37 @@ public class ShapeRenderer extends ShapeVisitor {
_graphics.setTransform(savedTr);
}

protected void drawPath(XDGFShape shape) {
protected Path2D drawPath(XDGFShape shape) {
Path2D path = null;

for (GeometrySection geometrySection : shape.getGeometrySections()) {
if (geometrySection.getNoShow()) {
continue;
}

Path2D.Double path = geometrySection.getPath(shape);
if (path != null) {
// We preserve only first drawn path
if (path == null) {
path = drawPath(geometrySection, shape);
} else {
drawPath(geometrySection, shape);
}

// setup the stroke for this line
}

_graphics.setColor(shape.getLineColor());
_graphics.setStroke(shape.getStroke());
_graphics.draw(path);
}
return path;
}

private Path2D drawPath(GeometrySection geometrySection, XDGFShape shape) {
Path2D path = geometrySection.getPath(shape);
if (path != null) {

// setup the stroke for this line

_graphics.setColor(shape.getLineColor());
_graphics.setStroke(shape.getStroke());
_graphics.draw(path);
}
return path;
}

protected void drawText(XDGFShape shape) {

Loading…
取消
儲存