File: gwy3dsetup.c

package info (click to toggle)
gwyddion 2.62-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 51,952 kB
  • sloc: ansic: 398,486; python: 7,877; sh: 5,492; makefile: 4,723; xml: 3,883; cpp: 1,969; pascal: 418; perl: 154; ruby: 130
file content (717 lines) | stat: -rw-r--r-- 23,997 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
/*
 *  $Id: gwy3dsetup.c 20678 2017-12-18 18:26:55Z yeti-dn $
 *  Copyright (C) 2006-2017 David Necas (Yeti), Petr Klapetek.
 *  E-mail: yeti@gwyddion.net, klapetek@gwyddion.net.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 */

#include "config.h"
#include <libgwyddion/gwymacros.h>
#include <libgwyddion/gwyserializable.h>
#include <libgwydgets/gwydgettypes.h>
#include <libgwydgets/gwy3dsetup.h>

#define GWY_3D_SETUP_TYPE_NAME "Gwy3DSetup"

enum {
    PROP_0,
    PROP_PROJECTION,
    PROP_VISUALIZATION,
    PROP_AXES_VISIBLE,
    PROP_LABELS_VISIBLE,
    PROP_FMSCALE_VISIBLE,
    PROP_ROTATION_X,
    PROP_ROTATION_Y,
    PROP_SCALE,
    PROP_Z_SCALE,
    PROP_LIGHT_PHI,
    PROP_LIGHT_THETA,
    PROP_HIDE_MASKED,
    PROP_LINE_WIDTH,
    PROP_FMSCALE_SIZE,
    PROP_FMSCALE_Y_ALIGN,
    PROP_FMSCALE_RESERVE_SPACE,
    PROP_LAST
};

static void        gwy_3d_setup_serializable_init(GwySerializableIface *iface);
static void        gwy_3d_setup_set_property     (GObject *object,
                                                  guint prop_id,
                                                  const GValue *value,
                                                  GParamSpec *pspec);
static void        gwy_3d_setup_get_property     (GObject*object,
                                                  guint prop_id,
                                                  GValue *value,
                                                  GParamSpec *pspec);
static GByteArray* gwy_3d_setup_serialize        (GObject *serializable,
                                                  GByteArray *buffer);
static GObject*    gwy_3d_setup_deserialize      (const guchar *buffer,
                                                  gsize size,
                                                  gsize *position);
static void        gwy_3d_setup_clone            (GObject *source,
                                                  GObject *copy);
static GObject*    gwy_3d_setup_duplicate_real   (GObject *object);
static gsize       gwy_3d_setup_get_size         (GObject *object);

G_DEFINE_TYPE_EXTENDED
    (Gwy3DSetup, gwy_3d_setup, G_TYPE_OBJECT, 0,
     GWY_IMPLEMENT_SERIALIZABLE(gwy_3d_setup_serializable_init))

static void
gwy_3d_setup_serializable_init(GwySerializableIface *iface)
{
    iface->serialize = gwy_3d_setup_serialize;
    iface->deserialize = gwy_3d_setup_deserialize;
    iface->clone = gwy_3d_setup_clone;
    iface->get_size = gwy_3d_setup_get_size;
    iface->duplicate = gwy_3d_setup_duplicate_real;
}

