1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2004-2006 - INRIA - Fabrice Leray
4 * Copyright (C) 2006 - INRIA - Allan Cornet
5 * Copyright (C) 2006 - INRIA - Jean-Baptiste Silvy
6 * Copyright (C) 2010 - DIGITEO - Manuel Juliachs
7 * Copyright (C) 2011 - DIGITEO - Vincent Couvert
8 *
9 * Copyright (C) 2012 - 2016 - Scilab Enterprises
10 *
11 * This file is hereby licensed under the terms of the GNU GPL v2.0,
12 * pursuant to article 5.3.4 of the CeCILL v.2.1.
13 * This file was originally licensed under the terms of the CeCILL v2.1,
14 * and continues to be available under such terms.
15 * For more information, see the COPYING file which you should have received
16 * along with this program.
17 *
18 */
19
20 /*------------------------------------------------------------------------*/
21 /* file: get_z_shift_property.c */
22 /* desc : function to retrieve in Scilab the z_shift field of a */
23 /* handle */
24 /*------------------------------------------------------------------------*/
25
26 #include "getHandleProperty.h"
27 #include "GetProperty.h"
28 #include "returnProperty.h"
29 #include "Scierror.h"
30 #include "localization.h"
31 #include "sci_malloc.h"
32
33 #include "getGraphicObjectProperty.h"
34 #include "graphicObjectProperties.h"
35
36 /*------------------------------------------------------------------------*/
get_z_shift_property(void * _pvCtx,int iObjUID)37 void* get_z_shift_property(void* _pvCtx, int iObjUID)
38 {
39 double* shiftCoordinates = NULL;
40 int iValue = 0;
41 int* piValue = &iValue;
42
43 getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__, jni_int, (void**)&piValue);
44
45 if (piValue == NULL)
46 {
47 Scierror(999, _("'%s' property does not exist for this handle.\n"), "z_shift");
48 return NULL;
49 }
50
51 if (iValue == 0)
52 {
53 return sciReturnEmptyMatrix();
54 }
55 else
56 {
57 getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_Z_COORDINATES_SHIFT__, jni_double_vector, (void **)&shiftCoordinates);
58 getGraphicObjectProperty(iObjUID, __GO_DATA_MODEL_NUM_ELEMENTS__, jni_int, (void**)&piValue);
59
60 return sciReturnRowVector(shiftCoordinates, iValue);
61 }
62 }
63 /*------------------------------------------------------------------------*/
64