sciGraphics::BarDecomposition Class Reference

#include </home/scilab/compilation_chain/sci_checkOut/scilab/modules/renderer/src/cpp/polylineDrawing/BarDecomposition.hxx>

Inheritance diagram for sciGraphics::BarDecomposition:

Inheritance graph
[legend]
Collaboration diagram for sciGraphics::BarDecomposition:

Collaboration graph
[legend]

Public Member Functions

 BarDecomposition (DrawablePolyline *polyline)
virtual ~BarDecomposition (void)
virtual void getDrawnVertices (double xCoords[], double yCoords[], double zCoords[])
virtual void getDrawnVerticesColor (int colors[])
virtual int getDrawnVerticesLength (void)
void getBarOrdinates (double bottom[], double top[])
void getBarAbscissas (double left[], double right[])
void getBarPlotMarkVertices (double xCoords[], double yCoords[], double zCoords[])
int getBarPlotMarkVerticesLength (void)

Protected Member Functions

void getBarLinearOrdinates (double bottom[], double top[])
void getBarLinearAbscissas (double left[], double right[])

Protected Attributes

LinearBarDecompositionm_pExtentComputer

Detailed Description

Definition at line 23 of file BarDecomposition.hxx.


Constructor & Destructor Documentation

sciGraphics::BarDecomposition::BarDecomposition ( DrawablePolyline polyline  ) 

Definition at line 28 of file BarDecomposition.cpp.

References sciGraphics::DrawableObject::getDrawedObject(), m_pExtentComputer, and sciGetPolylineStyle().

00029   : DecomposeLineStrategy(polyline)
00030 {
00031   sciPointObj * pPolyline = polyline->getDrawedObject();
00032   if (sciGetPolylineStyle(pPolyline) == 7)
00033   {
00034     m_pExtentComputer = new HorizontalBarDecomposition(this);
00035   }
00036   else
00037   {
00038     m_pExtentComputer = new VerticalBarDecomposition(this);
00039   }
00040 }

Here is the call graph for this function:

sciGraphics::BarDecomposition::~BarDecomposition ( void   )  [virtual]

Definition at line 42 of file BarDecomposition.cpp.

References m_pExtentComputer, and NULL.

00043 {
00044   delete m_pExtentComputer;
00045   m_pExtentComputer = NULL;
00046 }


Member Function Documentation

void sciGraphics::BarDecomposition::getDrawnVertices ( double  xCoords[],
double  yCoords[],
double  zCoords[] 
) [virtual]

Retrieve the vertices of the polyline which will be used to draw it directly. In the polyline sciPointObj, x, y and z vectors does not always stands for the real vertices of the drawn line (specially when staircase mode is on). To allocate the array for retrieving vertices, user should use the getDrawnVerticesLength.

Parameters:
xCoords X coordinates of the drawn vertices
yCoords Y coordinates of the drawn vertices
zCoords Z coordinates of the drawn vertices

Implements sciGraphics::DecomposeLineStrategy.

Definition at line 48 of file BarDecomposition.cpp.

References doubleArrayCopy(), sciGraphics::DrawableObject::getDrawedObject(), getDrawnVerticesLength(), i, sciGraphics::DecomposeLineStrategy::m_pDrawed, NULL, sciGraphics::DrawableObject::pointScale(), pPOLYLINE_FEATURE, sciGetNbPoints(), and setDoubleArraySingleValue().

Referenced by sciGraphics::PolylineBarDrawerJoGL::drawPolyline(), and getBarPlotMarkVertices().

