Export: ticks not always correctly exported 43/11143/3
Calixte DENIZET [Thu, 28 Mar 2013 14:19:30 +0000 (15:19 +0100)]
Change-Id: Iea86122875152c1e0a87a9066eb50dc1c5a25260

scilab/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Export.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/axes/ruler/AxesRulerSpriteFactory.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/axes/ruler/UserDefineGraduation.java

index 465907c..863f1dd 100644 (file)
@@ -364,20 +364,22 @@ public class Export {
 
             @Override
             public void updateObject(String id, int property) {
-                needUpdate(id, property);
-                if (property == GraphicObjectProperties.__GO_AXES_SIZE__) {
-                    Integer[] size = getFigure().getAxesSize();
-                    if (size[0] != dims[0] || size[1] != dims[1]) {
-                        Graphics2D newg2d = exporter.getGraphics2D(size[0], size[1], null, params);
-                        params.setParamsOnGraphics(newg2d);
-                        canvas.setGraphics(newg2d, size[0], size[1]);
-                        dims[0] = size[0];
-                        dims[1] = size[1];
-
-                        g2d.dispose();
+                if (needUpdate(id, property)) {
+                    axesDrawer.update(id, property);
+                    if (property == GraphicObjectProperties.__GO_AXES_SIZE__) {
+                        Integer[] size = getFigure().getAxesSize();
+                        if (size[0] != dims[0] || size[1] != dims[1]) {
+                            Graphics2D newg2d = exporter.getGraphics2D(size[0], size[1], null, params);
+                            params.setParamsOnGraphics(newg2d);
+                            canvas.setGraphics(newg2d, size[0], size[1]);
+                            dims[0] = size[0];
+                            dims[1] = size[1];
+
+                            g2d.dispose();
+                        }
+                    } else if (property == GraphicObjectProperties.__GO_ANTIALIASING__) {
+                        canvas.setAntiAliasingLevel(getFigure().getAntialiasing());
                     }
-                } else if (property == GraphicObjectProperties.__GO_ANTIALIASING__) {
-                    canvas.setAntiAliasingLevel(getFigure().getAntialiasing());
                 }
             }
         };
index 4ad1c6d..be8d394 100644 (file)
@@ -128,7 +128,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
 
     private final ContouredObjectDrawer contouredObjectDrawer;
     private final LegendDrawer legendDrawer;
-    private final AxesDrawer axesDrawer;
+    protected final AxesDrawer axesDrawer;
     private final AxisDrawer axisDrawer;
     private final ArrowDrawer arrowDrawer;
     private final FecDrawer fecDrawer;
index 7e4bd13..ad81ef5 100644 (file)
@@ -128,6 +128,7 @@ class AxesRulerSpriteFactory implements RulerSpriteFactory {
     private Texture createScientificStyleSprite(double value, TextureManager textureManager) {
         Integer exponent = (int) Math.floor(Math.log10(value));
         Double mantissa = value / Math.pow(10, exponent);
+        mantissa = Math.round(mantissa * 1e6) * 1e-6;
 
         /**
          * Create mantissa.
index fe313c4..e257fbe 100644 (file)
@@ -107,10 +107,10 @@ class UserDefineGraduation implements Graduations {
     @Override
     public List<Double> getSubGraduations(final int N) {
         if (subValues == null) {
-            if (N == 0) {
+            List<Double> ticksValue = getAllValues();
+            if (N == 0 || ticksValue.size() == 0) {
                 subValues = new LinkedList<Double>();
             } else {
-                List<Double> ticksValue = getAllValues();
                 Collections.sort(ticksValue);
                 subValues = new LinkedList<Double>();