Exemple #1
0
static void
prof_execute(ProfControls *controls,
             GwyContainer *data)
{
    GwyGraphCurveModel *gcmodel;
    GwyGraphModel *gmodel;
    ProfArgs *args = controls->args;
    gchar *s;
    gint i, n;

    n = gwy_selection_get_data(controls->selection, NULL);
    g_return_if_fail(n);

    g_object_set(controls->gmodel, "label-visible", TRUE, NULL);
    if (!args->separate) {
        gwy_app_add_graph_or_curves(controls->gmodel,
                                    data, &args->target_graph, 1);
        return;
    }

    for (i = 0; i < n; i++) {
        gmodel = gwy_graph_model_new_alike(controls->gmodel);
        gcmodel = gwy_graph_model_get_curve(controls->gmodel, i);
        gcmodel = gwy_graph_curve_model_duplicate(gcmodel);
        gwy_graph_model_add_curve(gmodel, gcmodel);
        g_object_unref(gcmodel);
        g_object_get(gcmodel, "description", &s, NULL);
        g_object_set(gmodel, "title", s, NULL);
        g_free(s);
        gwy_app_data_browser_add_graph_model(gmodel, data, TRUE);
        g_object_unref(gmodel);
    }
}
Exemple #2
0
static void
curvature_do(GwyContainer *data,
             GwyDataField *dfield,
             GwyDataField *mfield,
             gint oldid,
             const CurvatureArgs *args)
{
    gdouble params[PARAM_NPARAMS];
    Intersection i1[2], i2[2];
    gchar *key;

    if (!curvature_calculate(dfield, mfield, args, params, i1, i2))
        return;

    if (args->set_selection) {
        GwySelection *selection;

        selection = g_object_new(g_type_from_name("GwySelectionLine"),
                                 "max-objects", 1024,
                                 NULL);
        curvature_set_selection(dfield, i1, i2, selection);
        key = g_strdup_printf("/%d/select/line", oldid);
        gwy_container_set_object_by_name(data, key, selection);
        g_object_unref(selection);
    }

    if (args->plot_graph) {
        GwyGraphModel *gmodel;

        gmodel = gwy_graph_model_new();
        curvature_plot_graph(dfield, i1, i2, gmodel);
        gwy_app_add_graph_or_curves(gmodel, data, &args->target_graph, 1);
        g_object_unref(gmodel);
    }
}
Exemple #3
0
static void
grain_cross_run(GrainCrossArgs *args,
                GwyContainer *data,
                GwyDataField *dfield)
{
    GwyGraphModel *gmodel = create_corr_graph(args, dfield);
    gwy_app_add_graph_or_curves(gmodel, data, &args->target_graph, 1);
    g_object_unref(gmodel);
}