Bug 12963 fixed: drawaxis did not place the axis correctly 80/12880/2
Calixte DENIZET [Thu, 10 Oct 2013 09:40:08 +0000 (11:40 +0200)]
Change-Id: I2caa3d99d6d9998781d34fbcf4b409e3418eeb47

scilab/CHANGES_5.5.X
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/AxisDrawer.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java

index 1ea7dbb..1440c04 100644 (file)
@@ -24,6 +24,8 @@ Scilab Bug Fixes
 
 * Bug #12957 fixed - splitURL and getURL were not declared as new 5.5 functions.
 
+* Bug #12963 fixed - drawaxis did not place the axis correctly.
+
 * Bug #12971 fixed - getURL() downloaded file name was wrong.
 
 * Bug #12978 fixed - exportUI returned an error when input argument was a figure handle.
index b7c5c0c..259233c 100644 (file)
@@ -20,6 +20,7 @@ import org.scilab.forge.scirenderer.ruler.graduations.Graduations;
 import org.scilab.forge.scirenderer.texture.Texture;
 import org.scilab.forge.scirenderer.texture.TextureManager;
 import org.scilab.forge.scirenderer.tranformations.Vector3d;
+import org.scilab.modules.graphic_objects.axes.Axes;
 import org.scilab.modules.graphic_objects.axis.Axis;
 import org.scilab.modules.graphic_objects.textObject.FormattedText;
 import org.scilab.modules.renderer.JoGLView.util.ColorFactory;
@@ -51,7 +52,7 @@ public class AxisDrawer {
         this.drawerVisitor = drawerVisitor;
     }
 
-    public void draw(Axis axis) {
+    public void draw(Axes axes, Axis axis) {
         double min;
         double max;
 
@@ -64,6 +65,7 @@ public class AxisDrawer {
         Double[] yTicksValues;
         double[] xMinAndMax;
         double[] yMinAndMax;
+        double[][] factors = axes.getScaleTranslateFactors();
 
         if (axis.getXTicksCoords().length == 1) {
             xTicksValues = axis.getXTicksCoords();
@@ -83,6 +85,11 @@ public class AxisDrawer {
             rulerModel.setUserGraduation(new AxisGraduation(axis, xTicksValues, xMinAndMax));
         }
 
+        xMinAndMax[0] = xMinAndMax[0] * factors[0][0] + factors[1][0];
+        xMinAndMax[1] = xMinAndMax[1] * factors[0][0] + factors[1][0];
+        yMinAndMax[0] = yMinAndMax[0] * factors[0][1] + factors[1][1];
+        yMinAndMax[1] = yMinAndMax[1] * factors[0][1] + factors[1][1];
+
         // TODO : RulerModel should be an interface.
         rulerModel.setAutoTicks(false);
         rulerModel.setFirstValue(0);
@@ -90,6 +97,7 @@ public class AxisDrawer {
         rulerModel.setLineVisible(axis.getTicksSegment());
         rulerModel.setColor(ColorFactory.createColor(drawerVisitor.getColorMap(), axis.getTicksColor()));
 
+
         rulerModel.setPoints(new Vector3d(xMinAndMax[0], yMinAndMax[0], 0), new Vector3d(xMinAndMax[1], yMinAndMax[1], 0));
         rulerModel.setTicksDirection(computeTicksDirection(axis.getTicksDirectionAsEnum()));
 
index 6c138be..6e30980 100755 (executable)
@@ -353,7 +353,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
     public void visit(Axis axis) {
         if (axis.getVisible()) {
             axesDrawer.enableClipping(currentAxes, axis.getClipProperty());
-            axisDrawer.draw(axis);
+            axisDrawer.draw(currentAxes, axis);
             axesDrawer.disableClipping(axis.getClipProperty());
         }
     }