changeset 21654:a0ebc922fd52

Add "facenormals" and "*normalsmode" to "surface" and "patch" (bug #47791) * graphics.in.h (patch and surface properties): Add properties "facenormals", "facenormalsmode" and "vertexnormalsmode". Deprecate property "normalmode" (use "vertexnormalsmode" instead). * graphics.cc (surface update_normals): Rename to update_vertex_normals. * warning_ids.m: Add description for "Octave:deprecated-function" and "Octave:deprecated-property".
author mmuetzel <markus.muetzel@gmx.de>
date Thu, 28 Apr 2016 13:10:28 +0200
parents 09c086133228
children c32590cd0080
files libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h scripts/miscellaneous/warning_ids.m
diffstat 3 files changed, 71 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Thu Apr 28 16:44:38 2016 -0400
+++ b/libinterp/corefcn/graphics.cc	Thu Apr 28 13:10:28 2016 +0200
@@ -8293,9 +8293,9 @@
 }
 
 void
-surface::properties::update_normals (void)
-{
-  if (normalmode_is ("auto"))
+surface::properties::update_vertex_normals (void)
+{
+  if (vertexnormalsmode_is ("auto"))
     {
       Matrix x = get_xdata ().matrix_value ();
       Matrix y = get_ydata ().matrix_value ();
--- a/libinterp/corefcn/graphics.in.h	Thu Apr 28 16:44:38 2016 -0400
+++ b/libinterp/corefcn/graphics.in.h	Thu Apr 28 13:10:28 2016 +0200
@@ -4856,6 +4856,8 @@
       double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp"))
       color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp"))
       radio_property facelighting , "{none}|flat|gouraud|phong"
+      array_property facenormals m , Matrix ()
+      radio_property facenormalsmode , "{auto}|manual"
       array_property faces u , default_patch_faces ()
       array_property facevertexalphadata , Matrix ()
       array_property facevertexcdata u , Matrix ()
@@ -4868,11 +4870,12 @@
       color_property markeredgecolor , color_property (radio_values ("none|{auto}|flat"), color_values (0, 0, 0))
       color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0))
       double_property markersize , 6
-      radio_property normalmode , "{auto}|manual"
+      radio_property normalmode hsg , "{auto}|manual"
       double_property specularcolorreflectance , 1.0
       double_property specularexponent , 10.0
       double_property specularstrength , 0.9
-      array_property vertexnormals , Matrix ()
+      array_property vertexnormals m , Matrix ()
+      radio_property vertexnormalsmode , "{auto}|manual"
       array_property vertices u , default_patch_vertices ()
       array_property xdata u , default_patch_xdata ()
       array_property ydata u , default_patch_ydata ()
@@ -4905,7 +4908,10 @@
       facevertexcdata.add_constraint (dim_vector (-1, 1));
       facevertexcdata.add_constraint (dim_vector (-1, 3));
       facevertexalphadata.add_constraint (dim_vector (-1, 1));
-      vertexnormals.add_constraint (dim_vector (-1, -1));
+      facenormals.add_constraint (dim_vector (-1, 3));
+      facenormals.add_constraint (dim_vector (0, 0));
+      vertexnormals.add_constraint (dim_vector (-1, 3));
+      vertexnormals.add_constraint (dim_vector (0, 0));
     }
 
   private:
@@ -4913,7 +4919,7 @@
 
     void update_faces (void) { update_data ();}
 
-    void update_vertices (void)  {  update_data ();}
+    void update_vertices (void)  { update_data ();}
 
     void update_facevertexcdata (void) { update_data ();}
 
@@ -4968,8 +4974,23 @@
         clim = cdata.get_limits ();
     }
 
-
     void update_data (void);
+
+    void set_normalmode (const octave_value& val)
+    {
+      warning_with_id ("Octave:deprecated-property",
+        "patch: Property 'normalmode' is deprecated and will be removed "
+        "from a future version of Octave. Use 'vertexnormalsmode' instead.");
+      set_vertexnormalsmode (val);
+    }
+
+    std::string get_normalmode (void) const
+    {
+      warning_with_id ("Octave:deprecated-property",
+        "patch: Property 'normalmode' is deprecated and will be removed "
+        "from a future version of Octave. Use 'vertexnormalsmode' instead.");
+      return vertexnormalsmode.current_value ();
+    }
   };
 
 private:
@@ -5038,6 +5059,8 @@
       double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap"))
       color_property facecolor , color_property (radio_values ("none|{flat}|interp|texturemap"), color_values (0, 0, 0))
       radio_property facelighting , "{none}|flat|gouraud|phong"
