Bug 12260 fixed: Grid not drawn with log scale and user defined ticks 62/11062/2
Calixte DENIZET [Wed, 27 Mar 2013 15:37:55 +0000 (16:37 +0100)]
Change-Id: I797c502ae46c3b150268e0c5dc3eb511995a2e70

scilab/CHANGES_5.4.X
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/axes/ruler/AxesRulerDrawer.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/axes/ruler/UserDefineGraduation.java

index 7086930..0cc6e13 100644 (file)
@@ -536,6 +536,8 @@ Bug fixes
 
 * Bug #12259 fixed - Wrong translation for "Filled" fixed in SciNotes.
 
+* Bug #12260 fixed - Grid not drawn with log scale and user defined ticks.
+
 * Bug #12270 fixed - When the console lost the focus between SciNotes and the console,
                      the caret could become visible in the console instead SciNotes.
 
index 147277c..32dfd73 100644 (file)
@@ -333,7 +333,12 @@ public class AxesRulerDrawer {
             if (axes.getXAxisGridColor() != -1) {
                 FloatBuffer vertexData;
                 if (axes.getXAxisLogFlag()) {
-                    vertexData = getXGridData(rulerDrawers[0].getSubTicksValue(), rulerDrawers[0].getModel());
+                    List<Double> values = rulerDrawers[0].getSubTicksValue();
+                    if (values == null || values.isEmpty()) {
+                        vertexData = getXGridData(rulerDrawers[0].getTicksValue(), rulerDrawers[0].getModel());
+                    } else {
+                        vertexData = getXGridData(values, rulerDrawers[0].getModel());
+                    }
                 } else {
                     vertexData = getXGridData(rulerDrawers[0].getTicksValue(), rulerDrawers[0].getModel());
                 }
@@ -369,7 +374,12 @@ public class AxesRulerDrawer {
             if (axes.getYAxisGridColor() != -1) {
                 FloatBuffer vertexData;
                 if (axes.getYAxisLogFlag()) {
-                    vertexData = getYGridData(rulerDrawers[1].getSubTicksValue(), rulerDrawers[1].getModel());
+                    List<Double> values = rulerDrawers[1].getSubTicksValue();
+                    if (values == null || values.isEmpty()) {
+                        vertexData = getYGridData(rulerDrawers[1].getTicksValue(), rulerDrawers[1].getModel());
+                    } else {
+                        vertexData = getYGridData(values, rulerDrawers[1].getModel());
+                    }
                 } else {
                     vertexData = getYGridData(rulerDrawers[1].getTicksValue(), rulerDrawers[1].getModel());
                 }
@@ -406,7 +416,12 @@ public class AxesRulerDrawer {
                 if (axes.getZAxisGridColor() != -1 || !axes.getZAxisVisible()) {
                     FloatBuffer vertexData;
                     if (axes.getZAxisLogFlag()) {
-                        vertexData = getZGridData(rulerDrawers[2].getSubTicksValue(), rulerDrawers[2].getModel());
+                        List<Double> values = rulerDrawers[2].getSubTicksValue();
+                        if (values == null || values.isEmpty()) {
+                            vertexData = getZGridData(rulerDrawers[2].getTicksValue(), rulerDrawers[2].getModel());
+                        } else {
+                            vertexData = getZGridData(values, rulerDrawers[2].getModel());
+                        }
                     } else {
                         vertexData = getZGridData(rulerDrawers[2].getTicksValue(), rulerDrawers[2].getModel());
                     }
index d8e9dde..fe313c4 100644 (file)
@@ -118,12 +118,13 @@ class UserDefineGraduation implements Graduations {
                     final double first = ticksValue.get(i);
                     final double second = ticksValue.get(i + 1);
                     final double step = (second - first) / (N + 1);
-                    double v = first + step;
-                    for (int j = 0; j < N; j++) {
+                    double v = first;
+                    for (int j = 0; j <= N; j++) {
                         subValues.add(v);
                         v += step;
                     }
                 }
+                subValues.add(ticksValue.get(ticksValue.size() - 1));
             }
         }