00049 {
00050   sciPointObj * pPolyline = m_pDrawed->getDrawedObject();
00051   int nbVertices = sciGetNbPoints(m_pDrawed->getDrawedObject());
00052   double * xPoints = pPOLYLINE_FEATURE(pPolyline)->pvx;
00053   double * yPoints = pPOLYLINE_FEATURE(pPolyline)->pvy;
00054   double * zPoints = pPOLYLINE_FEATURE(pPolyline)->pvz;
00055   double * xShift = pPOLYLINE_FEATURE(pPolyline)->x_shift;
00056   double * yShift = pPOLYLINE_FEATURE(pPolyline)->y_shift;
00057   double * zShift = pPOLYLINE_FEATURE(pPolyline)->z_shift;
00058 
00059   if (xCoords != NULL)
00060   {
00061     doubleArrayCopy(xCoords, xPoints, nbVertices);
00062     if (xShift != NULL)
00063     {
00064       for(int i = 0; i < nbVertices; i++)
00065       {
00066         xCoords[i] += xShift[i];
00067       }
00068     }
00069   }
00070   
00071 
00072   if (yCoords != NULL)
00073   {
00074     doubleArrayCopy(yCoords, yPoints, nbVertices);
00075     if (yShift != NULL)
00076     {
00077       for(int i = 0; i < nbVertices; i++)
00078       {
00079         yCoords[i] += yShift[i];
00080       }
00081     }
00082   }
00083   
00084   if (zCoords != NULL)
00085   {
00086     if ( zPoints == NULL )
00087     {
00088       setDoubleArraySingleValue(zCoords, 0.0, nbVertices);
00089     }
00090     else
00091     {
00092       doubleArrayCopy(zCoords, zPoints, nbVertices);
00093     }
00094 
00095     if (zShift != NULL)
00096     {
00097       for(int i = 0; i < nbVertices; i++)
00098       {
00099         zCoords[i] += zShift[i];
00100       }
00101     }
00102   }
00103   
00104 
00105   // apply logarithmic mode if needed
00106   m_pDrawed->pointScale(xCoords, yCoords, zCoords, getDrawnVerticesLength());
00107   
00108 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciGraphics::BarDecomposition::getDrawnVerticesColor ( int  colors[]  )  [virtual]

Retrieve the colors to use for each vertex. To be used for color interpolation. The size of the array must be retrieved by getDrawnVerticesLength().

Parameters:
colors color inddex of the draw vertices

Implements sciGraphics::DecomposeLineStrategy.

Definition at line 110 of file BarDecomposition.cpp.

References getDrawnVerticesLength(), and i.

00111 {
00112   // unused for now
00113   for(int i = 0; i < getDrawnVerticesLength(); i++)
00114   {
00115     colors[i] = 0;
00116   }
00117 }

Here is the call graph for this function:

int sciGraphics::BarDecomposition::getDrawnVerticesLength ( void   )  [virtual]

void sciGraphics::BarDecomposition::getBarOrdinates ( double  bottom[],
double  top[] 
)

Get the top and bottom ordinates of each bar to draw.

Parameters:
top array containing top abscissa of the bars. Its size is getDrawnVerticesLength().
bottom array containing the bottom abscissa of the bars. Its size is getDrawnVerticesLength().

Definition at line 125 of file BarDecomposition.cpp.

References getBarLinearOrdinates(), getDrawnVerticesLength(), sciGraphics::DecomposeLineStrategy::m_pDrawed, NULL, and sciGraphics::DrawableObject::pointScale().

Referenced by sciGraphics::PolylineBarDrawerJoGL::drawPolyline().

00126 {
00127 
00128   int nbVertices = getDrawnVerticesLength();
00129   getBarLinearOrdinates(bottom, top);
00130 
00131   m_pDrawed->pointScale(NULL, bottom, NULL, nbVertices);
00132   m_pDrawed->pointScale(NULL, top, NULL, nbVertices);
00133 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciGraphics::BarDecomposition::getBarAbscissas ( double  left[],
double  right[] 
)

Get the left and right abscissas of each bar to draw.

Parameters:
left array containing left abscissa of the bars. Its size is getDrawnVerticesLength().
right array containing the right abscissa of the bars. Its size is getDrawnVerticesLength().

Definition at line 135 of file BarDecomposition.cpp.

References getBarLinearAbscissas(), getDrawnVerticesLength(), sciGraphics::DecomposeLineStrategy::m_pDrawed, NULL, and sciGraphics::DrawableObject::pointScale().

Referenced by sciGraphics::PolylineBarDrawerJoGL::drawPolyline().

00136 {
00137   // apply log scale if needed
00138   int nbVertices = getDrawnVerticesLength();
00139   getBarLinearAbscissas(left, right);
00140 
00141   m_pDrawed->pointScale(left, NULL, NULL, nbVertices);
00142   m_pDrawed->pointScale(right, NULL, NULL, nbVertices);
00143 
00144 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciGraphics::BarDecomposition::getBarPlotMarkVertices ( double  xCoords[],
double  yCoords[],
double  zCoords[] 
)

Bar plot mode (ie polyline_style = 3), also draws mark on y = 0 line.

Definition at line 146 of file BarDecomposition.cpp.

References sciGraphics::DrawableObject::getDrawedObject(), getDrawnVertices(), getDrawnVerticesLength(), i, sciGraphics::DecomposeLineStrategy::m_pDrawed, and sciGetLogFlags().

Referenced by sciGraphics::PolylineMarkDrawerJoGL::drawPolyline().

00147 {
00148   // first half
00149   getDrawnVertices(xCoords, yCoords, zCoords);
00150 
00151   int semiSize = getDrawnVerticesLength();
00152 
00153   // second half
00154   sciPointObj * pPolyline = m_pDrawed->getDrawedObject();
00155   
00156   // special case for with logarithmic mode
00157   // bars starts at y = 1 = 10^0 and not 0 which is not displayable
00158   char logFlags[3];
00159   sciGetLogFlags(pPolyline, logFlags);
00160   if (logFlags[1] == 'l')
00161   {
00162     for (int i = 0; i < semiSize ; i++)
00163     {
00164       xCoords[i + semiSize] = xCoords[i];
00165       yCoords[i + semiSize] = 1.0;
00166       zCoords[i + semiSize] = zCoords[i];
00167     }
00168   }
00169   else
00170   {
00171     for (int i = 0; i < semiSize ; i++)
00172     {
00173       xCoords[i + semiSize] = xCoords[i];
00174       yCoords[i + semiSize] = 0.0;
00175       zCoords[i + semiSize] = zCoords[i];
00176     }
00177   }
00178   
00179 }

Here is the call graph for this function:

Here is the caller graph for this function:

int sciGraphics::BarDecomposition::getBarPlotMarkVerticesLength ( void   ) 

Returns:
number of vertices for bar plot drawing of marks

Definition at line 181 of file BarDecomposition.cpp.

References getDrawnVerticesLength().

Referenced by sciGraphics::PolylineMarkDrawerJoGL::drawPolyline().

00182 {
00183   return 2 * getDrawnVerticesLength();
00184 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciGraphics::BarDecomposition::getBarLinearOrdinates ( double  bottom[],
double  top[] 
) [protected]

Get the top and bottom ordinates of each bar in linear coordinates.

Definition at line 186 of file BarDecomposition.cpp.

References sciGraphics::LinearBarDecomposition::getBarOrdinates(), and m_pExtentComputer.

Referenced by getBarOrdinates().

00187 {
00188   m_pExtentComputer->getBarOrdinates(bottom, top);
00189 }

Here is the call graph for this function:

Here is the caller graph for this function:

void sciGraphics::BarDecomposition::getBarLinearAbscissas ( double  left[],
double  right[] 
) [protected]

Get the left and right abscissas of each bar in linear coordinates.

Definition at line 191 of file BarDecomposition.cpp.

References sciGraphics::LinearBarDecomposition::getBarAbscissas(), and m_pExtentComputer.

Referenced by getBarAbscissas().

00192 {
00193   m_pExtentComputer->getBarAbscissas(left, right);
00194 }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation


The documentation for this class was generated from the following files:

Generated on Tue Sep 9 18:34:22 2008 for Scilab [trunk] by  doxygen 1.5.5