Polyline markers with different sizes added. 63/16463/2
Juergen KOCH [Thu, 7 May 2015 12:28:38 +0000 (14:28 +0200)]
Change-Id: I77a4a89b818a0750628a166227593e7266c0cd42

29 files changed:
scilab/modules/graphic_objects/includes/graphicObjectProperties.h
scilab/modules/graphic_objects/src/cpp/NgonPolylineData.cpp
scilab/modules/graphic_objects/src/cpp/getGraphicObjectProperty.cpp
scilab/modules/graphic_objects/src/cpp/setGraphicObjectProperty.cpp
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/graphicObject/GraphicObjectProperties.java
scilab/modules/graphic_objects/src/java/org/scilab/modules/graphic_objects/polyline/Polyline.java
scilab/modules/graphic_objects/src/scripts/propertiesMap.properties
scilab/modules/graphics/help/en_US/2d_plot/scatter.xml
scilab/modules/graphics/help/en_US/2d_plot/scatter3.xml
scilab/modules/graphics/macros/scatter.sci
scilab/modules/graphics/macros/scatter3.sci
scilab/modules/graphics/macros/scatterSetPolyline.sci [moved from scilab/modules/graphics/macros/scatterSetPoyline.sci with 52% similarity]
scilab/modules/graphics/src/c/SetProperty.c
scilab/modules/graphics/src/c/getHandleProperty/get_sizes_property.c
scilab/modules/graphics/src/c/getHandleProperty/set_sizes_property.c
scilab/modules/helptools/images/scatter3_2.png
scilab/modules/helptools/images/scatter3_3.png
scilab/modules/helptools/images/scatter3_4.png
scilab/modules/helptools/images/scatter3_5.png
scilab/modules/helptools/images/scatter3_6.png
scilab/modules/helptools/images/scatter3_8.png
scilab/modules/helptools/images/scatter3_9.png
scilab/modules/helptools/images/scatter_2.png
scilab/modules/helptools/images/scatter_3.png
scilab/modules/helptools/images/scatter_4.png
scilab/modules/helptools/images/scatter_8.png
scilab/modules/helptools/images/scatter_9.png
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/DrawerVisitor.java
scilab/modules/renderer/src/java/org/scilab/modules/renderer/JoGLView/mark/MarkSpriteManager.java

index 5ad07e8..6402ff0 100755 (executable)
 #define __GO_UI_FRAME_BORDER_TYPE__ 392
 #define __GO_UI_SCROLLABLE__ 393
 #define __GO_COLOR_SET__ 394
-#define __GO_SIZE_SET__ 395
-#define __GO_DATA_MODEL_SIZES__ 396
-#define __GO_DATA_MODEL_NUM_SIZES__ 397
+#define __GO_SIZES__ 395
+#define __GO_NUM_SIZES__ 396
 
 #endif /* !__GRAPHIC_OBJECT_PROPERTIES_H__ */
index ee6b495..11e60e1 100644 (file)
@@ -108,9 +108,9 @@ int NgonPolylineData::getPropertyFromName(int propertyName)
             return COLORS;
         case __GO_DATA_MODEL_NUM_COLORS__ :
             return NUM_COLORS;
-        case __GO_DATA_MODEL_SIZES__ :
+        case __GO_SIZES__ :
             return SIZES;
-        case __GO_DATA_MODEL_NUM_SIZES__ :
+        case __GO_NUM_SIZES__ :
             return NUM_SIZES;
         default :
             return NgonGeneralData::getPropertyFromName(propertyName);
