[goffice] Save axis Id for all axes, not only X and Y. [#680739]
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Save axis Id for all axes, not only X and Y. [#680739]
- Date: Sun, 29 Jul 2012 11:52:34 +0000 (UTC)
commit c551321a30fe9696e00e2fcf1b62eaf051b65a44
Author: Jean Brefort <jean brefort normalesup org>
Date: Sun Jul 29 13:52:20 2012 +0200
Save axis Id for all axes, not only X and Y. [#680739]
ChangeLog | 8 +++
NEWS | 1 +
goffice/graph/gog-plot.c | 78 ++++++++++++++++++++++++++++++++
plugins/plot_surface/gog-xyz-surface.c | 16 ++++++-
4 files changed, 102 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index dc8ef60..22a1810 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-07-29 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/graph/gog-plot.c (gog_plot_set_property),
+ (gog_plot_get_property), (gog_plot_class_init): save axis Id for all axes,
+ not only X and Y. [#680739]
+ * plugins/plot_surface/gog-xyz-surface.c
+ (gog_xyz_surface_plot_build_matrix): avoid leaks and invalid properties.
+
2012-07-26 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-axis.c (gog_axis_map_get_real_extents),
diff --git a/NEWS b/NEWS
index 6c3300e..38b3079 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Jean:
* Fix contour plot cardinality when axis bounds can't be retrieved. [680512]
* Allow axis choice for pseudo-3d plots. [see #680636]
* Allow filling to axis limits. [#680513]
+ * Save axis Id for all axes, not only X and Y. [#680739]
Morten:
* Minute accuracy improvement to matrix inversion.
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index fbec93f..ba50f2d 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -65,6 +65,12 @@ enum {
PLOT_PROP_VARY_STYLE_BY_ELEMENT,
PLOT_PROP_AXIS_X,
PLOT_PROP_AXIS_Y,
+ PLOT_PROP_AXIS_Z,
+ PLOT_PROP_AXIS_CIRCULAR,
+ PLOT_PROP_AXIS_RADIAL,
+ PLOT_PROP_AXIS_PSEUDO_3D,
+ PLOT_PROP_AXIS_COLOR,
+ PLOT_PROP_AXIS_BUBBLE,
PLOT_PROP_GROUP,
PLOT_PROP_DEFAULT_INTERPOLATION,
PLOT_PROP_GURU_HINTS
@@ -277,6 +283,24 @@ gog_plot_set_property (GObject *obj, guint param_id,
case PLOT_PROP_AXIS_Y:
gog_plot_set_axis_by_id (plot, GOG_AXIS_Y, g_value_get_uint (value));
break;
+ case PLOT_PROP_AXIS_Z:
+ gog_plot_set_axis_by_id (plot, GOG_AXIS_Z, g_value_get_uint (value));
+ break;
+ case PLOT_PROP_AXIS_CIRCULAR:
+ gog_plot_set_axis_by_id (plot, GOG_AXIS_CIRCULAR, g_value_get_uint (value));
+ break;
+ case PLOT_PROP_AXIS_RADIAL:
+ gog_plot_set_axis_by_id (plot, GOG_AXIS_RADIAL, g_value_get_uint (value));
+ break;
+ case PLOT_PROP_AXIS_PSEUDO_3D:
+ gog_plot_set_axis_by_id (plot, GOG_AXIS_PSEUDO_3D, g_value_get_uint (value));
+ break;
+ case PLOT_PROP_AXIS_COLOR:
+ gog_plot_set_axis_by_id (plot, GOG_AXIS_COLOR, g_value_get_uint (value));
+ break;
+ case PLOT_PROP_AXIS_BUBBLE:
+ gog_plot_set_axis_by_id (plot, GOG_AXIS_BUBBLE, g_value_get_uint (value));
+ break;
case PLOT_PROP_GROUP: {
char const *group = g_value_get_string (value);
g_free (plot->plot_group);
@@ -313,6 +337,24 @@ gog_plot_get_property (GObject *obj, guint param_id,
case PLOT_PROP_AXIS_Y:
g_value_set_uint (value, gog_plot_get_axis_id (plot, GOG_AXIS_Y));
break;
+ case PLOT_PROP_AXIS_Z:
+ g_value_set_uint (value, gog_plot_get_axis_id (plot, GOG_AXIS_Z));
+ break;
+ case PLOT_PROP_AXIS_CIRCULAR:
+ g_value_set_uint (value, gog_plot_get_axis_id (plot, GOG_AXIS_CIRCULAR));
+ break;
+ case PLOT_PROP_AXIS_RADIAL:
+ g_value_set_uint (value, gog_plot_get_axis_id (plot, GOG_AXIS_RADIAL));
+ break;
+ case PLOT_PROP_AXIS_PSEUDO_3D:
+ g_value_set_uint (value, gog_plot_get_axis_id (plot, GOG_AXIS_PSEUDO_3D));
+ break;
+ case PLOT_PROP_AXIS_COLOR:
+ g_value_set_uint (value, gog_plot_get_axis_id (plot, GOG_AXIS_COLOR));
+ break;
+ case PLOT_PROP_AXIS_BUBBLE:
+ g_value_set_uint (value, gog_plot_get_axis_id (plot, GOG_AXIS_BUBBLE));
+ break;
case PLOT_PROP_GROUP:
g_value_set_string (value, plot->plot_group);
break;
@@ -384,6 +426,42 @@ gog_plot_class_init (GogObjectClass *gog_klass)
_("Reference to Y axis"),
0, G_MAXINT, 0,
GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+ g_object_class_install_property (gobject_klass, PLOT_PROP_AXIS_Z,
+ g_param_spec_uint ("z-axis",
+ _("Z axis"),
+ _("Reference to Z axis"),
+ 0, G_MAXINT, 0,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+ g_object_class_install_property (gobject_klass, PLOT_PROP_AXIS_CIRCULAR,
+ g_param_spec_uint ("circ-axis",
+ _("Circular axis"),
+ _("Reference to circular axis"),
+ 0, G_MAXINT, 0,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+ g_object_class_install_property (gobject_klass, PLOT_PROP_AXIS_RADIAL,
+ g_param_spec_uint ("radial-axis",
+ _("Radial axis"),
+ _("Reference to radial axis"),
+ 0, G_MAXINT, 0,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+ g_object_class_install_property (gobject_klass, PLOT_PROP_AXIS_PSEUDO_3D,
+ g_param_spec_uint ("pseudo-3d-axis",
+ _("Pseudo-3d axis"),
+ _("Reference to pseudo-3d axis"),
+ 0, G_MAXINT, 0,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+ g_object_class_install_property (gobject_klass, PLOT_PROP_AXIS_COLOR,
+ g_param_spec_uint ("color-axis",
+ _("Color axis"),
+ _("Reference to color axis"),
+ 0, G_MAXINT, 0,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
+ g_object_class_install_property (gobject_klass, PLOT_PROP_AXIS_BUBBLE,
+ g_param_spec_uint ("bubble-axis",
+ _("Bubble axis"),
+ _("Reference to buccle axis"),
+ 0, G_MAXINT, 0,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE | GO_PARAM_PERSISTENT));
g_object_class_install_property (gobject_klass, PLOT_PROP_GROUP,
g_param_spec_string ("plot-group",
_("Plot group"),
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index d2b34bb..81686eb 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -81,27 +81,41 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
if (GOG_IS_CONTOUR_PLOT (plot)) {
GogXYZContourPlot *xyz = GOG_XYZ_CONTOUR_PLOT (plot);
if (xyz->grid[0].data) {
+ if (xyz->base.x_vals)
+ g_object_unref (xyz->base.x_vals);
xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
xyz->base.columns = go_data_get_vector_size (plot->x_vals);
}
if (xyz->grid[1].data) {
+ if (xyz->base.y_vals)
+ g_object_unref (xyz->base.y_vals);
xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
xyz->base.rows = go_data_get_vector_size (plot->y_vals);
}
} else {
GogXYZSurfacePlot *xyz = GOG_XYZ_SURFACE_PLOT (plot);
if (xyz->grid[0].data) {
+ if (xyz->base.x_vals)
+ g_object_unref (xyz->base.x_vals);
xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
xyz->base.columns = go_data_get_vector_size (plot->x_vals);
}
if (xyz->grid[1].data) {
+ if (xyz->base.y_vals)
+ g_object_unref (xyz->base.y_vals);
xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
xyz->base.rows = go_data_get_vector_size (plot->y_vals);
}
}
n = plot->rows * plot->columns;
- if (n == 0)
+ if (plot->rows < 2 || plot->columns < 2) {
+ /* we store the default value to avoid warnings about invalid values */
+ if (plot->rows < 2)
+ plot->rows = 10;
+ if (plot->columns < 2)
+ plot->columns = 10;
return NULL;
+ }
x_limits = go_range_sort (go_data_get_values (gog_xyz_plot_get_x_vals ((GogXYZPlot *) plot)), plot->columns);
for (i = 0; i < plot->columns - 1; i++)
x_limits[i] = (x_limits[i] + x_limits[i+1]) / 2.;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]