static BOOL setSegsBuffers(scicos_block * block, int maxNumberOfPoints) { int iFigureUID; int iAxeUID; int iSegsUID; int i; int nclk = block->nipar - 6; BOOL result = TRUE; int color; iFigureUID = getFigure(block); iAxeUID = getAxe(iFigureUID, block); for (i = 0; i < nclk; i++) { iSegsUID = getSegs(iAxeUID, block, i); result = setGraphicObjectProperty(iSegsUID, __GO_NUMBER_ARROWS__, &maxNumberOfPoints, jni_int, 1); /* * Update color due to bug #9902 * http://bugzilla.scilab.org/show_bug.cgi?id=9902 */ color = block->ipar[2 + i]; if (color > 0) { setGraphicObjectProperty(iSegsUID, __GO_SEGS_COLORS__, &color, jni_int_vector, 1); } } return result; }
BOOL setLabel(int iAxeUID, int _iName, char* pstLabel) { int iLabelUID = 0; int* piLabelUID = &iLabelUID; int dimensions[2]; BOOL result = TRUE; getGraphicObjectProperty(iAxeUID, _iName, jni_int, (void **)&piLabelUID); if (iLabelUID != 0) { dimensions[0] = 1; dimensions[1] = 1; result = setGraphicObjectProperty(iLabelUID, __GO_TEXT_ARRAY_DIMENSIONS__, &dimensions, jni_int_vector, 2); } if (iLabelUID != 0 && result == TRUE) { result = setGraphicObjectProperty(iLabelUID, __GO_TEXT_STRINGS__, &pstLabel, jni_string_vector, 1); } return (BOOL) (result && iLabelUID != 0); }
/* For matplot1 */ int C2F(implot1)(unsigned char *z, int *n1, int *n2, double *xrect, int plottype) { int iSubwinUID = 0; int iGrayplotUID = 0; BOOL isRedrawn = FALSE; double y = 0; /* void for ConstructGrayplot */ int clipState = 0; int firstPlot = 0; isRedrawn = checkRedrawing(); /*---- Boundaries of the frame ----*/ iSubwinUID = getCurrentSubWin(); /* Force "cligrf" clipping (1) */ clipState = 1; setGraphicObjectProperty(iSubwinUID, __GO_CLIP_STATE__, &clipState, jni_int, 1); iGrayplotUID = ConstructImplot(iSubwinUID, xrect, z, *n1 + 1, *n2 + 1, plottype); if (iGrayplotUID == 0) { // allocation error Scierror(999, _("%s: No more memory.\n"), "grayplot"); return -1; } setCurrentObject(iGrayplotUID); setGraphicObjectProperty(iSubwinUID, __GO_FIRST_PLOT__, &firstPlot, jni_bool, 1); return (0); }
static BOOL setBounds(scicos_block * block, char *pAxeUID, char *pGrayplotUID) { BOOL result; int gridSize[4]; double dataBounds[6]; int m, n; m = GetInPortSize(block, 1, 1); n = GetInPortSize(block, 1, 2); gridSize[0] = m; gridSize[1] = 1; gridSize[2] = n; gridSize[3] = 1; dataBounds[0] = 0; // xMin dataBounds[1] = (double)m; // xMax dataBounds[2] = 0; // yMin dataBounds[3] = (double)n; // yMax dataBounds[4] = -1.0; // zMin dataBounds[5] = 1.0; // zMax result = setGraphicObjectProperty(pGrayplotUID, __GO_DATA_MODEL_GRID_SIZE__, gridSize, jni_int_vector, 4); result &= setGraphicObjectProperty(pAxeUID, __GO_DATA_BOUNDS__, dataBounds, jni_double_vector, 6); return result; }
static BOOL setDefaultValues(scicos_block * block, char *pGrayplotUID) { int m, n, len; int i; double *values; BOOL result; m = GetInPortSize(block, 1, 1); n = GetInPortSize(block, 1, 2); len = Max(m, n); values = (double *)CALLOC(n * m, sizeof(double)); if (values == NULL) { return FALSE; } result = setGraphicObjectProperty(pGrayplotUID, __GO_DATA_MODEL_Z__, values, jni_double_vector, m * n); for (i = 1; i <= len; i++) { values[i] = (double)i; } result &= setGraphicObjectProperty(pGrayplotUID, __GO_DATA_MODEL_X__, values, jni_double_vector, m); result &= setGraphicObjectProperty(pGrayplotUID, __GO_DATA_MODEL_Y__, values, jni_double_vector, n); FREE(values); return result; }
/*------------------------------------------------------------------------*/ int set_z_shift_property(void* _pvCtx, char * pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL result = FALSE; double* shiftCoordinates = NULL; int nbElement = nbRow * nbCol; int iNumElements = 0; int* piNumElements = &iNumElements; if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Real matrix expected.\n"), "z_shift"); return SET_PROPERTY_ERROR; } if ( nbRow > 1 && nbCol > 1 ) { Scierror(999, _("Wrong size for '%s' property: Must be in the set {%s}.\n"), "z_shift", "0x0, 1xn, nx1"); return SET_PROPERTY_ERROR; } getGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_NUM_ELEMENTS__, jni_int, (void**)&piNumElements); if (piNumElements == NULL) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "z_shift"); return SET_PROPERTY_ERROR; } if ( nbElement != 0 && nbElement != iNumElements) /* we can specify [] (null vector) to reset to default */ { Scierror(999, _("Wrong size for '%s' property: %d or %d elements expected.\n"), "z_shift", 0, iNumElements); return SET_PROPERTY_ERROR; } if ( nbElement != 0 ) { shiftCoordinates = (double*) stk(stackPointer); result = setGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_Z_COORDINATES_SHIFT__, shiftCoordinates, jni_double_vector, iNumElements); /* The FALSE value is used for now to identify a failed memory allocation */ if (result == FALSE) { Scierror(999, _("%s: No more memory.\n"), "set_z_shift_property"); return SET_PROPERTY_ERROR; } } else { /* * Setting the shift flag to 0 directly in the model * when filling the shift coordinates array (0-element case) * would probably be better. */ int shiftSet = 0; setGraphicObjectProperty(pobjUID, __GO_DATA_MODEL_Z_COORDINATES_SHIFT_SET__, &shiftSet, jni_double_vector, 1); } return SET_PROPERTY_SUCCEED; }
static char const* getFigure(scicos_block * block) { signed int figNum; char const* pFigureUID = NULL; char *pAxe = NULL; int i__1 = 1; sco_data *sco = (sco_data *) * (block->work); // assert the sco is not NULL if (sco == NULL) { return NULL; } // fast path for an existing object if (sco->scope.cachedFigureUID != NULL) { return sco->scope.cachedFigureUID; } figNum = block->ipar[0]; // with a negative id, use the block number indexed from a constant. if (figNum < 0) { figNum = 20000 + get_block_number(); } pFigureUID = getFigureFromIndex(figNum); // create on demand if (pFigureUID == NULL) { pFigureUID = createNewFigureWithAxes(); setGraphicObjectProperty(pFigureUID, __GO_ID__, &figNum, jni_int, 1); // the stored uid is a reference to the figure map, not to the current figure pFigureUID = getFigureFromIndex(figNum); sco->scope.cachedFigureUID = pFigureUID; setGraphicObjectProperty(pFigureUID, __GO_COLORMAP__, &block->rpar[2], jni_double_vector, block->ipar[2]); // allocate the axes through the getter pAxe = getAxe(pFigureUID, block); /* * Setup according to block settings */ setLabel(pAxe, __GO_X_AXIS_LABEL__, "x"); setLabel(pAxe, __GO_Y_AXIS_LABEL__, "y"); setGraphicObjectProperty(pAxe, __GO_X_AXIS_VISIBLE__, &i__1, jni_bool, 1); setGraphicObjectProperty(pAxe, __GO_Y_AXIS_VISIBLE__, &i__1, jni_bool, 1); } if (pFigureUID != NULL && sco->scope.cachedFigureUID == NULL) { sco->scope.cachedFigureUID = pFigureUID; } return pFigureUID; }
static BOOL pushData(scicos_block * block, int input, int row) { char const* pFigureUID; char *pAxeUID; char *pPolylineUID; double *data; sco_data *sco; BOOL result = TRUE; pFigureUID = getFigure(block); pAxeUID = getAxe(pFigureUID, block, input); pPolylineUID = getPolyline(pAxeUID, block, input, row); sco = getScoData(block); if (sco == NULL) return FALSE; // select the right input and row data = sco->internal.data[input][row]; result &= setGraphicObjectProperty(pPolylineUID, __GO_DATA_MODEL_X__, sco->internal.time[input], jni_double_vector, sco->internal.maxNumberOfPoints[input]); result &= setGraphicObjectProperty(pPolylineUID, __GO_DATA_MODEL_Y__, data, jni_double_vector, sco->internal.maxNumberOfPoints[input]); return result; }
/**sciSetText * Sets the Text in TEXT, TITLE or LEGEND * @param char * pobjUID: the pointer to the entity * @param char *text[] : the text which has to be put * @param int nbRow : the number of row of the text matrix * @param int nbCol : the number of col of the text matrix * @return 0 if OK, -1 if not */ int sciSetText (char * pobjUID, char ** text, int nbRow, int nbCol) { int dimensions[2]; BOOL status = FALSE; /* Check if we should load LaTex / MathML Java libraries */ loadTextRenderingAPI(text, nbRow, nbCol); dimensions[0] = nbRow; dimensions[1] = nbCol; status = setGraphicObjectProperty(pobjUID, __GO_TEXT_ARRAY_DIMENSIONS__, dimensions, jni_int_vector, 2); if (status != TRUE) { printSetGetErrorMessage("text"); return -1; } status = setGraphicObjectProperty(pobjUID, __GO_TEXT_STRINGS__, text, jni_string_vector, dimensions[0] * dimensions[1]); if (status == TRUE) { return 0; } else { printSetGetErrorMessage("text"); return -1; } }
static BOOL setPolylinesBounds(scicos_block * block, int iAxeUID) { BOOL result; double dataBounds[6]; double rotationAngle[2]; dataBounds[0] = block->rpar[0]; // xMin dataBounds[1] = block->rpar[1]; // xMax dataBounds[2] = block->rpar[2]; // yMin dataBounds[3] = block->rpar[3]; // yMax dataBounds[4] = block->rpar[4]; // zMin dataBounds[5] = block->rpar[5]; // zMax rotationAngle[0] = block->rpar[6]; // alpha rotationAngle[1] = block->rpar[7]; // theta result = setGraphicObjectProperty(iAxeUID, __GO_DATA_BOUNDS__, dataBounds, jni_double_vector, 6); if (result == FALSE) { return result; } result = setGraphicObjectProperty(iAxeUID, __GO_ROTATION_ANGLES__, rotationAngle, jni_double_vector, 2); return result; }
int clearLayoutOptions(int iObjUID) { //reset all constraints data in model int pi[2] = {0, 0}; BOOL status = FALSE; status = setGraphicObjectProperty(iObjUID, __GO_GRID_OPT_GRID__, pi, jni_int_vector, 2); if (status != TRUE) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "layout_options"); return SET_PROPERTY_ERROR; } status = setGraphicObjectProperty(iObjUID, __GO_GRID_OPT_PADDING__, pi, jni_int_vector, 2); if (status != TRUE) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "layout_options"); return SET_PROPERTY_ERROR; } status = setGraphicObjectProperty(iObjUID, __GO_BORDER_OPT_PADDING__, pi, jni_int_vector, 2); if (status != TRUE) { Scierror(999, _("'%s' property does not exist for this handle.\n"), "layout_options"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_SUCCEED; }
static BOOL setPolylinesBounds(scicos_block * block) { char const* pFigureUID; char *pAxeUID; BOOL result; double dataBounds[6]; double rotationAngle[2]; dataBounds[0] = block->rpar[0]; // xMin dataBounds[1] = block->rpar[1]; // xMax dataBounds[2] = block->rpar[2]; // yMin dataBounds[3] = block->rpar[3]; // yMax dataBounds[4] = block->rpar[4]; // zMin dataBounds[5] = block->rpar[5]; // zMax rotationAngle[0] = block->rpar[6]; // alpha rotationAngle[1] = block->rpar[7]; // theta pFigureUID = getFigure(block); pAxeUID = getAxe(pFigureUID, block); result = setGraphicObjectProperty(pAxeUID, __GO_DATA_BOUNDS__, dataBounds, jni_double_vector, 6); result &= setGraphicObjectProperty(pAxeUID, __GO_ROTATION_ANGLES__, rotationAngle, jni_double_vector, 2); return result; }
static BOOL setDefaultValues(scicos_block * block, char *pPlot3dUID) { int m, n, len; int i; double *values; BOOL result; m = GetInPortSize(block, 1, 1); n = GetInPortSize(block, 1, 2); /* * Share the same memory for 0 allocation (z) and incremented index (x and y) */ values = (double *)CALLOC(m * n, sizeof(double)); if (values == NULL) { return FALSE; } result = setGraphicObjectProperty(pPlot3dUID, __GO_DATA_MODEL_Z__, values, jni_double_vector, m * n); len = Max(m, n); for (i = 1; i <= len; i++) { values[i] = (double) i; } result &= setGraphicObjectProperty(pPlot3dUID, __GO_DATA_MODEL_X__, values, jni_double_vector, m); result &= setGraphicObjectProperty(pPlot3dUID, __GO_DATA_MODEL_Y__, values, jni_double_vector, n); FREE(values); return result; }
/*------------------------------------------------------------------------*/ int set_text_box_mode_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol) { BOOL status[2]; int autoSize = 0; int textBoxMode = 0; int status1 = 0; int status2 = 0; if (valueType != sci_strings) { Scierror(999, _("Wrong type for '%s' property: String expected.\n"), "text_box_mode"); return SET_PROPERTY_ERROR; } if (stricmp((char*)_pvData, "off") == 0) { autoSize = 1; textBoxMode = 0; } else if (stricmp((char*)_pvData, "centered") == 0) { autoSize = 1; textBoxMode = 1; } else if (stricmp((char*)_pvData, "filled") == 0) { autoSize = 0; textBoxMode = 2; } else { Scierror(999, _("Wrong value for '%s' property: Must be in the set {%s}.\n"), "text_box_mode", "off, centered, filled"); return SET_PROPERTY_ERROR; } status[0] = setGraphicObjectProperty(iObjUID, __GO_TEXT_BOX_MODE__, &textBoxMode, jni_int, 1); status[1] = setGraphicObjectProperty(iObjUID, __GO_AUTO_DIMENSIONING__, &autoSize, jni_bool, 1); if (status[0] == TRUE) { status1 = SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "text_box_mode"); status1 = SET_PROPERTY_ERROR; } if (status[1] == TRUE) { status2 = SET_PROPERTY_SUCCEED; } else { status2 = SET_PROPERTY_ERROR; } return sciSetFinalStatus((SetPropertyStatus)status1, (SetPropertyStatus)status2); }
static int getGrayplot(int iAxeUID, scicos_block * block) { int iGrayplot; int i__0 = 0; sco_data *sco = (sco_data *) * (block->work); // assert the sco is not NULL if (sco == NULL) { return 0; } // fast path for an existing object if (sco->scope.cachedGrayplotUID) { return sco->scope.cachedGrayplotUID; } iGrayplot = findChildWithKindAt(iAxeUID, __GO_GRAYPLOT__, 0); /* * Allocate if necessary */ if (iGrayplot == 0) { iGrayplot = createGraphicObject(__GO_GRAYPLOT__); if (iGrayplot != 0) { createDataObject(iGrayplot, __GO_GRAYPLOT__); setGraphicObjectRelationship(iAxeUID, iGrayplot); } else { return 0; } } /* * Setup on first access */ setGraphicObjectProperty(iGrayplot, __GO_DATA_MAPPING__, &i__0, jni_int, 1); setBounds(block, iAxeUID, iGrayplot); setDefaultValues(block, iGrayplot); { int iClipState = 1; //on setGraphicObjectProperty(iGrayplot, __GO_CLIP_STATE__, &iClipState, jni_int, 1); } /* * then cache with a local storage */ sco->scope.cachedGrayplotUID = iGrayplot; return sco->scope.cachedGrayplotUID; }
static BOOL setBounds(scicos_block * block, int iAxeUID, int iPlot3dUID) { BOOL result; int gridSize[4]; double dataBounds[6]; double rotationAngle[2]; int m, n; int colormapLen; m = GetInPortSize(block, 1, 1); n = GetInPortSize(block, 1, 2); gridSize[0] = 1; gridSize[1] = m; gridSize[2] = 1; gridSize[3] = n; colormapLen = block->ipar[3]; if (colormapLen == 1) { dataBounds[0] = (double) 0; // xMin dataBounds[1] = (double) m; // xMax dataBounds[2] = (double) 0; // yMin dataBounds[3] = (double) n; // yMax } else { dataBounds[0] = block->rpar[colormapLen + 0]; // xMin dataBounds[1] = block->rpar[colormapLen + 1]; // xMax dataBounds[2] = block->rpar[colormapLen + 2]; // yMin dataBounds[3] = block->rpar[colormapLen + 3]; // yMax } dataBounds[4] = (double)block->ipar[0]; // zMin dataBounds[5] = (double)block->ipar[1]; // zMax rotationAngle[0] = 50; // alpha rotationAngle[1] = 280; // theta result = setGraphicObjectProperty(iPlot3dUID, __GO_DATA_MODEL_GRID_SIZE__, gridSize, jni_int_vector, 4); if (result == FALSE) { return result; } result = setGraphicObjectProperty(iAxeUID, __GO_DATA_BOUNDS__, dataBounds, jni_double_vector, 6); if (result == FALSE) { return result; } result = setGraphicObjectProperty(iAxeUID, __GO_ROTATION_ANGLES__, rotationAngle, jni_double_vector, 2); return result; }
/*------------------------------------------------------------------------*/ int set_color_flag_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { int type = -1; int *piType = &type; int flagcolor = (int) getDoubleFromStack( stackPointer ); if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Real expected.\n"), "color_flag"); return SET_PROPERTY_ERROR; } if ( nbRow * nbCol != 1 ) { Scierror(999, _("Wrong size for '%s' property: Scalar expected.\n"), "color_flag"); return SET_PROPERTY_ERROR; } getGraphicObjectProperty(pobjUID, __GO_TYPE__, jni_int, (void **)&piType); if (type == __GO_PLOT3D__) { if ( flagcolor < 0 || flagcolor > 1 ) { Scierror(999, _("Wrong value for '%s' property: %s or %s expected.\n"), "color_flag", "0", "1"); return SET_PROPERTY_ERROR; } setGraphicObjectProperty(pobjUID, __GO_COLOR_FLAG__, &flagcolor, jni_int, 1); return SET_PROPERTY_SUCCEED; } else if (type == __GO_FAC3D__) { if ( flagcolor < 0 || flagcolor > 4 ) { Scierror(999, _("Wrong value for '%s' property: Must be in the set {%s}.\n"), "color_flag", "0, 1, 2, 3, 4"); return SET_PROPERTY_ERROR; } setGraphicObjectProperty(pobjUID, __GO_COLOR_FLAG__, &flagcolor, jni_int, 1); return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "color_flag"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_SUCCEED; }
/*------------------------------------------------------------------------*/ int set_clip_box_property(void* _pvCtx, char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status[2]; int status1 = 0; int status2 = 0; double* clipBox = NULL; /* 2: on */ int clipState = 2; if ( !( valueType == sci_matrix ) ) { Scierror(999, _("Wrong type for '%s' property: Real matrix expected.\n"), "clip_box"); return SET_PROPERTY_ERROR ; } /* We must have 4 elements */ if ( nbRow * nbCol != 4 ) { Scierror(999, _("Wrong size for '%s' property: %d elements expected.\n"), "clip_box", 4); return SET_PROPERTY_ERROR; } clipBox = stk(stackPointer); status[0] = setGraphicObjectProperty(pobjUID, __GO_CLIP_BOX__, clipBox, jni_double_vector, 4); status[1] = setGraphicObjectProperty(pobjUID, __GO_CLIP_STATE__, &clipState, jni_int, 1); if (status[0] == TRUE) { status1 = SET_PROPERTY_SUCCEED; } else { status1 = SET_PROPERTY_ERROR; Scierror(999, _("'%s' property does not exist for this handle.\n"), "clip_box"); } if (status[1] == TRUE) { status2 = SET_PROPERTY_SUCCEED; } else { status2 = SET_PROPERTY_ERROR; Scierror(999, _("'%s' property does not exist for this handle.\n"), "clip_box"); } return sciSetFinalStatus( (SetPropertyStatus)status1, (SetPropertyStatus)status2 ); }
/*--------------------------------------------------------------------------*/ int sci_xname(char *fname, unsigned long fname_len) { int m1 = 0, n1 = 0, l1 = 0; char *pstCurrentFigure = NULL; CheckRhs(1, 1); CheckLhs(1, 1); GetRhsVar(1, STRING_DATATYPE, &m1, &n1, &l1); pstCurrentFigure = getCurrentFigure(); if (pstCurrentFigure == NULL) { pstCurrentFigure = createNewFigureWithAxes(); } setGraphicObjectProperty(pstCurrentFigure, __GO_NAME__, cstk(l1), jni_string, 1); LhsVar(1) = 0; PutLhsVar(); return 0; }
/*------------------------------------------------------------------------*/ int set_bar_width_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol) { BOOL status = FALSE; double barWidth = 0.; if (valueType != sci_matrix) { Scierror(999, _("Wrong type for '%s' property: Real expected.\n"), "bar_width"); return SET_PROPERTY_ERROR; } barWidth = ((double*)_pvData)[0]; status = setGraphicObjectProperty(iObjUID, __GO_BAR_WIDTH__, &barWidth, jni_double, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "bar_width"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_format_n_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status; char* format; if ( !isParameterStringMatrix( valueType ) ) { Scierror(999, _("Wrong type for '%s' property: String expected.\n"), "format_n"); return SET_PROPERTY_ERROR; } #if 0 if ( sciGetEntityType(pobj) != SCI_AXES ) { Scierror(999, _("'%s' property does not exist for this handle.\n"),"format_n"); return SET_PROPERTY_ERROR; } #endif format = getStringFromStack(stackPointer); status = setGraphicObjectProperty(pobjUID, __GO_FORMATN__, format, jni_string, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"),"format_n"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_handle_visible_property(void* _pvCtx, char* pobjUID, void* _pvData, int valueType, int nbRow, int nbCol) { int b = (int)FALSE; BOOL status = FALSE; b = tryGetBooleanValueFromStack(_pvData, valueType, nbRow, nbCol, "handle_visible"); if (b == NOT_A_BOOLEAN_VALUE) { return SET_PROPERTY_ERROR; } b = 1 - b; /* Handle visible is equivalent to not hidden */ status = setGraphicObjectProperty(pobjUID, __GO_HIDDEN__, &b, jni_bool, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "handle_visible"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_polyline_style_property(void* _pvCtx, char* pobjUID, void* _pvData, int valueType, int nbRow, int nbCol) { BOOL status = FALSE; int value = 0; if (valueType != sci_matrix) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "polyline_style"); return SET_PROPERTY_ERROR; } value = (int) ((double*)_pvData)[0]; if (value < 1 || value > 7) { Scierror(999, _("Wrong value for '%s' property: Must be between %d and %d.\n"), "polyline_style", 1, 7); return SET_PROPERTY_ERROR; } status = setGraphicObjectProperty(pobjUID, __GO_POLYLINE_STYLE__, &value, jni_int, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "polyline_style"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_axes_bounds_property(void* _pvCtx, char* pobjUID, void* _pvData, int valueType, int nbRow, int nbCol) { BOOL status = FALSE; if (valueType != sci_matrix) { Scierror(999, _("Wrong type for '%s' property: Real matrix expected.\n"), "axes_bounds"); return SET_PROPERTY_ERROR; } if (nbRow * nbCol != 4) { Scierror(999, _("Wrong size for '%s' property: %d elements expected.\n"), "axes_bounds", 4); return SET_PROPERTY_ERROR; } status = setGraphicObjectProperty(pobjUID, __GO_AXES_BOUNDS__, _pvData, jni_double_vector, 4); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "axes_bounds"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_figure_id_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol) { int id = 0; BOOL status = FALSE; if (valueType != sci_matrix) { Scierror(999, _("Wrong type for '%s' property: Integer expected.\n"), "figure_id"); return SET_PROPERTY_ERROR; } id = (int) ((double*)_pvData)[0]; status = setGraphicObjectProperty(iObjUID, __GO_ID__, &id, jni_int, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "figure_id"); return SET_PROPERTY_ERROR; } return SET_PROPERTY_ERROR; }
/*------------------------------------------------------------------------*/ int set_auto_rotation_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { BOOL status; int b = (int)FALSE; #if 0 if ( sciGetEntityType(pobj) != SCI_LABEL ) { Scierror(999, _("'%s' property does not exist for this handle.\n"),"auto_rotation"); return SET_PROPERTY_ERROR ; } #endif b = tryGetBooleanValueFromStack(stackPointer, valueType, nbRow, nbCol, "auto_rotation"); if(b == NOT_A_BOOLEAN_VALUE) { return SET_PROPERTY_ERROR; } status = setGraphicObjectProperty(pobjUID, __GO_AUTO_ROTATION__, &b, jni_bool, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"),"auto_rotation"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_color_map_property(void* _pvCtx, char* pobjUID, void* _pvData, int valueType, int nbRow, int nbCol) { BOOL status = FALSE; if (valueType != sci_matrix) { Scierror(999, _("Wrong type for '%s' property: Real matrix expected.\n"), "color_map"); return SET_PROPERTY_ERROR; } if (nbCol != 3) { Scierror(999, _("Wrong dimension for '%s' property: The number of columns must be 3.\n"), "color_map"); return SET_PROPERTY_ERROR ; } status = setGraphicObjectProperty(pobjUID, __GO_COLORMAP__, _pvData, jni_double_vector, nbRow * nbCol); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "color_map"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_arrow_size_factor_property(void* _pvCtx, char* pobjUID, void* _pvData, int valueType, int nbRow, int nbCol) { BOOL status = FALSE; double arrowSizeFactor = 0.; if (valueType != sci_matrix) { Scierror(999, _("Wrong type for '%s' property: Real expected.\n"), "arrow_size_factor"); return SET_PROPERTY_ERROR; } arrowSizeFactor = ((double*)_pvData)[0]; status = setGraphicObjectProperty(pobjUID, __GO_ARROW_SIZE_FACTOR__, &arrowSizeFactor, jni_double, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "arrow_size_factor"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_tag_property(char* pobjUID, size_t stackPointer, int valueType, int nbRow, int nbCol ) { // Tag must be only one character string BOOL status = FALSE; if (valueType != sci_strings) { Scierror(999, _("Wrong type for '%s' property: A string expected.\n"), "Tag"); return SET_PROPERTY_ERROR; } if (nbCol != 1) { Scierror(999, _("Wrong size for '%s' property: A string expected.\n"), "Tag"); return SET_PROPERTY_ERROR; } status = setGraphicObjectProperty(pobjUID, __GO_TAG__, getStringFromStack(stackPointer), jni_string, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "Tag"); return SET_PROPERTY_ERROR; } }
/*------------------------------------------------------------------------*/ int set_labels_font_size_property(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol) { BOOL status = FALSE; double fontSize = 0.; if (valueType != sci_matrix) { Scierror(999, _("Wrong type for '%s' property: Real expected.\n"), "labels_font_size"); return SET_PROPERTY_ERROR; } fontSize = ((double*)_pvData)[0]; status = setGraphicObjectProperty(iObjUID, __GO_FONT_SIZE__, &fontSize, jni_double, 1); if (status == TRUE) { return SET_PROPERTY_SUCCEED; } else { Scierror(999, _("'%s' property does not exist for this handle.\n"), "labels_font_size"); return SET_PROPERTY_ERROR; } }