index 4927f7f..b762c34 100644 (file)
@@ -89,8 +89,8 @@ void getGraphicObjectProperty(int iUID, int _iName, _ReturnType_ _returnType, vo
         case __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__ :
         case __GO_DATA_MODEL_DISPLAY_FUNCTION__ :
         case __GO_DATA_MODEL_DISPLAY_FUNCTION_SIZE__ :
-        case __GO_DATA_MODEL_SIZES__ :
-        case __GO_DATA_MODEL_NUM_SIZES__ :
+        case __GO_SIZES__ :
+        case __GO_NUM_SIZES__ :
         {
             DataController::getGraphicObjectProperty(iUID, _iName, _pvData);
             break;
index 03a2edc..ea6fdbd 100644 (file)
@@ -106,8 +106,6 @@ BOOL setGraphicObjectPropertyAndWarn(int _iID, int _iName, void const* _pvValue,
         case __GO_DATA_MODEL_MATPLOT_IMAGE_TYPE__ :
         case __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__ :
         case __GO_DATA_MODEL_DISPLAY_FUNCTION__ :
-        case __GO_DATA_MODEL_SIZES__ :
-        case __GO_DATA_MODEL_NUM_SIZES__ :
         {
             BOOL bFalse = FALSE;
             BOOL bTrue = TRUE;
index b916687..3a73277 100755 (executable)
@@ -416,6 +416,7 @@ public class GraphicObjectProperties {
     public static final int __GO_UI_FRAME_BORDER_TYPE__ = 392;
     public static final int __GO_UI_SCROLLABLE__ = 393;
     public static final int __GO_COLOR_SET__ = 394;
-    public static final int __GO_SIZE_SET__ = 395;
+    public static final int __GO_SIZES__ = 395;
+    public static final int __GO_NUM_SIZES__ = 396;
 
 }
index e03242f..07c0c47 100644 (file)
@@ -27,7 +27,8 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_Y_SHIFT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_Z_SHIFT__;
 import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_COLOR_SET__;
-import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_SIZE_SET__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_SIZES__;
+import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProperties.__GO_NUM_SIZES__;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -53,7 +54,7 @@ public class Polyline extends ClippableContouredObject {
     private enum PolylineProperty { CLOSED, ARROWSIZEFACTOR, POLYLINESTYLE,
                                     INTERPCOLORVECTOR, INTERPCOLORVECTORSET, INTERPCOLORMODE,
                                     XSHIFT, YSHIFT, ZSHIFT, BARWIDTH, DATATIPS, DATATIPSCOUNT,
-                                    TIP_DISPLAY_FNC, TIP_MARK, COLORSET, SIZESET
+                                    TIP_DISPLAY_FNC, TIP_MARK, COLORSET, SIZESET, SIZESETCOUNT
                                   };
 
     /** Specifies whether the polyline is closed */
@@ -97,8 +98,8 @@ public class Polyline extends ClippableContouredObject {
     /** has color set */
     private boolean colorSet;
 
-    /** has size set */
-    private boolean sizeSet;
+    /** sizes objects list */
+    private List<Integer> sizes;
 
     /** Constructor */
     public Polyline() {
@@ -117,7 +118,7 @@ public class Polyline extends ClippableContouredObject {
         displayFnc = "";
         tipMark = 11;
         colorSet = false;
-        sizeSet = false;
+        sizes = new ArrayList<Integer>();
     }
 
     @Override
@@ -162,8 +163,10 @@ public class Polyline extends ClippableContouredObject {
                 return PolylineProperty.TIP_MARK;
             case __GO_COLOR_SET__ :
                 return PolylineProperty.COLORSET;
-            case __GO_SIZE_SET__ :
+            case __GO_SIZES__ :
                 return PolylineProperty.SIZESET;
+            case __GO_NUM_SIZES__ :
+                return PolylineProperty.SIZESETCOUNT;
             default :
                 return super.getPropertyFromName(propertyName);
         }
@@ -209,6 +212,8 @@ public class Polyline extends ClippableContouredObject {
                     return getColorSet();
                 case SIZESET:
                     return getSizeSet();
+                case SIZESETCOUNT:
+                    return sizes.size();
             }
         }
         return super.getProperty(property);
@@ -264,7 +269,7 @@ public class Polyline extends ClippableContouredObject {
                         setColorSet((Boolean) value);
                         break;
                     case SIZESET:
-                        setSizeSet((Boolean) value);
+                        setSizeSet((Integer[]) value);
                         break;
                 }
             }
@@ -510,17 +515,25 @@ public class Polyline extends ClippableContouredObject {
     }
 
     /**
-     * @return the sizeSet
+     * @return sizes
      */
-    public Boolean getSizeSet() {
-        return sizeSet;
+    public Integer[] getSizeSet() {
+        return sizes.toArray(new Integer[sizes.size()]);
     }
 
     /**
-     * @param sizeSet the sizeSet to set
+     * @param sizes the sizes to set
      */
-    public UpdateStatus setSizeSet(Boolean colorSet) {
-        this.colorSet = colorSet;
+    private UpdateStatus setSizeSet(List<Integer> sizes) {
+        this.sizes = sizes;
+        return UpdateStatus.Success;
+    }
+
+    /**
+     * @param sizes the sizes to set
+     */
+    public UpdateStatus setSizeSet(Integer[] sizes) {
+        this.sizes = new LinkedList<Integer>(Arrays.asList(sizes));
         return UpdateStatus.Success;
     }
 
index 710be83..86c83ab 100755 (executable)
@@ -445,4 +445,5 @@ __GO_UI_TITLE_SCROLL__
 __GO_UI_FRAME_BORDER_TYPE__
 __GO_UI_SCROLLABLE__
 __GO_COLOR_SET__
-__GO_SIZE_SET__
+__GO_SIZES__
+__GO_NUM_SIZES__
index 93a678e..ba2fb11 100644 (file)
@@ -312,36 +312,39 @@ scatter(x,y)
 x = linspace(0,2,200)
 y = exp(-x).*cos(10*x) + 0.2*rand(1,length(x))
 // specify different sizes
-a = linspace(1,100,length(x))
+s = linspace(1,30,length(x))
 // create 2D scatter plot
-scatter(x,y,a)
+scatter(x,y,s)
  ]]></programlisting>
         <scilab:image>
 x = linspace(0,2,200)
 y = exp(-x).*cos(10*x) + 0.2*rand(1,length(x))
-a = linspace(1,100,length(x))
-scatter(x,y,a)
+s = linspace(1,30,length(x))
+scatter(x,y,s)
         </scilab:image>
         <para>
-           Vary marker color
+           Vary marker size and color
         </para>
         <programlisting role="example"><![CDATA[
 // x and y initialisation
 x = linspace(0,2,200)
 y = exp(-x).*cos(10*x) + 0.2*rand(1,length(x))
+// specify different sizes
+s = linspace(1,30,length(x))
 // set color map
 set(gcf(),"color_map",coolcolormap(64))
 // colors according to x values 
 c = x
 // create 2D scatter plot
-scatter(x,y,[],c)
+scatter(x,y,s,c)
  ]]></programlisting>
         <scilab:image>
 x = linspace(0,2,200)
 y = exp(-x).*cos(10*x) + 0.2*rand(1,length(x))
+s = linspace(1,30,length(x))
 set(gcf(),"color_map",coolcolormap(64))
 c = x
-scatter(x,y,[],c)
+scatter(x,y,s,c)
         </scilab:image>
         <para>
            Fill the markers
@@ -350,19 +353,22 @@ scatter(x,y,[],c)
 // x and y initialisation
 x = linspace(0,2,200)
 y = exp(-x).*cos(10*x) + 0.2*rand(1,length(x))
+// specify different sizes
+s = linspace(1,30,length(x))
 // set color map
 set(gcf(),"color_map",coolcolormap(64))
 // colors according to y values 
 c = y
 // create 2D scatter plot
-scatter(x,y,[],c,"fill")
+scatter(x,y,s,c,"fill")
  ]]></programlisting>
         <scilab:image>
 x = linspace(0,2,200)
 y = exp(-x).*cos(10*x) + 0.2*rand(1,length(x))
+s = linspace(1,30,length(x))
 set(gcf(),"color_map",coolcolormap(64))
 c = y
-scatter(x,y,[],c,"fill")
+scatter(x,y,s,c,"fill")
         </scilab:image>
         <para>
             Specify marker symbol
@@ -429,13 +435,13 @@ t = linspace(0,1,200)
 x = t.*cos(10*%pi*t)
 y = t.*sin(10*%pi*t)
 // create 2D scatter plot
-s = scatter(x,y)
+scatter(x,y)
  ]]></programlisting>
         <scilab:image>
-t = linspace(0,1,200)
-x = t.*cos(10*%pi*t)
-y = t.*sin(10*%pi*t)
-s = scatter(x,y)
+t = linspace(0,25,200)
+x = t.*cos(t)
+y = t.*sin(t)
+scatter(x,y,t)
         </scilab:image>
         <programlisting role="example"><![CDATA[
 // get current entity
@@ -445,18 +451,18 @@ pl = ce.children
 // modify ployline 
 pl.thickness = 0.5
 pl.mark_foreground = addcolor(name2rgb("darkblue")/255)
-pl.mark_background = addcolor([0 0.4 0.4])
+pl.mark_background = addcolor(name2rgb("darkcyan")/255)
  ]]></programlisting>
         <scilab:image>
-t = linspace(0,1,200)
-x = t.*cos(10*%pi*t)
-y = t.*sin(10*%pi*t)
-s = scatter(x,y)
+t = linspace(0,25,200)
+x = t.*cos(t)
+y = t.*sin(t)
+scatter(x,y,t)
 ce = gce()
 pl = ce.children
 pl.thickness = 0.5
 pl.mark_foreground = addcolor(name2rgb("darkblue")/255)
-pl.mark_background = addcolor([0 0.4 0.4])
+pl.mark_background = addcolor(name2rgb("darkcyan")/255)
         </scilab:image>
     </refsection>
     <refsection role="see also">
index 5e8a6cf..e46b2fc 100644 (file)
@@ -331,7 +331,7 @@ x = t.*cos(t).*sin(t)
 y = t.*sin(t).*sin(t)
 z = t.*cos(t)
 // size according to radius
-s = t
+s = linspace(50,1,length(t))
 // create 3D scatter plot
 scatter3(x,y,z,s)
 // modify rotation angles
@@ -342,12 +342,12 @@ t = 1:200
 x = t.*cos(t).*sin(t)
 y = t.*sin(t).*sin(t)
 z = t.*cos(t)
-s = t
+s = linspace(50,1,length(t))
 scatter3(x,y,z,s)
 set(gca(),"rotation_angles",[60,45])
         </scilab:image>
         <para>
-           Vary marker color
+           Vary marker sie and color
         </para>
         <programlisting role="example"><![CDATA[
 // x, y and z initialisation
@@ -355,12 +355,14 @@ t = 1:200
 x = t.*cos(t).*sin(t)
 y = t.*sin(t).*sin(t)
 z = t.*cos(t)
+// size according to radius
+s = linspace(50,1,length(t))
 // set color map
 set(gcf(),"color_map",coolcolormap(64))
 // color according to radius
 c = t
 // create 3D scatter plot
-scatter3(x,y,z,[],c)
+scatter3(x,y,z,s,c)
 // modify rotation angles
 set(gca(),"rotation_angles",[60,45])
  ]]></programlisting>
@@ -369,9 +371,10 @@ t = 1:200
 x = t.*cos(t).*sin(t)
 y = t.*sin(t).*sin(t)
 z = t.*cos(t)
+s = linspace(50,1,length(t))
 set(gcf(),"color_map",coolcolormap(64))
 c = t
-scatter3(x,y,z,[],c)
+scatter3(x,y,z,s,c)
 set(gca(),"rotation_angles",[60,45])
         </scilab:image>
         <para>
@@ -379,18 +382,18 @@ set(gca(),"rotation_angles",[60,45])
         </para>
         <programlisting role="example"><![CDATA[
 // x, y and z initialisation
-z = linspace(0,6*%pi,200)
-x = cos(z)
-y = sin(z)
+z = linspace(0,25,200)
+x = z.*cos(z)
+y = z.*sin(z)
 // create 3D scatter plot
 scatter3(x,y,z,"fill")
 // modify rotation angles
 set(gca(),"rotation_angles",[60,45])
  ]]></programlisting>
         <scilab:image>
-z = linspace(0,6*%pi,200)
-x = cos(z)
-y = sin(z)
+z = linspace(0,25,200)
+x = z.*cos(z)
+y = z.*sin(z)
 scatter3(x,y,z,"fill")
 set(gca(),"rotation_angles",[60,45])
         </scilab:image>
@@ -399,18 +402,18 @@ set(gca(),"rotation_angles",[60,45])
         </para>
         <programlisting role="example"><![CDATA[
 // x, y and z initialisation
-z = linspace(0,6*%pi,200)
-x = cos(z)
-y = sin(z)
+z = linspace(0,25,200)
+x = z.*cos(z)
+y = z.*sin(z)
 // create 3D scatter plot
 scatter3(x,y,z,"*")
 // modify rotation angles
 set(gca(),"rotation_angles",[60,45])
  ]]></programlisting>
         <scilab:image>
-z = linspace(0,6*%pi,200)
-x = cos(z)
-y = sin(z)
+z = linspace(0,25,200)
+x = z.*cos(z)
+y = z.*sin(z)
 scatter3(x,y,z,"*")
 set(gca(),"rotation_angles",[60,45])
         </scilab:image>
@@ -419,9 +422,9 @@ set(gca(),"rotation_angles",[60,45])
         </para>
         <programlisting role="example"><![CDATA[
 // x, y and z initialisation
-z = linspace(0,6*%pi,200)
-x = cos(z)
-y = sin(z)
+z = linspace(0,25,200)
+x = z.*cos(z)
+y = z.*sin(z)
 // create 3D scatter plot
 scatter3(x,y,z,...
         "markerEdgeColor","black",...
@@ -430,9 +433,9 @@ scatter3(x,y,z,...
 set(gca(),"rotation_angles",[60,45])
  ]]></programlisting>
         <scilab:image>
-z = linspace(0,6*%pi,200)
-x = cos(z)
-y = sin(z)
+z = linspace(0,25,200)
+x = z.*cos(z)
+y = z.*sin(z)
 scatter3(x,y,z,...
         "markerEdgeColor","black",...
         "markerFaceColor",[0 .8 .8])
@@ -477,7 +480,7 @@ x = t.*cos(t).*sin(t)
 y = t.*sin(t).*sin(t)
 z = t.*cos(t)
 // size according to radius
-s = t
+s = linspace(50,1,length(t))
 // create 3D scatter plot
 scatter3(x,y,z,s)
 // modify rotation angles
@@ -488,7 +491,7 @@ t = 1:200
 x = t.*cos(t).*sin(t)
 y = t.*sin(t).*sin(t)
 z = t.*cos(t)
-s = t
+s = linspace(50,1,length(t))
 scatter3(x,y,z,s)
 set(gca(),"rotation_angles",[60,45])
         </scilab:image>
@@ -504,7 +507,7 @@ t = 1:200
 x = t.*cos(t).*sin(t)
 y = t.*sin(t).*sin(t)
 z = t.*cos(t)
-s = t
+s = linspace(50,1,length(t))
 scatter3(x,y,z,s)
 set(gca(),"rotation_angles",[60,45])
 polyLine = gce()
index 7db2fb3..8c0551b 100644 (file)
@@ -12,9 +12,12 @@ function scatter(varargin)
     [lhs,rhs] = argn(0);
 
     if ~rhs
-        //
-        // add example ???
-        //
+        clf;
+        t = linspace(0,25,200);
+        x = t.*cos(t);
+        y = t.*sin(t);
+        scatter(x,y,t,t,"fill","markerEdgeColor","darkblue")
+        return;
     end
 
    //detect and set the current axes now:
@@ -78,7 +81,7 @@ function scatter(varargin)
         return;
     end
 
-    scatterSetPoyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill);
+    scatterSetPolyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill);
     
     drawnow();
 
index aacc511..0ee1633 100644 (file)
@@ -12,9 +12,13 @@ function scatter3(varargin)
     [lhs,rhs] = argn(0);
 
     if ~rhs
-        //
-        // add example ???
-        //
+        clf;
+        z = linspace(0,25,200);
+        x = z.*cos(z);
+        y = z.*sin(z);
+        scatter3(x,y,z,z,z,"fill","markerEdgeColor","darkblue");
+        set(gca(),"rotation_angles",[60,45])
+        return;
     end
 
    //detect and set the current axes now:
@@ -80,7 +84,7 @@ function scatter3(varargin)
         return;
     end
 
-    scatterSetPoyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill);
+    scatterSetPolyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill);
     
     set(gca(),"cube_scaling","on");
     set(gca(),"grid",[1 1 1]);
