/*----------------------------------------------------------- * Objsegs : *-----------------------------------------------------------*/ void Objsegs (int * style, int flag , int n1 , double * x , double * y , double * z , double arsize) { int iObjUID = 0; int iSubwinUID = 0; int type = 0, colored = 0; double *fx = NULL, *fy = NULL; // No fx or fy int typeofchamp = -1; /* no champ here, only segs ; this info is useless */ double rect[6]; checkRedrawing(); iSubwinUID = getCurrentSubWin(); if (n1) { MiniMaxi(x, n1, rect, rect + 1); MiniMaxi(y, n1, rect + 2, rect + 3); if (z) { MiniMaxi(z, n1, rect + 4, rect + 5); updateXYZDataBounds(iSubwinUID, rect); } else { updateXYDataBounds(iSubwinUID, rect); } } iObjUID = createSegs(iSubwinUID, x, n1, y, n1, z, (z == NULL ? 0 : n1), style, flag == 0 ? 1 : n1, arsize); if (iObjUID == NULL) { Scierror(999, _("%s: No more memory.\n"), "Objsegs"); return; } setCurrentObject(iObjUID); }
void Objpoly (double * x , double * y , int n , int closed, int mark , long * hdl) { int iSubwinUID = 0; int iObjUID = 0; double rect[6]; iSubwinUID = getCurrentSubWin(); checkRedrawing(); if (n) { MiniMaxi(x, n, rect, rect + 1); MiniMaxi(y, n, rect + 2, rect + 3); updateXYDataBounds(iSubwinUID, rect); } if (mark <= 0) { int absmark = abs(mark); iObjUID = ConstructPolyline(iSubwinUID, x, y, PD0, closed, n, 1, NULL, NULL, &absmark, NULL, NULL, FALSE, FALSE, TRUE, FALSE); } else { iObjUID = ConstructPolyline(iSubwinUID, x, y, PD0, closed, n, 1, &mark, NULL, NULL, NULL, NULL, TRUE, FALSE, FALSE, FALSE); } if (iObjUID == NULL) { Scierror(999, _("%s: No more memory.\n"), "Objpoly"); return; } setCurrentObject(iObjUID); *hdl = getHandle(iObjUID); }
/* Given two set of coordinates x and y this routine computes the corresponding * data bounds rectangle drect=[xmin,ymin,xmax,ymax] taking into account the logflag * -> means we have to find among the data the min > 0. */ void compute_data_bounds2(int cflag, char dataflag, char *logflags, double *x, double *y, int n1, int n2, double *drect) { int size_x = 0, size_y = 0; double xd[2]; double *x1 = NULL; switch (dataflag) { case 'e': xd[0] = 1.0; xd[1] = (double)n2; x1 = xd; size_x = (n2 != 0) ? 2 : 0; break; case 'o': x1 = x; size_x = n2; break; case 'g': default: x1 = x; size_x = (cflag == 1) ? n1 : (n1 * n2); break; } if (size_x != 0) { if (logflags[0] != 'l') { MiniMaxi(x1, size_x, drect, drect + 1); //drect[0] = Mini(x1, size_x); //drect[1] = Maxi(x1, size_x); } else { /* log. case */ drect[0] = sciFindStPosMin(x1, size_x); drect[1] = Maxi(x1, size_x); } } else { if (logflags[0] != 'l') { drect[0] = 0.0; drect[1] = 10.0; } else { /* log. case */ drect[0] = 1.0; drect[1] = 10.0; } } size_y = (cflag == 1) ? n2 : (n1 * n2); if (size_y != 0) { if (logflags[1] != 'l') { MiniMaxi(y, size_y, drect + 2, drect + 3); //drect[2] = Mini(y, size_y); //drect[3] = Maxi(y, size_y); } else { /* log. case */ drect[2] = sciFindStPosMin(y, size_y); drect[3] = Maxi(y, size_y); } } else { if (logflags[1] != 'l') { drect[2] = 0.0; drect[3] = 10.0; } else { /* log. case */ drect[2] = 1.0; drect[3] = 10.0; } } /* back to default values for x=[] and y = [] */ if (drect[2] == LARGEST_REAL || drect[3] == -LARGEST_REAL || C2F(isanan)(&drect[2]) || C2F(isanan)(&drect[3])) { if (logflags[1] != 'l') { drect[2] = 0.0; } else { drect[2] = 1.0; } drect[3] = 10.0; } if (drect[0] == LARGEST_REAL || drect[1] == -LARGEST_REAL || C2F(isanan)(&drect[0]) || C2F(isanan)(&drect[1])) { if (logflags[0] != 'l') { drect[0] = 0.0; } else { drect[0] = 1.0; } drect[1] = 10.0; } }
void Objfpoly (double * x , double * y , int n , int * style, long * hdl , int shading) { int iSubwinUID = 0; int iObjUID = 0; int fillcolor = 0; int contourcolor = 0; int *piContourColor = &contourcolor; int closed = 1; /* we close the polyline by default */ double rect[6]; iSubwinUID = getOrCreateDefaultSubwin(); checkRedrawing(); if (n) { MiniMaxi(x, n, rect, rect + 1); MiniMaxi(y, n, rect + 2, rect + 3); updateXYDataBounds(iSubwinUID, rect); } if (shading == 2) { /* interpolated shading is "on" */ iObjUID = ConstructPolyline(iSubwinUID, x, y, PD0, closed, n, 1, NULL, style, NULL, NULL, NULL, FALSE, TRUE, FALSE, TRUE); } else { /* flat mode is "on" */ if (*style < 0) { fillcolor = abs(*style); iObjUID = ConstructPolyline(iSubwinUID, x, y, PD0, closed, n, 1, NULL, &fillcolor, NULL, NULL, NULL, FALSE, TRUE, FALSE, FALSE); } else if (*style == 0) { getGraphicObjectProperty(iSubwinUID, __GO_LINE_COLOR__, jni_int, (void**)&piContourColor); iObjUID = ConstructPolyline(iSubwinUID, x, y, PD0, closed, n, 1, &contourcolor, NULL, NULL, NULL, NULL, TRUE, FALSE, FALSE, FALSE); } else { /* *style > 0*/ fillcolor = *style; getGraphicObjectProperty(iSubwinUID, __GO_LINE_COLOR__, jni_int, (void**)&piContourColor); iObjUID = ConstructPolyline(iSubwinUID, x, y, PD0, closed, n, 1, &contourcolor, &fillcolor, NULL, NULL, NULL, TRUE, TRUE, FALSE, FALSE); } } if (iObjUID == NULL) { Scierror(999, _("%s: No more memory.\n"), "Objfpoly"); return; } setCurrentObject(iObjUID); *hdl = getHandle(iObjUID); }