PLplot 5.9.6
pldeprecated.c
00001 /* $Id$
00002  *
00003  *  Copyright (C) 2005  Alan W. Irwin
00004  *
00005  *  This file is part of PLplot.
00006  *
00007  *  PLplot is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU Library General Public License as published
00009  *  by the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  PLplot is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU Library General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU Library General Public License
00018  *  along with PLplot; if not, write to the Free Software
00019  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  *
00021  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00022  *
00023  *  This file contains deprecated routines to provide backwards compatibility
00024  *  for a while.  For each routine the new routine you should be using instead
00025  *  is explicitly commented.
00026  */
00027 
00028 #define NEED_PLDEBUG
00029 #include "plplotP.h"
00030 
00031 /*--------------------------------------------------------------------------*\
00032  * Use plparseopts instead.
00033  \*--------------------------------------------------------------------------*/
00034 int
00035 plParseOpts( int *p_argc, const char **argv, PLINT mode )
00036 {
00037     plwarn( "plParseOpts: function deprecated. Use plparseopts instead" );
00038     return c_plparseopts( p_argc, argv, mode );
00039 }
00040 
00041 
00042 /*--------------------------------------------------------------------------*\
00043  * Use plhlsrgb instead.
00044  \*--------------------------------------------------------------------------*/
00045 void
00046 plHLS_RGB( PLFLT h, PLFLT l, PLFLT s, PLFLT *p_r, PLFLT *p_g, PLFLT *p_b )
00047 {
00048     plwarn( "plHLS_RGB: function deprecated. Use plhlsrgb instead" );
00049     c_plhlsrgb( h, l, s, p_r, p_g, p_b );
00050 }
00051 
00052 /*--------------------------------------------------------------------------*\
00053  * Use plrgbhls instead.
00054  \*--------------------------------------------------------------------------*/
00055 void
00056 plRGB_HLS( PLFLT r, PLFLT g, PLFLT b, PLFLT *p_h, PLFLT *p_l, PLFLT *p_s )
00057 {
00058     plwarn( "plRGB_HLS: function deprecated. Use plrgbhls instead" );
00059     c_plrgbhls( r, g, b, p_h, p_l, p_s );
00060 }
00061 
00062 /*--------------------------------------------------------------------------*\
00063  * Use plvect / plsvect instead.
00064  * void plarrows()
00065  *
00066  * simple arrow plotter
00067  * copyright 1993 Wesley Ebisuzaki
00068  *
00069  * an arrow is defined by its location (x, y) and its direction (u, v)
00070  *
00071  * inputs:
00072  *   u[i], v[i]      arrow's horizontal and vertical projection
00073  *   x[i], y[i]      arrow's location (world coordinates)
00074  *   n               number of arrows to draw
00075  *   scale           > 0  scaling factor for arrows
00076  *                   0    default scaling factor
00077  *                   < 0  default scaling factor * (-scale)
00078  *   dx, dy          distance between arrows
00079  *                   used when calculating the default arrow scaling
00080  *                   so that arrows don't overlap
00081  *
00082  \*--------------------------------------------------------------------------*/
00083 
00084 #define SCALE0    2.0
00085 
00086 /* definition of original arrow: 2 line segments */
00087 
00088 static PLFLT arrow_x[4] = { 0.5, -0.5, -0.27, -0.5 };
00089 static PLFLT arrow_y[4] = { 0.0, 0.0, 0.0, 0.20 };
00090 
00091 void
00092 plarrows( PLFLT *u, PLFLT *v, PLFLT *x, PLFLT *y, PLINT n,
00093           PLFLT scale, PLFLT dx, PLFLT dy )
00094 {
00095     PLFLT  uu, vv;
00096     PLINT  i, j, npts = 4;
00097     PLINT  px0, py0, dpx, dpy;
00098     PLINT  a_x[4], a_y[4];
00099     PLFLT  max_u, max_v;
00100     double t;
00101 
00102     plwarn( "plarrows: function deprecated. Use plvect instead" );
00103 
00104     if ( n <= 0 )
00105         return;
00106 
00107     if ( scale <= 0.0 )
00108     {
00109         /* automatic scaling */
00110         /* find max / min values of data */
00111 
00112         max_u = u[0];
00113         max_v = v[0];
00114         for ( i = 1; i < n; i++ )
00115         {
00116             t     = fabs( (double) u[i] );
00117             max_u = t > max_u ? t : max_u;
00118             t     = fabs( (double) v[i] );
00119             max_v = t > max_v ? t : max_v;
00120         }
00121 
00122         /* measure distance in grid boxs */
00123 
00124         max_u = max_u / fabs( (double) dx );
00125         max_v = max_v / fabs( (double) dy );
00126 
00127         t = ( max_u > max_v ? max_u : max_v );
00128         t = SCALE0 / t;
00129         if ( scale < 0 )
00130         {
00131             scale = -scale * t;
00132         }
00133         else
00134         {
00135             scale = t;
00136         }
00137     }
00138     pldebug( "plarrows", "scale factor=%lf n=%d\n", scale, n );
00139 
00140     for ( i = 0; i < n; i++ )
00141     {
00142         uu = scale * u[i];
00143         vv = scale * v[i];
00144         if ( uu == 0.0 && uu == 0.0 )
00145             continue;
00146 
00147         /* conversion to physical coordinates */
00148 
00149         px0 = plP_wcpcx( x[i] );
00150         py0 = plP_wcpcy( y[i] );
00151 
00152         pldebug( "plarrows", "%f %f %d %d\n", x[i], y[i], px0, py0 );
00153 
00154         dpx = plP_wcpcx( x[i] + 0.5 * uu ) - px0;
00155         dpy = plP_wcpcy( y[i] + 0.5 * vv ) - py0;
00156 
00157         /* transform arrow -> a */
00158 
00159         for ( j = 0; j < npts; j++ )
00160         {
00161             a_x[j] = (PLINT) ( arrow_x[j] * dpx -
00162                                arrow_y[j] * dpy + px0 );
00163             a_y[j] = (PLINT) ( arrow_x[j] * dpy +
00164                                arrow_y[j] * dpx + py0 );
00165         }
00166 
00167         /* draw the arrow */
00168         plP_movphy( a_x[0], a_y[0] );
00169         plP_draphy( a_x[1], a_y[1] );
00170         plP_movphy( a_x[2], a_y[2] );
00171         plP_draphy( a_x[3], a_y[3] );
00172     }
00173 }
00174 
 All Data Structures Files Functions