@@ -7,17 +7,8 @@
 // are also available at    
 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 
-function scatterSetPoyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill)
+function scatterSetPolyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill)
 
-    // disp(strcat(["S = " string(S)]));
-    // disp(strcat(["C = " string(C)]));
-    // disp(strcat(["thickness = " string(thickness)]));
-    // disp(strcat(["markStyle = " string(markStyle)]));
-    // disp(strcat(["markFg = " string(markFg)]));
-    // disp(strcat(["markBg = " string(markBg)]));
-    // disp(strcat(["fill = " string(fill)]));
-
-    
     // set mark mode
     polyLine.line_mode = "off";
     polyLine.mark_mode = "on";
@@ -26,7 +17,6 @@ function scatterSetPoyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill)
     polyLine.thickness = thickness;
 
     // set mark style
-    // disp(markStyle);
     polyLine.mark_style = markStyle;
 
     // set mark size
@@ -35,29 +25,35 @@ function scatterSetPoyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill)
         polyLine.mark_size = 7;
     else
         if size(S) == [1 1] then
-            polyLine.mark_size = ceil(sqrt(4*S/%pi))
+            polyLine.mark_size = ceil(sqrt(4*S/%pi));
+        elseif size(S) == [1 n]
+            polyLine.mark_size = -3;
+            polyLine.sizes = ceil(sqrt(4*S/%pi));
         else
