1 /*   EXTRAITS DE LA LICENCE
2 	Copyright CEA, contributeurs : Damien
3 	CALISTE, laboratoire L_Sim, (2016)
4 
5 	Adresse mèl :
6 	CALISTE, damien P caliste AT cea P fr.
7 
8 	Ce logiciel est un programme informatique servant à visualiser des
9 	structures atomiques dans un rendu pseudo-3D.
10 
11 	Ce logiciel est régi par la licence CeCILL soumise au droit français et
12 	respectant les principes de diffusion des logiciels libres. Vous pouvez
13 	utiliser, modifier et/ou redistribuer ce programme sous les conditions
14 	de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA
15 	sur le site "http://www.cecill.info".
16 
17 	Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
18 	pris connaissance de la licence CeCILL, et que vous en avez accepté les
19 	termes (cf. le fichier Documentation/licence.fr.txt fourni avec ce logiciel).
20 */
21 
22 /*   LICENCE SUM UP
23 	Copyright CEA, contributors : Damien
24 	CALISTE, laboratoire L_Sim, (2016)
25 
26 	E-mail address:
27 	CALISTE, damien P caliste AT cea P fr.
28 
29 	This software is a computer program whose purpose is to visualize atomic
30 	configurations in 3D.
31 
32 	This software is governed by the CeCILL  license under French law and
33 	abiding by the rules of distribution of free software.  You can  use,
34 	modify and/ or redistribute the software under the terms of the CeCILL
35 	license as circulated by CEA, CNRS and INRIA at the following URL
36 	"http://www.cecill.info".
37 
38 	The fact that you are presently reading this means that you have had
39 	knowledge of the CeCILL license and that you accept its terms. You can
40 	find a copy of this licence shipped with this software at Documentation/licence.en.txt.
41 */
42 
43 #include "vibrations.h"
44 
45 /**
46  * SECTION:vibrations
47  * @short_description: Draw arrows at each node to represent vibrations.
48  *
49  * <para>A specialised #VisuGlExtNodeVectors to represent vibrations on nodes.</para>
50  */
51 
52 /**
53  * VisuGlExtVibrationsClass:
54  * @parent: the parent class;
55  *
56  * A short way to identify #_VisuGlExtVibrationsClass structure.
57  *
58  * Since: 3.8
59  */
60 /**
61  * VisuGlExtVibrations:
62  *
63  * An opaque structure.
64  *
65  * Since: 3.8
66  */
67 
68 G_DEFINE_TYPE(VisuGlExtVibrations, visu_gl_ext_vibrations, VISU_TYPE_GL_EXT_NODE_VECTORS)
69 
70 static void visu_gl_ext_vibrations_class_init(VisuGlExtVibrationsClass *klass _U_)
71 {
72   DBG_fprintf(stderr, "Visu GlExt Vibrations: creating the class of the object.\n");
73   /* DBG_fprintf(stderr, "                - adding new signals ;\n"); */
74 }
75 
76 static void visu_gl_ext_vibrations_init(VisuGlExtVibrations *obj _U_)
77 {
78   DBG_fprintf(stderr, "Visu GlExt Vibrations: initializing a new object (%p).\n",
79 	      (gpointer)obj);
80 }
81 
82 /**
83  * visu_gl_ext_vibrations_new:
84  * @name: (allow-none): the name to give to the extension.
85  *
86  * Creates a new #VisuGlExt to draw vibrations.
87  *
88  * Since: 3.8
89  *
90  * Returns: a pointer to the #VisuGlExt it created or
91  * NULL otherwise.
92  */
93 VisuGlExtVibrations* visu_gl_ext_vibrations_new(const gchar *name)
94 {
95   char *name_ = "Vibrations";
96   char *description = _("Draw vibrations with vectors.");
97   VisuGlExtNodeVectors *vibrations;
98 
99   DBG_fprintf(stderr,"Visu GlExt Vibrations: new object.\n");
100   vibrations = VISU_GL_EXT_NODE_VECTORS(g_object_new(VISU_TYPE_GL_EXT_VIBRATIONS,
101                                                      "name", (name) ? name : name_,
102                                                      "label", _(name_),
103                                                      "description", description, "nGlObj", 1,
104                                                      "rendering-size", 1.f,
105                                                      "normalisation", -1.f,
106                                                      NULL));
107   visu_gl_ext_node_vectors_setCentering(vibrations, VISU_GL_ARROW_TAIL_CENTERED);
108   visu_gl_ext_node_vectors_setColor(vibrations, FALSE);
109   visu_gl_ext_node_vectors_setArrow(vibrations, 0.5f, 0.2f, 10,
110                                     0.5f, 0.3f, 10);
111   visu_gl_ext_node_vectors_setVectorThreshold(vibrations, -0.05f); /* Value
112                                                                       in percentage. */
113   visu_gl_ext_node_vectors_setAddLength(vibrations, 2.5f);
114 
115   return VISU_GL_EXT_VIBRATIONS(vibrations);
116 }
117