+      array_property facenormals m , Matrix ()
+      radio_property facenormalsmode , "{auto}|manual"
       // FIXME: interpreter is not a Matlab surface property
       //        Octave uses this for legend() with the string displayname.
       radio_property interpreter , "{tex}|none|latex"
@@ -5048,11 +5071,12 @@
       color_property markerfacecolor , color_property (radio_values ("{none}|auto|flat"), color_values (0, 0, 0))
       double_property markersize , 6
       radio_property meshstyle , "{both}|row|column"
-      radio_property normalmode u , "{auto}|manual"
+      radio_property normalmode hsg , "{auto}|manual"
       double_property specularcolorreflectance , 1
       double_property specularexponent , 10
       double_property specularstrength , 0.9
-      array_property vertexnormals u , Matrix ()
+      array_property vertexnormals m , Matrix ()
+      radio_property vertexnormalsmode u , "{auto}|manual"
       array_property xdata u , default_surface_xdata ()
       string_property xdatasource , ""
       array_property ydata u , default_surface_ydata ()
@@ -5086,6 +5110,8 @@
       alphadata.add_constraint ("double");
       alphadata.add_constraint ("uint8");
       alphadata.add_constraint (dim_vector (-1, -1));
+      facenormals.add_constraint (dim_vector (-1, -1, 3));
+      facenormals.add_constraint (dim_vector (0, 0));
       vertexnormals.add_constraint (dim_vector (-1, -1, 3));
       vertexnormals.add_constraint (dim_vector (0, 0));
     }
@@ -5109,29 +5135,42 @@
 
     void update_xdata (void)
     {
-      update_normals ();
+      update_vertex_normals ();
       set_xlim (xdata.get_limits ());
     }
 
     void update_ydata (void)
     {
-      update_normals ();
+      update_vertex_normals ();
       set_ylim (ydata.get_limits ());
     }
 
     void update_zdata (void)
     {
-      update_normals ();
+      update_vertex_normals ();
       set_zlim (zdata.get_limits ());
     }
 
-    void update_normals (void);
-
-    void update_normalmode (void)
-    { update_normals (); }
-
-    void update_vertexnormals (void)
-    { set_normalmode ("manual"); }
+    void update_vertex_normals (void);
+
+    void update_vertexnormalsmode (void)
+    { update_vertex_normals (); }
+
+    void set_normalmode (const octave_value& val)
+    {
+      warning_with_id ("Octave:deprecated-property", 
+        "surface: Property 'normalmode' is deprecated and will be removed "
+        "from a future version of Octave. Use 'vertexnormalsmode' instead.");
+      set_vertexnormalsmode (val);
+    }
+
+    std::string get_normalmode (void) const
+    {
+      warning_with_id ("Octave:deprecated-property", 
+        "surface: Property 'normalmode' is deprecated and will be removed "
+        "from a future version of Octave. Use 'vertexnormalsmode' instead.");
+      return vertexnormalsmode.current_value ();
+    }
   };
 
 private:
--- a/scripts/miscellaneous/warning_ids.m	Thu Apr 28 16:44:38 2016 -0400
+++ b/scripts/miscellaneous/warning_ids.m	Thu Apr 28 13:10:28 2016 +0200
@@ -127,12 +127,24 @@
 ## By default, the @code{Octave:built-in-variable-assignment} warning is
 ## enabled.
 ##
+## @item Octave:deprecated-function
+## If the @code{Octave:deprecated-function} warning is enabled, a
+## warning is issued when Octave encounters a function that is obsolete and
+## scheduled for removal from Octave.
+## By default, the @code{Octave:deprecated-function} warning is enabled.
+##
 ## @item Octave:deprecated-keyword
 ## If the @code{Octave:deprecated-keyword} warning is enabled, a
 ## warning is issued when Octave encounters a keyword that is obsolete and
 ## scheduled for removal from Octave.
 ## By default, the @code{Octave:deprecated-keyword} warning is enabled.
 ##
+## @item Octave:deprecated-property
+## If the @code{Octave:deprecated-property} warning is enabled, a
+## warning is issued when Octave encounters a graphics property that
+## is obsolete and scheduled for removal from Octave.
+## By default, the @code{Octave:deprecated-property} warning is enabled.
+##
 ## @item Octave:divide-by-zero
 ## If the @code{Octave:divide-by-zero} warning is enabled, a
 ## warning is issued when Octave encounters a division by zero.