-            polyLine.mark_size = 7;
-            disp("handle of different sizes not yet implemented!");
-            //
-            // ToDo: handle different sizes
-            //
+            warning("S must be a scalar or a vector of the same length as X.");
+            return;
         end
     end
 
    // set mark foreground and background color
     if isempty(C) then
         if markFg == -1 then
-            markFg = addcolor(name2rgb("blue")/255); // default
+            polyLine.mark_foreground = addcolor(name2rgb("blue")/255); // default
+        else
+            polyLine.mark_foreground = markFg;
         end
         if markBg == -1 then
-            markBg = markFg;
-        end
-        polyLine.mark_foreground = markFg;
-        if fill == %T then
-            polyLine.mark_background = markBg;
+            if fill == %T then
+                polyLine.mark_background = polyLine.mark_foreground;
+            else
+                polyLine.mark_background = 0; // transparent
+            end
         else
-            polyLine.mark_background = 0; // transparent
+            if fill == %T then
+                polyLine.mark_background = markBg;
+            else
+                polyLine.mark_background = 0; // transparent
+            end
         end
     else
         if size(C) == [1 1] then
@@ -65,20 +61,31 @@ function scatterSetPoyline(polyLine,S,C,thickness,markStyle,markFg,markBg,fill)
             if fill == %T then
                 polyLine.mark_background = C;
             else