static void
gwy_3d_setup_class_init(Gwy3DSetupClass *klass)
{
    GObjectClass *gobject_class = G_OBJECT_CLASS(klass);

    gobject_class->set_property = gwy_3d_setup_set_property;
    gobject_class->get_property = gwy_3d_setup_get_property;

    g_object_class_install_property
        (gobject_class,
         PROP_PROJECTION,
         g_param_spec_enum("projection",
                           "Projection",
                           "The type of the projection",
                           GWY_TYPE_3D_PROJECTION,
                           GWY_3D_PROJECTION_ORTHOGRAPHIC,
                           G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_VISUALIZATION,
         g_param_spec_enum("visualization",
                           "Visualization",
                           "Data visualization type",
                           GWY_TYPE_3D_VISUALIZATION,
                           GWY_3D_VISUALIZATION_GRADIENT,
                           G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_AXES_VISIBLE,
         g_param_spec_boolean("axes-visible",
                              "Axes visible",
                              "Whether axes are visible",
                              TRUE,
                              G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_LABELS_VISIBLE,
         g_param_spec_boolean("labels-visible",
                              "Labels visible",
                              "Whether axis labels are visible if axes "
                              "are visible",
                              TRUE,
                              G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_FMSCALE_VISIBLE,
         g_param_spec_boolean("fmscale-visible",
                              "Fmscale visible",
                              "Whether false color bar is visible",
                              FALSE,
                              G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_ROTATION_X,
         g_param_spec_double("rotation-x",
                             "Rotation X",
                             "Angle of the first rotation around x-axis, "
                             "in radians",
                             -G_MAXDOUBLE, G_MAXDOUBLE, G_PI/4.0,
                             G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_ROTATION_Y,
         g_param_spec_double("rotation-y",
                             "Rotation Y",
                             "Angle of the second rotation around y-axis, "
                             "in radians",
                             -G_MAXDOUBLE, G_MAXDOUBLE, -G_PI/4.0,
                             G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_SCALE,
         g_param_spec_double("scale",
                             "Scale",
                             "Overall view scale",
                             G_MINDOUBLE, G_MAXDOUBLE, 1.0,
                             G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_Z_SCALE,
         g_param_spec_double("z-scale",
                             "Z scale",
                             "Extra stretch along z (value) axis",
                             G_MINDOUBLE, G_MAXDOUBLE, 1.0,
                             G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_LIGHT_PHI,
         g_param_spec_double("light-phi",
                             "Light phi",
                             "Light source direction azimuth in horizontal "
                             "plane, in radians",
                             -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
                             G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_LIGHT_THETA,
         g_param_spec_double("light-theta",
                             "Light theta",
                             "Light source direction deviation from the "
                             "z axis, in radians",
                             -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
                             G_PARAM_READWRITE));

    g_object_class_install_property
        (gobject_class,
         PROP_HIDE_MASKED,
         g_param_spec_boolean("hide_masked",
                              "Hide masked",
                              "Hide masked vertices",
                              FALSE,
                              G_PARAM_READWRITE));

    /**
     * Gwy3DSetup:line-width:
     *
     * Width of axis lines and ticks, in pixels.
     *
     * Since: 2.42
     **/
    g_object_class_install_property
        (gobject_class,
         PROP_LINE_WIDTH,
         g_param_spec_double("line-width",
                             "Line width",
                             "Width of axis lines and ticks, in pixels.",
                             1.0, 10.0, 1.0,
                             G_PARAM_READWRITE));

    /**
     * Gwy3DSetup:fmscale-size:
     *
     * Size of false colour scale relative to view height.
     *
     * Since: 2.49
     **/
    g_object_class_install_property
        (gobject_class,
         PROP_FMSCALE_SIZE,
         g_param_spec_double("fmscale-size",
                             "Fmscale size",
                             "Size of false colour scale relative to "
                             "view height.",
                             0.0, 1.0, 1.0,
                             G_PARAM_READWRITE));

    /**
     * Gwy3DSetup:fmscale-y-align:
     *
     * Vertical alignment of false colour scale.
     *
     * Since: 2.49
     **/
    g_object_class_install_property
        (gobject_class,
         PROP_FMSCALE_Y_ALIGN,
         g_param_spec_double("fmscale-y-align",
                             "Fmscale y align",
                             "Vertical alignment of false colour scale.",
                             0.0, 1.0, 0.5,
                             G_PARAM_READWRITE));
    /**
     * Gwy3DSetup:fmscale-reserve-space:
     *
     * Whethere to reserve entire vertical stripe of the false colour scale.
     *
     * Since: 2.49
     **/
    g_object_class_install_property
        (gobject_class,
         PROP_FMSCALE_RESERVE_SPACE,
         g_param_spec_boolean("fmscale-reserve-space",
                              "Fmscale resrrve space",
                              "Whether to reserve horizontal space for "
                              "the false colour scale.",
                              TRUE,
                              G_PARAM_READWRITE));

}

static void
gwy_3d_setup_init(Gwy3DSetup *setup)
{
    setup->projection = GWY_3D_PROJECTION_ORTHOGRAPHIC;
    setup->visualization = GWY_3D_VISUALIZATION_GRADIENT;

    setup->axes_visible = TRUE;
    setup->labels_visible = TRUE;
    setup->fmscale_visible = FALSE;

    setup->rotation_x = G_PI/4.0;
    setup->rotation_y = -G_PI/4.0;
    setup->scale = 1.0;
    setup->z_scale = 1.0;
    setup->light_phi = 0.0;
    setup->light_theta = 0.0;
    setup->line_width = 1.0;
    setup->fmscale_size = 1.0;
    setup->fmscale_yalign = 0.5;
    setup->fmscale_reserve_space = TRUE;
}

static void
gwy_3d_setup_set_property(GObject *object,
                          guint prop_id,
                          const GValue *value,
                          GParamSpec *pspec)
{
    Gwy3DSetup *setup = GWY_3D_SETUP(object);

    switch (prop_id) {
        case PROP_PROJECTION:
        setup->projection = g_value_get_enum(value);
        break;

        case PROP_VISUALIZATION:
        setup->visualization = g_value_get_enum(value);
        break;

        case PROP_AXES_VISIBLE:
        setup->axes_visible = g_value_get_boolean(value);
        break;

        case PROP_LABELS_VISIBLE:
        setup->labels_visible = g_value_get_boolean(value);
        break;

        case PROP_FMSCALE_VISIBLE:
        setup->fmscale_visible = g_value_get_boolean(value);
        break;

        case PROP_ROTATION_X:
        setup->rotation_x = g_value_get_double(value);
        break;

        case PROP_ROTATION_Y:
        setup->rotation_y = g_value_get_double(value);
        break;

        case PROP_SCALE:
        setup->scale = g_value_get_double(value);
        break;

        case PROP_Z_SCALE:
        setup->z_scale = g_value_get_double(value);
        break;

        case PROP_LIGHT_PHI:
        setup->light_phi = g_value_get_double(value);
        break;

        case PROP_LIGHT_THETA:
        setup->light_theta = g_value_get_double(value);
        break;

        case PROP_HIDE_MASKED:
        setup->hide_masked = g_value_get_boolean(value);
        break;

        case PROP_LINE_WIDTH:
        setup->line_width = g_value_get_double(value);
        break;

        case PROP_FMSCALE_SIZE:
        setup->fmscale_size = g_value_get_double(value);
        break;

        case PROP_FMSCALE_Y_ALIGN:
        setup->fmscale_yalign = g_value_get_double(value);
        break;

        case PROP_FMSCALE_RESERVE_SPACE:
        setup->fmscale_reserve_space = g_value_get_boolean(value);
        break;

        default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
        break;
    }
}

static void
gwy_3d_setup_get_property(GObject *object,
                          guint prop_id,
                          GValue *value,
                          GParamSpec *pspec)
{
    Gwy3DSetup *setup = GWY_3D_SETUP(object);

    switch (prop_id) {
        case PROP_PROJECTION:
        g_value_set_enum(value, setup->projection);
        break;

        case PROP_VISUALIZATION:
        g_value_set_enum(value, setup->visualization);
        break;

        case PROP_AXES_VISIBLE:
        g_value_set_boolean(value, setup->axes_visible);
        break;

        case PROP_LABELS_VISIBLE:
        g_value_set_boolean(value, setup->labels_visible);
        break;

        case PROP_FMSCALE_VISIBLE:
        g_value_set_boolean(value, setup->fmscale_visible);
        break;

        case PROP_ROTATION_X:
        g_value_set_double(value, setup->rotation_x);
        break;

        case PROP_ROTATION_Y:
        g_value_set_double(value, setup->rotation_y);
        break;

        case PROP_SCALE:
        g_value_set_double(value, setup->scale);
        break;

        case PROP_Z_SCALE:
        g_value_set_double(value, setup->z_scale);
        break;

        case PROP_LIGHT_PHI:
        g_value_set_double(value, setup->light_phi);
        break;

        case PROP_LIGHT_THETA:
        g_value_set_double(value, setup->light_theta);
        break;

        case PROP_HIDE_MASKED:
        g_value_set_boolean(value, setup->hide_masked);
        break;

        case PROP_LINE_WIDTH:
        g_value_set_double(value, setup->line_width);
        break;

        case PROP_FMSCALE_SIZE:
        g_value_set_double(value, setup->fmscale_size);
        break;

        case PROP_FMSCALE_Y_ALIGN:
        g_value_set_double(value, setup->fmscale_yalign);
        break;

        case PROP_FMSCALE_RESERVE_SPACE:
        g_value_set_boolean(value, setup->fmscale_reserve_space);
        break;

        default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
        break;
    }
}

static GByteArray*
gwy_3d_setup_serialize(GObject *serializable,
                       GByteArray *buffer)
{
    Gwy3DSetup *setup;

    gwy_debug("");
    g_return_val_if_fail(GWY_IS_3D_SETUP(serializable), NULL);

    setup = GWY_3D_SETUP(serializable);
    {
        GwySerializeSpec spec[] = {
            { 'i', "projection", &setup->projection, NULL, },
            { 'i', "visualization", &setup->visualization, NULL, },
            { 'b', "axes-visible", &setup->axes_visible, NULL, },
            { 'b', "labels-visible", &setup->labels_visible, NULL, },
            { 'b', "fmscale-visible", &setup->fmscale_visible, NULL, },
            { 'd', "rotation-x", &setup->rotation_x, NULL, },
            { 'd', "rotation-y", &setup->rotation_y, NULL, },
            { 'd', "scale", &setup->scale, NULL, },
            { 'd', "z-scale", &setup->z_scale, NULL, },
            { 'd', "light-phi", &setup->light_phi, NULL, },
            { 'd', "light-theta", &setup->light_theta, NULL, },
            { 'b', "hide-masked", &setup->hide_masked, NULL, },
            { 'd', "line-width", &setup->line_width, NULL, },
            { 'd', "fmscale-size", &setup->fmscale_size, NULL, },
            { 'd', "fmscale-y-align", &setup->fmscale_yalign, NULL, },
            { 'b', "fmscale-resrrve-space", &setup->fmscale_reserve_space, NULL, },
        };

        return gwy_serialize_pack_object_struct(buffer,
                                                GWY_3D_SETUP_TYPE_NAME,
                                                G_N_ELEMENTS(spec), spec);
    }
}

static gsize
gwy_3d_setup_get_size(GObject *object)
{
    Gwy3DSetup *setup;

    gwy_debug("");
    g_return_val_if_fail(GWY_IS_3D_SETUP(object), 0);

    setup = GWY_3D_SETUP(object);
    {
        GwySerializeSpec spec[] = {
            { 'i', "projection", &setup->projection, NULL, },
            { 'i', "visualization", &setup->visualization, NULL, },
            { 'b', "axes-visible", &setup->axes_visible, NULL, },
            { 'b', "labels-visible", &setup->labels_visible, NULL, },
            { 'b', "fmscale-visible", &setup->fmscale_visible, NULL, },
            { 'd', "rotation-x", &setup->rotation_x, NULL, },
            { 'd', "rotation-y", &setup->rotation_y, NULL, },
            { 'd', "scale", &setup->scale, NULL, },
            { 'd', "z-scale", &setup->z_scale, NULL, },
            { 'd', "light-phi", &setup->light_phi, NULL, },
            { 'd', "light-theta", &setup->light_theta, NULL, },
            { 'b', "hide-masked", &setup->hide_masked, NULL, },
            { 'd', "line-width", &setup->line_width, NULL, },
            { 'd', "fmscale-size", &setup->fmscale_size, NULL, },
            { 'd', "fmscale-y-align", &setup->fmscale_yalign, NULL, },
            { 'b', "fmscale-resrrve-space", &setup->fmscale_reserve_space, NULL, },
        };

        return gwy_serialize_get_struct_size(GWY_3D_SETUP_TYPE_NAME,
                                             G_N_ELEMENTS(spec), spec);
    }
}

static GObject*
gwy_3d_setup_deserialize(const guchar *buffer,
                         gsize size,
                         gsize *position)
{
    Gwy3DSetup *setup;

    gwy_debug("");
    g_return_val_if_fail(buffer, NULL);

    setup = gwy_3d_setup_new();
    {
        GwySerializeSpec spec[] = {
            { 'i', "projection", &setup->projection, NULL, },
            { 'i', "visualization", &setup->visualization, NULL, },
            { 'b', "axes-visible", &setup->axes_visible, NULL, },
            { 'b', "labels-visible", &setup->labels_visible, NULL, },
            { 'b', "fmscale-visible", &setup->fmscale_visible, NULL, },
            { 'd', "rotation-x", &setup->rotation_x, NULL, },
            { 'd', "rotation-y", &setup->rotation_y, NULL, },
            { 'd', "scale", &setup->scale, NULL, },
            { 'd', "z-scale", &setup->z_scale, NULL, },
            { 'd', "light-phi", &setup->light_phi, NULL, },
            { 'd', "light-theta", &setup->light_theta, NULL, },
            { 'b', "hide-masked", &setup->hide_masked, NULL, },
            { 'd', "line-width", &setup->line_width, NULL, },
            { 'd', "fmscale-size", &setup->fmscale_size, NULL, },
            { 'd', "fmscale-y-align", &setup->fmscale_yalign, NULL, },
            { 'b', "fmscale-resrrve-space", &setup->fmscale_reserve_space, NULL, },
        };

        if (!gwy_serialize_unpack_object_struct(buffer, size, position,
                                                GWY_3D_SETUP_TYPE_NAME,
                                                G_N_ELEMENTS(spec), spec)) {
            return NULL;
        }
    }

    return (GObject*)setup;
}

static void
gwy_3d_setup_clone(GObject *source,
                   GObject *copy)
{
    Gwy3DSetup *setup, *clone;

    g_return_if_fail(GWY_IS_3D_SETUP(source));
    g_return_if_fail(GWY_IS_3D_SETUP(copy));

    setup = GWY_3D_SETUP(source);
    clone = GWY_3D_SETUP(copy);

    g_object_freeze_notify(copy);

    if (clone->projection != setup->projection) {
        clone->projection = setup->projection;
        g_object_notify(copy, "projection");
    }
    if (clone->visualization != setup->visualization) {
        clone->visualization = setup->visualization;
        g_object_notify(copy, "visualization");
    }

    if (clone->axes_visible != setup->axes_visible) {
        clone->axes_visible = setup->axes_visible;
        g_object_notify(copy, "axes-visible");
    }

    if (clone->labels_visible != setup->labels_visible) {
        clone->labels_visible = setup->labels_visible;
        g_object_notify(copy, "labels-visible");
    }
    if (clone->fmscale_visible != setup->fmscale_visible) {
        clone->fmscale_visible = setup->fmscale_visible;
        g_object_notify(copy, "fmscale-visible");
    }

    if (clone->rotation_x != setup->rotation_x) {
        clone->rotation_x = setup->rotation_x;
        g_object_notify(copy, "rotation-x");
    }
    if (clone->rotation_y != setup->rotation_y) {
        clone->rotation_y = setup->rotation_y;
        g_object_notify(copy, "rotation-y");
    }

    if (clone->scale != setup->scale) {
        clone->scale = setup->scale;
        g_object_notify(copy, "scale");
    }
    if (clone->z_scale != setup->z_scale) {
        clone->z_scale = setup->z_scale;
        g_object_notify(copy, "z-scale");
    }

    if (clone->light_phi != setup->light_phi) {
        clone->light_phi = setup->light_phi;
        g_object_notify(copy, "light-phi");
    }
    if (clone->light_theta != setup->light_theta) {
        clone->light_theta = setup->light_theta;
        g_object_notify(copy, "light-theta");
    }

    if (clone->hide_masked != setup->hide_masked) {
        clone->hide_masked = setup->hide_masked;
        g_object_notify(copy, "hide-masked");
    }

    if (clone->line_width != setup->line_width) {
        clone->line_width = setup->line_width;
        g_object_notify(copy, "line-width");
    }

    if (clone->fmscale_size != setup->fmscale_size) {
        clone->fmscale_size = setup->fmscale_size;
        g_object_notify(copy, "fmscale-size");
    }

    if (clone->fmscale_yalign != setup->fmscale_yalign) {
        clone->fmscale_yalign = setup->fmscale_yalign;
        g_object_notify(copy, "fmscale-y-align");
    }

    if (clone->fmscale_reserve_space != setup->fmscale_reserve_space) {
        clone->fmscale_reserve_space = setup->fmscale_reserve_space;
        g_object_notify(copy, "fmscale-reserve-space");
    }

    g_object_thaw_notify(copy);
}

static GObject*
gwy_3d_setup_duplicate_real(GObject *object)
{
    Gwy3DSetup *setup, *duplicate;

    setup = GWY_3D_SETUP(object);
    duplicate = gwy_3d_setup_new();

    duplicate->projection = setup->projection;
    duplicate->visualization = setup->visualization;

    duplicate->axes_visible = setup->axes_visible;
    duplicate->labels_visible = setup->labels_visible;
    duplicate->fmscale_visible = setup->fmscale_visible;

    duplicate->rotation_x = setup->rotation_x;
    duplicate->rotation_y = setup->rotation_y;
    duplicate->scale = setup->scale;
    duplicate->z_scale = setup->z_scale;
    duplicate->light_phi = setup->light_phi;
    duplicate->light_theta = setup->light_theta;

    duplicate->hide_masked = setup->hide_masked;

    duplicate->line_width = setup->line_width;
    duplicate->fmscale_size = setup->fmscale_size;
    duplicate->fmscale_yalign = setup->fmscale_yalign;
    duplicate->fmscale_reserve_space = setup->fmscale_reserve_space;

    return (GObject*)duplicate;
}

/**
 * gwy_3d_setup_new:
 *
 * Creates a new 3D view setup with default values.
 *
 * Returns: A newly created 3D view setup.
 **/
Gwy3DSetup*
gwy_3d_setup_new(void)
{
    return (Gwy3DSetup*)g_object_new(GWY_TYPE_3D_SETUP, NULL);
}

/************************** Documentation ****************************/

/**
 * SECTION:gwy3dsetup
 * @title: Gwy3DSetup
 * @short_description: 3D scene setup
 * @see_also: #Gwy3DView -- the basic 3D data display widget
 *
 * #Gwy3DSetup represents a basic 3D scene setup: viewpoint, projection, light,
 * scale, etc.  It is serializable and used to represent the #Gwy3DView setup.
 *
 * Its components can be read directly in the struct or generically with
 * g_object_get().  To set them you it is necessary to use g_object_set().
 **/

/* vim: set cin et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */