Graphics: fix bugs due to ticks computation made outside EDT 01/10901/3
Calixte DENIZET [Wed, 20 Mar 2013 10:50:48 +0000 (11:50 +0100)]
Change-Id: Ic1986497fbb8d4beaed2d8a9682e91af512b2c3a

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/AxesRulerDrawer.java

index f5ba949..465907c 100644 (file)
@@ -364,6 +364,7 @@ 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]) {
index f8dbdfe..f8e1bdb 100644 (file)
@@ -882,7 +882,7 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
      * @param property the changed property.
      * @return true id the given changed property make the figure out of date.
      */
-    private boolean needUpdate(String id, int property) {
+    protected boolean needUpdate(String id, int property) {
         GraphicObject object = GraphicController.getController().getObjectFromId(id);
         int objectType = (Integer) GraphicController.getController().getProperty(id, GraphicObjectProperties.__GO_TYPE__);
         if ((object != null) && isFigureChild(id)
index 8c12194..0b5653a 100644 (file)
@@ -298,8 +298,9 @@ public class AxesRulerDrawer {
 
         RulerDrawer[] rulerDrawers = rulerDrawerManager.get(axes);
         ElementsBuffer vertexBuffer = drawingTools.getCanvas().getBuffersManager().createElementsBuffer();
+        final boolean is3D = axes.getViewAsEnum() == Camera.ViewType.VIEW_3D && axes.getRotationAngles()[1] != 90.0;
 
-        if (rulerDrawers[0].getModel() == null) {
+        if (rulerDrawers[0].getModel() == null || rulerDrawers[1].getModel() == null || (is3D && rulerDrawers[2].getModel() == null)) {
             computeRulers(axes, axesDrawer, colorMap, drawingTools, drawingTools.getTransformationManager().getModelViewStack().peek(), drawingTools.getTransformationManager().getCanvasProjection());
         }
 
@@ -383,7 +384,7 @@ public class AxesRulerDrawer {
         }
 
         // Draw Z ruler
-        if (axes.getViewAsEnum() == Camera.ViewType.VIEW_3D && axes.getRotationAngles()[1] != 90.0) {
+        if (is3D) {
             if (axes.getZAxisVisible()) {
                 rulerDrawers[2].draw(drawingTools);