-                polyLine.mark_background = 0; // transparent
+                if markBg == -1 then
+                    polyLine.mark_background = 0; // transparent
+                else
+                    polyLine.mark_background = markBg;
+                end
             end
         else
             polyLine.colors = C;
-            polyLine.mark_foreground = -3;
             if fill == %T then
+                if markFg == -1 then
+                    polyLine.mark_foreground = -3;
+                else
+                    polyLine.mark_foreground = markFg;
+                end
                 polyLine.mark_background = -3;
             else
-                polyLine.mark_background = 0; // transparent
+                polyLine.mark_foreground = -3;
+                if markBg == -1 then
+                    polyLine.mark_background = 0; // transparent
+                else
+                    polyLine.mark_background = markBg;
+                end
             end
         end
     end
 
-    // disp(polyLine);
-
 endfunction
 
index 8ad629b..c890cf3 100644 (file)
@@ -116,7 +116,7 @@ int sciSetLineStyle(int iObjUID, int linestyle)
 
 int sciSetMarkSize(int iObjUID, int marksize)
 {
-    if (marksize < 0)
+    if (marksize < 0 && marksize != -3)
     {
         Scierror(999, _("Wrong value for '%s' property: Must be greater or equal to %d.\n"), "mark_size", 0);
         return -1;
index 3ec70fa..723f93f 100644 (file)
 /* desc : function to get in Scilab the polyline sizes                    */
 /*------------------------------------------------------------------------*/
 
+#include "MALLOC.h"
 #include "SetPropertyStatus.h"
 #include "getHandleProperty.h"
 #include "GetProperty.h"
 #include "returnProperty.h"
+#include "HandleManagement.h"
 #include "Scierror.h"
 #include "localization.h"
 
 #include "graphicObjectProperties.h"
 
 /*------------------------------------------------------------------------*/
-int get_sizes_property(void* _pvCtx, char* pobjUID)
+int get_sizes_property(void* _pvCtx, int iObjUID)
 {
-    int * sizes = NULL;
-    int numSizes = 0;
-    int * piNumSizes = &numSizes;
-    int sizeSet = 0;
-    int *piSizeSet = &sizeSet;
-
-    getGraphicObjectProperty(pobjUID, __GO_SIZE_SET__, jni_bool, (void **)&piSizeSet);
-    if (piSizeSet == NULL)
+       int i = 0;
+    int status = 0;
+    int iSizesCount = 0;
+    int* piSizesCount = &iSizesCount;
+    int* piSizes = NULL;
+    long* plSizes = NULL;
+
+    getGraphicObjectProperty(iObjUID, __GO_NUM_SIZES__, jni_int, (void **)&piSizesCount);
+    if (piSizesCount == NULL || iSizesCount == 0)
     {
-        Scierror(999, _("'%s' property does not exist for this handle.\n"), "sizes");
-        return -1;
+        return sciReturnEmptyMatrix(_pvCtx);
     }
 
-    getGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_SIZES__, jni_int_vector, (void **)&sizes);
-    getGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_NUM_SIZES__, jni_int, &piNumSizes);
+    getGraphicObjectProperty(iObjUID, __GO_SIZES__, jni_int_vector, (void **)&piSizes);
+    plSizes = (long*)MALLOC(iSizesCount * sizeof(long));
 
-    if (sizes == NULL || numSizes == 0)
+    for (i = 0; i < iSizesCount; ++i)
     {
-        sciReturnEmptyMatrix(_pvCtx);
-        return SET_PROPERTY_SUCCEED;
+        plSizes[i] = getHandle(piSizes[i]);
     }
 
-    return sciReturnRowVectorFromInt(_pvCtx, sizes, numSizes);
+       status = sciReturnRowHandleVector(_pvCtx, plSizes, iSizesCount);
+    FREE(plSizes);
+
+    return status;
 }
 /*------------------------------------------------------------------------*/
