Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

xymk.cpp

Go to the documentation of this file.
00001 /*****************************************************************************/
00002 /* Módulo: xymk.cpp                                                          */
00003 /* Autores: Carlos Henrique Levy e Jaudênia Cavalcante                       */
00004 /* Data: 29 jul 97                                                           */
00005 /* Comentário:                                                               */
00006 /*    Implementação de métodos da classe que marca uma determinada posição   */
00007 /* sobre a graduação de um eixo com um traço perpendicular a esse eixo, co-  */
00008 /* meçando nele e atravessando toda a área útil de um gráfico.               */
00009 /*****************************************************************************/
00010 
00011 #include "xymk.h"
00012 
00013 const char* xy_id_xymk_cpp="$Id: xymk.cpp,v 1.8 1999/12/09 21:47:46 rborges Exp $";
00014                                                                 
00015 XYMarker::XYMarker (const XYAxis* axis,
00016                     double pos,
00017                     long color,                 
00018                     int width,          
00019                     LineStyle style,
00020                     xybool visible)     
00021                          : XYObject(0, 0, visible),
00022                            _axis(axis),
00023                            _pos(pos),
00024                            _color(color),
00025                            _width(width),
00026                            _style(style)
00027 {
00028    double xb, yb;
00029    _axis -> pointInValue(_pos, xb, yb);
00030 
00031    position(xb, yb);
00032 }
00033 
00034 void XYMarker::axis (const XYAxis* ax)
00035 {
00036    _axis = ax;
00037 }
00038 
00039 const XYAxis* XYMarker::axis (void) const
00040 {
00041    return _axis;
00042 }
00043 
00044 void XYMarker::pos (double ps)
00045 {
00046    _pos = ps;
00047 }
00048 
00049 double XYMarker::pos (void) const
00050 {
00051    return _pos;
00052 }
00053 
00054 void XYMarker::color (long c)
00055 {
00056    _color = c;
00057 }
00058 
00059 long XYMarker::color (void) const
00060 {
00061    return _color;
00062 }
00063 
00064 void XYMarker::width (int w)
00065 {
00066    _width = w;
00067 }
00068 
00069 int XYMarker::width (void) const
00070 {
00071    return _width;
00072 }
00073 
00074 void XYMarker::style (XYObject::LineStyle st)
00075 {
00076    _style = st;
00077 }
00078 
00079 int XYMarker::style (void) const
00080 {
00081    return _style;
00082 }
00083 
00084 void XYMarker::limit (double h)
00085 {
00086    _limit = h;
00087 }
00088 
00089 double XYMarker::limit (void) const
00090 {
00091    return _limit;
00092 }
00093 
00094 void XYMarker::scaleValue(double x1, double y1, double* pos)
00095 {
00096    const XYAxis* acont = axis();
00097 
00098    // (x0, y0) ponto inferior esquerdo em relação ao canvas
00099    double x0, y0;
00100    acont -> position (&x0, &y0);
00101 
00102    double f;
00103 
00104    // posição normalizada em relação ao canvas
00105    if (acont -> rotation() == 0.0)
00106       f = x1 - x0;
00107    else
00108       f = y1 - y0;
00109 
00110    // posição de referência sobre o eixo considerado
00111    *pos = f * (acont -> max() - acont -> min())
00112             / acont -> size() + acont -> min();
00113 }
00114 
00115 //* Acao realizado quando da insercao de uma mascara no grafico
00116 void XYMarker::insertAction (XYGraph * /* graph */)
00117 {
00118 }
00119 
00120 //* Acao realizado quando da romcao de uma mascara no grafico
00121 void XYMarker::removeAction (XYGraph * /* graph */)
00122 {
00123 }

XY
Tecgraf / PUC-Rio - Computer Graphics Technology Group