* Bug #15111 fixed: Summation block symbol displayed minus sign instead of plus sign. 06/19706/1
Clément DAVID [Mon, 29 Jan 2018 17:09:28 +0000 (18:09 +0100)]
Change-Id: Ib95b8c14dc2754afdd36a719ce9123f50752700f

scilab/CHANGES.md
scilab/modules/xcos/src/java/org/scilab/modules/xcos/block/custom/SumPortLabeler.java

index 08d5f85..2ed849b 100644 (file)
@@ -461,6 +461,7 @@ Known issues
 * [#15089](http://bugzilla.scilab.org/show_bug.cgi?id=15089): The `getcolor` GUI cleared and used the current figure.
 * [#15106](http://bugzilla.scilab.org/show_bug.cgi?id=15106): Operation without operand crashed Scilab.
 * [#15107](http://bugzilla.scilab.org/show_bug.cgi?id=15107): Scilab failed to build with ocaml 4.04.0.
+* [#15111](http://bugzilla.scilab.org/show_bug.cgi?id=15111): Summation block symbol displayed minus sign instead of plus sign.
 * [#15117](http://bugzilla.scilab.org/show_bug.cgi?id=15117): Imbricated calls to `optim` / `leastsq` / `lsqrsolve` / `fsolve` either crashed or returned errors.
 * [#15119](http://bugzilla.scilab.org/show_bug.cgi?id=15119): Inequality comparisons between complex-encoded real numbers failed.
 * [#15121](http://bugzilla.scilab.org/show_bug.cgi?id=15121): `getOptionals` fails to recognize some options.
index 845feac..b337eb1 100644 (file)
@@ -27,6 +27,7 @@ import org.scilab.modules.xcos.JavaController;
 import org.scilab.modules.xcos.Kind;
 import org.scilab.modules.xcos.ObjectProperties;
 import org.scilab.modules.xcos.VectorOfDouble;
+import org.scilab.modules.xcos.VectorOfInt;
 
 /**
  * Change the port label on rpar change.
@@ -77,25 +78,48 @@ public class SumPortLabeler {
          * Set the ports labels
          */
         JavaController controller = new JavaController();
-        VectorOfDouble rpar = new VectorOfDouble();
-        controller.getObjectProperty(source.getUID(), Kind.BLOCK, ObjectProperties.RPAR, rpar);
-
-        for (int i = 0; i < ports.size(); i++) {
-            final double gain;
+        String[] simulationFunction = {""};
+        controller.getObjectProperty(source.getUID(), Kind.BLOCK, ObjectProperties.SIM_FUNCTION_NAME, simulationFunction);
+        if ("sum".equals(simulationFunction[0])) { // BIGSOM_f case
+            VectorOfDouble rpar = new VectorOfDouble();
+            controller.getObjectProperty(source.getUID(), Kind.BLOCK, ObjectProperties.RPAR, rpar);
+
+            for (int i = 0; i < ports.size(); i++) {
+                final double gain;
+
+                if (i < rpar.size()) {
+                    gain = rpar.get(i);
+                } else {
+                    gain = 1;
+                }
 
-            if (i < rpar.size()) {
-                gain = rpar.get(i);
-            } else {
-                gain = 1;
+                ports.get(i).setValue(getLabel(gain));
             }
+        } else { // SUMMATION case
+            VectorOfInt ipar = new VectorOfInt();
+            controller.getObjectProperty(source.getUID(), Kind.BLOCK, ObjectProperties.IPAR, ipar);
+
+            for (int i = 0; i < ports.size(); i++) {
+                final double gain;
+
+                if (i < ipar.size()) {
+                    gain = ipar.get(i);
+                } else {
+                    gain = 1;
+                }
 
-            ports.get(i).setValue(getLabel(gain));
+                ports.get(i).setValue(getLabel(gain));
+            }
         }
 
+
+
         /**
          * Check if all the values are equal to the default one.
          */
         if (!hasDefaultValue(ports)) {
+
+
             return;
         }