index 7d069c0..eb94a49 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET
+ * Copyright (C) 2015 - Scilab Enterprises - Juergen KOCH
  *
  * This file must be used under the terms of the CeCILL.
  * This source file is licensed as described in the file COPYING, which
@@ -12,7 +12,7 @@
 
 /*------------------------------------------------------------------------*/
 /* file: set_sizes_property.c                                             */
-/* desc : function to modify in Scilab he polylines sizes                 */
+/* desc : function to modify in Scilab the polylines sizes                 */
 /*------------------------------------------------------------------------*/
 
 #include "MALLOC.h"
@@ -42,11 +42,6 @@ int set_sizes_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int val
     }
 
     getGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_NUM_ELEMENTS__, jni_int, (void **) &piNumElements);
-
-    /*
-     * A way to display a more explicit message would be to first get the
-     * interpolation vector set flag and test it for NULL.
-     */
     if (piNumElements == NULL)
     {
         Scierror(999, _("'%s' property does not exist for this handle.\n"), "sizes");
@@ -55,14 +50,14 @@ int set_sizes_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int val
 
     if (nbCol == 0)
     {
-        int sizeSet = 0;
-        status = setGraphicObjectProperty(pobjUID, __GO_SIZE_SET__, &sizeSet, jni_bool, 1);
+        int numSizes = 0;
+        status = setGraphicObjectProperty(pobjUID, __GO_NUM_SIZES__, &numSizes, jni_int, 1);
         if (status == FALSE)
         {
             Scierror(999, _("'%s' property does not exist for this handle.\n"), "sizes");
             return SET_PROPERTY_ERROR;
         }
-        setGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_SIZES__, NULL, jni_int_vector, 0);
+        setGraphicObjectProperty(pobjUID, __GO_SIZES__, NULL, jni_int_vector, 0);
 
         return SET_PROPERTY_SUCCEED;
     }
@@ -74,11 +69,11 @@ int set_sizes_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int val
 
         copyDoubleVectorToIntFromStack(stackPointer, tmp, nbCol);
 
-        status = setGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_SIZES__, tmp, jni_int_vector, nbCol);
+        status = setGraphicObjectProperty(pobjUID, __GO_SIZES__, tmp, jni_int_vector, nbCol);
         if (status == TRUE)
         {
-            int sizeSet = 1;
-            setGraphicObjectProperty(pobjUID, __GO_SIZE_SET__, &sizeSet, jni_bool, 1);
+            int numSizes = nbCol;
+            setGraphicObjectProperty(pobjUID, __GO_NUM_SIZES__, &numSizes, jni_int, 1);
             FREE(tmp);
             return SET_PROPERTY_SUCCEED;
         }
index bd0f5d5..dbdec31 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter3_2.png and b/scilab/modules/helptools/images/scatter3_2.png differ
index 646da6d..874b4ef 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter3_3.png and b/scilab/modules/helptools/images/scatter3_3.png differ
index 20cc9c7..2c0646a 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter3_4.png and b/scilab/modules/helptools/images/scatter3_4.png differ
index 11f3879..7b58f52 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter3_5.png and b/scilab/modules/helptools/images/scatter3_5.png differ
index 421e74f..3d514b2 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter3_6.png and b/scilab/modules/helptools/images/scatter3_6.png differ
index bd0f5d5..dbdec31 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter3_8.png and b/scilab/modules/helptools/images/scatter3_8.png differ
index 1207d89..aec5151 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter3_9.png and b/scilab/modules/helptools/images/scatter3_9.png differ
index 2aa6f9d..69d05c2 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter_2.png and b/scilab/modules/helptools/images/scatter_2.png differ
index 1438915..b2ffaf8 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter_3.png and b/scilab/modules/helptools/images/scatter_3.png differ
index aeb6ea7..98750ea 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter_4.png and b/scilab/modules/helptools/images/scatter_4.png differ
index ccea11a..04d7014 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter_8.png and b/scilab/modules/helptools/images/scatter_8.png differ
index a2f0f5c..45e0369 100644 (file)
Binary files a/scilab/modules/helptools/images/scatter_9.png and b/scilab/modules/helptools/images/scatter_9.png differ
index 7f68b53..cf75812 100755 (executable)
@@ -14,6 +14,7 @@ package org.scilab.modules.renderer.JoGLView;
 import java.awt.Component;
 import java.awt.Dimension;
 import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -30,6 +31,7 @@ import org.scilab.forge.scirenderer.Drawer;
 import org.scilab.forge.scirenderer.DrawingTools;
 import org.scilab.forge.scirenderer.SciRendererException;
 import org.scilab.forge.scirenderer.buffers.ElementsBuffer;
+import org.scilab.forge.scirenderer.buffers.BuffersManager;
 import org.scilab.forge.scirenderer.shapes.appearance.Appearance;
 import org.scilab.forge.scirenderer.shapes.appearance.Color;
 import org.scilab.forge.scirenderer.shapes.geometry.DefaultGeometry;
@@ -601,7 +603,6 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
                         int offset = polyline.getMarkOffset();
                         int stride = polyline.getMarkStride();
                         if (polyline.getColorSet() && (polyline.getMark().getBackground() == -3 || polyline.getMark().getForeground() == -3)) {
-                            Texture sprite = markManager.getMarkSprite(polyline, null, appearance);
                             ElementsBuffer colors = dataManager.getColorBuffer(polyline.getIdentifier());
                             Color auxColor;
                             if (polyline.getMark().getBackground() == -3) {
@@ -609,10 +610,93 @@ public class DrawerVisitor implements Visitor, Drawer, GraphicView {
                             } else {
                                 auxColor = ColorFactory.createColor(colorMap, polyline.getMark().getBackground());
                             }
-                            drawingTools.draw(sprite, AnchorPosition.CENTER, positions, offset, stride, 0, auxColor, colors);
+                                       FloatBuffer data = positions.getData();
+                                       FloatBuffer colorData = colors.getData();
+                               Integer[] sizes = polyline.getSizeSet();
+                               if ( (sizes != null) && (data != null) && (colorData != null) && (polyline.getMark().getSize() == -3) && (positions.getSize() == sizes.length) && (colors.getSize() == sizes.length) ) {
+                                       // markers with different sizes
+                                                       data.rewind();
+                                                       colorData.rewind();
+                                                       
+                                    stride = stride < 1 ? 1 : stride;
+                                    offset = offset < 0 ? 0 : offset;
+
+                                    int elementSize = positions.getElementsSize();
+                                               int mark = offset * elementSize;
+                                                       int k = 0;
+                                                       
+                                    while (data.remaining() >= stride * elementSize) {
+                                                       
+                                                       polyline.setMarkSize(sizes[k++]);
+
+                                                       BuffersManager bufferManager = drawingTools.getCanvas().getBuffersManager();
+                                                       ElementsBuffer singlePosition = bufferManager.createElementsBuffer();
+                                                       ElementsBuffer singleColor = bufferManager.createElementsBuffer();
+
+                                                       float[] position = {0, 0, 0, 1};
+                                        data.position(mark);
+                                                       data.get(position);
+                                                       
+                                        float[] color = {0, 0, 0, 0};
+                                        colorData.position(mark);
+                                        colorData.get(color);
+
+                                                       mark += stride * elementSize;
+                                                       
+                                                       singlePosition.setData(position, elementSize);
+                                                       singleColor.setData(color, elementSize);
+
+                                                       Texture sprite = markManager.getMarkSprite(polyline, null, appearance);
+                                                       drawingTools.draw(sprite, AnchorPosition.CENTER, singlePosition, 0, 0, 0, auxColor, singleColor);
+                                               
+                                                       bufferManager.dispose(singleColor);
+                                                       bufferManager.dispose(singlePosition);
+                                               }
+                                               // restore the size of the mark
+                                               polyline.setMarkSize(-3);
+                               } else {
+                                Texture sprite = markManager.getMarkSprite(polyline, null, appearance);
+                                       drawingTools.draw(sprite, AnchorPosition.CENTER, positions, offset, stride, 0, auxColor, colors);
+                               }
                         } else {
-                            Texture sprite = markManager.getMarkSprite(polyline, colorMap, appearance);
-                            drawingTools.draw(sprite, AnchorPosition.CENTER, positions, offset, stride, 0, null, null);
+                               FloatBuffer data = positions.getData();
+                               Integer[] sizes = polyline.getSizeSet();
+                               if ( (sizes != null) && (data != null) && (polyline.getMark().getSize() == -3) && (positions.getSize() == sizes.length) ) {
+                                       // markers with different sizes
+                                               data.rewind();
+                                               
+                                stride = stride < 1 ? 1 : stride;
+                                offset = offset < 0 ? 0 : offset;
+
+                                int elementSize = positions.getElementsSize();
+                                               int mark = offset * elementSize;
+                                               int k = 0;
+                                               
+                                while (data.remaining() >= stride * elementSize) {
+                                               
+                                                       polyline.setMarkSize(sizes[k++]);
+
+                                                       BuffersManager bufferManager = drawingTools.getCanvas().getBuffersManager();
+                                               ElementsBuffer singlePosition = bufferManager.createElementsBuffer();
+
+                                               float[] position = {0, 0, 0, 1};
+                                    data.position(mark);
+                                               data.get(position);
+                                               mark += stride * elementSize;
+                                               singlePosition.setData(position, elementSize);
+
+                                               Texture sprite = markManager.getMarkSprite(polyline, colorMap, appearance);
+                                               drawingTools.draw(sprite, AnchorPosition.CENTER, singlePosition, 0, 0, 0, null, null);
+                                               
+                                               bufferManager.dispose(singlePosition);
+                                       }
+                                       // restore the size of the mark
+                                       polyline.setMarkSize(-3);
+                               }
+                               else {
+                                       Texture sprite = markManager.getMarkSprite(polyline, colorMap, appearance);
+                                       drawingTools.draw(sprite, AnchorPosition.CENTER, positions, offset, stride, 0, null, null);
+                               }
                         }
                     }
                 } catch (ObjectRemovedException e) {
index fc57036..8213918 100644 (file)
@@ -37,8 +37,7 @@ public class MarkSpriteManager {
     /**
      * The sprite map.
      */
-    private final Map<Integer, Texture> spriteMap = new ConcurrentHashMap<Integer, Texture>();
-
+    private final Map<Integer, Map<Integer, Texture>> spriteMap = new ConcurrentHashMap<Integer, Map<Integer, Texture>>();
 
     /**
      * Default constructor.
@@ -57,11 +56,20 @@ public class MarkSpriteManager {
      */
     public Texture getMarkSprite(ContouredObject contouredObject, ColorMap colorMap, Appearance appearance) {
         Integer id = contouredObject.getIdentifier();
-        Texture sprite = spriteMap.get(id);
+        Map<Integer, Texture> sizeMap = spriteMap.get(id);
+        Texture sprite = null;
+        int MarkSize = contouredObject.getMark().getSize();
+        if (sizeMap == null) {
+            sizeMap = new  ConcurrentHashMap<Integer, Texture>();
+            spriteMap.put(id, sizeMap);
+        }
+        else {
+            sprite = sizeMap.get(MarkSize);
+        }
         if (sprite == null) {
             Integer selectedColor = contouredObject.getSelected() ? contouredObject.getSelectedColor() : null;
             sprite = MarkSpriteFactory.getMarkSprite(textureManager, contouredObject.getMark(), selectedColor, colorMap, appearance);
-            spriteMap.put(id, sprite);
+            sizeMap.put(MarkSize,sprite);
         }
         return sprite;
     }
@@ -74,10 +82,19 @@ public class MarkSpriteManager {
      * @return the mark sprite for the given contoured object.
      */
     public Texture getMarkSprite(Integer id, Mark mark, ColorMap colorMap, Appearance appearance) {
-        Texture sprite = spriteMap.get(id);
+        Map<Integer, Texture> sizeMap = spriteMap.get(id);
+        Texture sprite = null;
+        int markSize = mark.getSize();
+        if (sizeMap == null) {
+            sizeMap = new  ConcurrentHashMap<Integer, Texture>();
+            spriteMap.put(id, sizeMap);
+        }
+        else {
+            sprite = sizeMap.get(markSize);
+        }
         if (sprite == null) {
             sprite = MarkSpriteFactory.getMarkSprite(textureManager, mark, null, colorMap, appearance);
-            spriteMap.put(id, sprite);
+            sizeMap.put(markSize,sprite);
         }
         return sprite;
     }
@@ -101,7 +118,9 @@ public class MarkSpriteManager {
                 || property == GraphicObjectProperties.__GO_MARK_BACKGROUND__
                 || property == GraphicObjectProperties.__GO_LINE_THICKNESS__
                 || property == GraphicObjectProperties.__GO_SELECTED__
-                || property == GraphicObjectProperties.__GO_COLOR_SET__) {
+                || property == GraphicObjectProperties.__GO_COLOR_SET__
+                || property == GraphicObjectProperties.__GO_SIZES__
+                       || property == GraphicObjectProperties.__GO_NUM_SIZES__) {
             dispose(id);
         }
     }
@@ -111,8 +130,11 @@ public class MarkSpriteManager {
      * @param id the given id.
      */
     public void dispose(Integer id) {
-        Texture sprite = spriteMap.get(id);
-        textureManager.dispose(sprite);
+        Map<Integer,Texture> sizeMap = spriteMap.get(id);
+        if (sizeMap != null) {
+               textureManager.dispose(sizeMap.values());
+               sizeMap.clear();
+        }
         spriteMap.remove(id);
     }
 
@@ -120,7 +142,10 @@ public class MarkSpriteManager {
      * Dispose all the mark sprite.
      */
     public void disposeAll() {
-        textureManager.dispose(spriteMap.values());
+       for (Map<Integer,Texture> sizeMap: spriteMap.values()) {
+               textureManager.dispose(sizeMap.values());
+               sizeMap.clear();
+       }
         spriteMap.clear();
     }
 }