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
|
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2001-2002 - INRIA - Mathieu Philipe
* Copyright (C) 2002-2004 - INRIA - Djalel Abdemouche
* Copyright (C) 2004-2006 - INRIA - Fabrice Leray
* Copyright (C) 2005 - INRIA - Jean-Baptiste Silvy
* Copyright (C) 2010 - DIGITEO - Manuel Juliachs
* Copyright (C) 2010 - Paul Griffiths
*
* This file must be used under the terms of the CeCILL.
* This source file is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at
* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
*
*/
/*------------------------------------------------------------------------
* Graphic library
* newGraph Library header
* Comment:
* This file contains all functions used to Draw the content of a window.
* The main functions is sciDrawObj that draws the objects recursively.
------------------------------------------------------------------------/-*/
#include <stdio.h>
#include <string.h>
#ifdef _MSC_VER
#include "strdup_Windows.h"
#endif
#include "DrawObjects.h"
#include "GetProperty.h"
#include "SetProperty.h"
#include "BuildObjects.h"
#include "DestroyObjects.h"
#include "PloEch.h"
#include "sciprint.h"
#include "math_graphics.h"
#include "Format.h"
#include "HandleManagement.h"
#include "MALLOC.h" /* MALLOC */
#include "localization.h"
#include "math.h" /* fabs, floor, log10, pow */
#include "BasicAlgos.h"
#include "getGraphicObjectProperty.h"
#include "setGraphicObjectProperty.h"
#include "graphicObjectProperties.h"
//#include "../../../tclsci/includes/GedManagement.h"
/* get the displayed bounds of an axis */
void sciGetDisplayedBounds(int iSubWinUID,
double * xmin ,
double * xmax ,
double * ymin ,
double * ymax ,
double * zmin ,
double * zmax)
{
/*****************************************************************
* get initial bounds
*****************************************************************/
int iZoomEnabled = 0;
int* piZoomEnabled = &iZoomEnabled;
double* bounds = NULL;
int iLogFlag = 0;
int *piLogFlag = &iLogFlag;
getGraphicObjectProperty(iSubWinUID, __GO_ZOOM_ENABLED__, jni_bool, (void **)&piZoomEnabled);
if (iZoomEnabled)
{
getGraphicObjectProperty(iSubWinUID, __GO_ZOOM_BOX__, jni_double_vector, (void **)&bounds);
}
else
{
getGraphicObjectProperty(iSubWinUID, __GO_DATA_BOUNDS__, jni_double_vector, (void **)&bounds);
}
*xmin = bounds[0];
*xmax = bounds[1];
*ymin = bounds[2];
*ymax = bounds[3];
*zmin = bounds[4];
*zmax = bounds[5];
/*****************************************************************
* modify bounds and aaint if using log scaling X axis
*****************************************************************/
getGraphicObjectProperty(iSubWinUID, __GO_X_AXIS_LOG_FLAG__, jni_bool, (void **)&piLogFlag);
if (iLogFlag == 1)
{
if (sciGetLogExponent(*xmin, *xmax, xmin, xmax) != 0)
{
sciprint(_("Warning: Can't use Log on X-axis xmin is negative.\n"));
}
}
/*****************************************************************
* modify bounds and aaint if using log scaling Y axis
*****************************************************************/
getGraphicObjectProperty(iSubWinUID, __GO_Y_AXIS_LOG_FLAG__, jni_bool, (void **)&piLogFlag);
if (iLogFlag == 1)
{
if (sciGetLogExponent(*ymin, *ymax, ymin, ymax) != 0)
{
sciprint(_("Warning: Can't use Log on Y-axis ymin is negative.\n"));
}
}
/*****************************************************************
* modify bounds and aaint if using log scaling Z axis
*****************************************************************/
getGraphicObjectProperty(iSubWinUID, __GO_Z_AXIS_LOG_FLAG__, jni_bool, (void **)&piLogFlag);
if (iLogFlag == 1)
{
if (sciGetLogExponent(*zmin, *zmax, zmin, zmax) != 0)
{
sciprint(_("Warning: Can't use Log on Z-axis zmin is negative.\n"));
}
}
}
|