From: <gil...@us...> - 2009-06-10 15:54:30
|
Revision: 14605 http://cdk.svn.sourceforge.net/cdk/?rev=14605&view=rev Author: gilleain Date: 2009-06-10 15:54:14 +0000 (Wed, 10 Jun 2009) Log Message: ----------- Made arrow head width consistent with other properties. Modified Paths: -------------- cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RendererModel.java cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RenderingParameters.java cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/visitor/AWTDrawVisitor.java Modified: cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RendererModel.java =================================================================== --- cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RendererModel.java 2009-06-08 13:43:34 UTC (rev 14604) +++ cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RendererModel.java 2009-06-10 15:54:14 UTC (rev 14605) @@ -101,6 +101,14 @@ public RendererModel(RenderingParameters parameters) { this.parameters = parameters; } + + public int getArrowHeadWidth() { + return this.parameters.getArrowHeadWidth(); + } + + public void setArrowHeadWidth(int arrowHeadWidth) { + this.parameters.setArrowHeadWidth(arrowHeadWidth); + } public boolean getHighlightShapeFilled() { return this.parameters.isHighlightShapeFilled(); Modified: cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RenderingParameters.java =================================================================== --- cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RenderingParameters.java 2009-06-08 13:43:34 UTC (rev 14604) +++ cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/RenderingParameters.java 2009-06-10 15:54:14 UTC (rev 14605) @@ -19,6 +19,11 @@ * be covered by a shape determined by this enumeration */ public enum AtomShape { OVAL, SQUARE }; + + /** + * The width of an arrow head + */ + private int arrowHeadWidth = 10; /** * The background color of the rendered image @@ -169,6 +174,14 @@ private double wedgeWidth = 2.0; + public int getArrowHeadWidth() { + return arrowHeadWidth; + } + + public void setArrowHeadWidth(int arrowHeadWidth) { + this.arrowHeadWidth = arrowHeadWidth; + } + public boolean isHighlightShapeFilled() { return highlightShapeFilled; } Modified: cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/visitor/AWTDrawVisitor.java =================================================================== --- cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/visitor/AWTDrawVisitor.java 2009-06-08 13:43:34 UTC (rev 14604) +++ cdk/branches/jchempaint-primary/src/main/org/openscience/cdk/renderer/visitor/AWTDrawVisitor.java 2009-06-10 15:54:14 UTC (rev 14605) @@ -101,14 +101,15 @@ int[] a = this.transformPoint(line.x1, line.y1); int[] b = this.transformPoint(line.x2, line.y2); this.g.drawLine(a[0], a[1], b[0], b[1]); + double aW = rendererModel.getArrowHeadWidth() / rendererModel.getScale(); if(line.direction){ - int[] c = this.transformPoint(line.x1-rendererModel.arrowHeadWidth / this.rendererModel.getScale(), line.y1-rendererModel.arrowHeadWidth / this.rendererModel.getScale()); - int[] d = this.transformPoint(line.x1-rendererModel.arrowHeadWidth / this.rendererModel.getScale(), line.y1+rendererModel.arrowHeadWidth / this.rendererModel.getScale()); + int[] c = this.transformPoint(line.x1-aW, line.y1-aW); + int[] d = this.transformPoint(line.x1-aW, line.y1+aW); this.g.drawLine(a[0], a[1], c[0], c[1]); this.g.drawLine(a[0], a[1], d[0], d[1]); }else{ - int[] c = this.transformPoint(line.x2+rendererModel.arrowHeadWidth / this.rendererModel.getScale(), line.y2-rendererModel.arrowHeadWidth / this.rendererModel.getScale()); - int[] d = this.transformPoint(line.x2+rendererModel.arrowHeadWidth / this.rendererModel.getScale(), line.y2+rendererModel.arrowHeadWidth / this.rendererModel.getScale()); + int[] c = this.transformPoint(line.x2+aW, line.y2-aW); + int[] d = this.transformPoint(line.x2+aW, line.y2+aW); this.g.drawLine(b[0], b[1], c[0], c[1]); this.g.drawLine(b[0], b[1], d[0], d[1]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |