#include </home/scilab/compilation_chain/sci_checkOut/scilab/modules/renderer/src/cpp/subwinDrawing/AutomaticTicksComputer.hxx>


Public Member Functions | |
| AutomaticTicksComputer (DrawableSubwin *subwin) | |
| virtual | ~AutomaticTicksComputer (void) |
| virtual void | reinit (void) |
| virtual int | getNbTicks (void) |
| virtual void | getTicksPosition (double positions[], char *labels[], char *labelsExponents[]) |
| virtual void | reduceTicksNumber (void) |
| virtual bool | needTicksDecimation (void) |
| virtual void | setAxisBounds (double min, double max) |
| virtual bool | isDisplayingLabelsExponents (void) |
Protected Attributes | |
| int | m_iNbTicks |
| double | m_dMinBounds |
| double | m_dMaxBounds |
Definition at line 22 of file AutomaticTicksComputer.hxx.
| sciGraphics::AutomaticTicksComputer::AutomaticTicksComputer | ( | DrawableSubwin * | subwin | ) |
Definition at line 29 of file AutomaticTicksComputer.cpp.
References m_dMinBounds, and m_iNbTicks.
00030 : ComputeTicksStrategy(subwin) 00031 { 00032 m_dMinBounds = 0.0; 00033 m_dMinBounds = 0.0; 00034 m_iNbTicks = -1; /* ie unitialized */ 00035 }
| sciGraphics::AutomaticTicksComputer::~AutomaticTicksComputer | ( | void | ) | [virtual] |
| void sciGraphics::AutomaticTicksComputer::reinit | ( | void | ) | [virtual] |
Reinitialize ticks computer data.
Implements sciGraphics::ComputeTicksStrategy.
Definition at line 42 of file AutomaticTicksComputer.cpp.
References m_iNbTicks.
00043 { 00044 m_iNbTicks = -1; 00045 }
| int sciGraphics::AutomaticTicksComputer::getNbTicks | ( | void | ) | [virtual] |
Get the number of ticks which will be computed by the strategy.
Implements sciGraphics::ComputeTicksStrategy.
Reimplemented in sciGraphics::AutoLogTicksComputer.
Definition at line 47 of file AutomaticTicksComputer.cpp.
References FALSE, m_dMaxBounds, m_dMinBounds, m_iNbTicks, TheTicks(), and ticks.
Referenced by getTicksPosition().
00048 { 00049 00050 if (m_iNbTicks < 0) 00051 { 00052 double ticks[20]; 00053 TheTicks(&m_dMinBounds, &m_dMaxBounds, ticks, &m_iNbTicks, FALSE); 00054 } 00055 return m_iNbTicks; 00056 }


| void sciGraphics::AutomaticTicksComputer::getTicksPosition | ( | double | positions[], | |
| char * | labels[], | |||
| char * | labelsExponents[] | |||
| ) | [virtual] |
Fill positions parameters with the ticks abscissas, ordinate, ...
Implements sciGraphics::ComputeTicksStrategy.
Reimplemented in sciGraphics::AutoLogTicksComputer.
Definition at line 58 of file AutomaticTicksComputer.cpp.
References buffer, sciGraphics::BUFFER_LENGTH, ChoixFormatE(), getNbTicks(), i, m_dMaxBounds, m_dMinBounds, m_iNbTicks, Max, NULL, TheTicks(), and TRUE.
00059 { 00060 if (m_iNbTicks < 0) 00061 { 00062 getNbTicks(); 00063 } 00064 00065 // Number of ticks has already been computed. 00066 TheTicks(&m_dMinBounds, &m_dMaxBounds, positions, &m_iNbTicks, TRUE); 00067 00068 // now convert ticks positions in strings for labels 00069 // find ticks format 00070 char labelsFormat[5]; 00071 int lastIndex = Max( m_iNbTicks - 1, 0 ) ; 00072 00073 ChoixFormatE( labelsFormat, 00074 positions[0], 00075 positions[lastIndex], 00076 (positions[lastIndex] - positions[0]) / lastIndex ); /* Adding F.Leray 06.05.04 */ 00077 00078 char buffer[BUFFER_LENGTH]; 00079 for (int i = 0; i < m_iNbTicks; i++) 00080 { 00081 // convert current position into a string 00082 sprintf(buffer, labelsFormat, positions[i]); 00083 00084 // add the string to labels 00085 if (labels[i] != NULL) {delete[] labels[i];} 00086 00087 labels[i] = new char[strlen(buffer) + 1]; 00088 strcpy(labels[i], buffer); 00089 } 00090 00091 00092 00093 }

| void sciGraphics::AutomaticTicksComputer::reduceTicksNumber | ( | void | ) | [virtual] |
To be called when there are too many ticks. Compute a new sequence of ticks with less ticks.
Implements sciGraphics::ComputeTicksStrategy.
Definition at line 95 of file AutomaticTicksComputer.cpp.
References m_iNbTicks.
00096 { 00097 m_iNbTicks = (m_iNbTicks + 1) / 2; 00098 }
| virtual bool sciGraphics::AutomaticTicksComputer::needTicksDecimation | ( | void | ) | [inline, virtual] |
To know if the ticks computer needs decimation.
Implements sciGraphics::ComputeTicksStrategy.
Definition at line 55 of file AutomaticTicksComputer.hxx.
| void sciGraphics::AutomaticTicksComputer::setAxisBounds | ( | double | min, | |
| double | max | |||
| ) | [virtual] |
Set bounds between which we must compute ticks.
Definition at line 100 of file AutomaticTicksComputer.cpp.
References m_dMaxBounds, and m_dMinBounds.
Referenced by sciGraphics::TicksDrawerFactory::createXTicksDrawer(), sciGraphics::TicksDrawerFactory::createYTicksDrawer(), and sciGraphics::TicksDrawerFactory::createZTicksDrawer().
00101 { 00102 m_dMinBounds = min; 00103 m_dMaxBounds = max; 00104 }

| virtual bool sciGraphics::AutomaticTicksComputer::isDisplayingLabelsExponents | ( | void | ) | [inline, virtual] |
To know if we need to get ticks exposants or not.
Implements sciGraphics::ComputeTicksStrategy.
Reimplemented in sciGraphics::AutoLogTicksComputer.
Definition at line 65 of file AutomaticTicksComputer.hxx.
int sciGraphics::AutomaticTicksComputer::m_iNbTicks [protected] |
Current number of ticks
Definition at line 70 of file AutomaticTicksComputer.hxx.
Referenced by AutomaticTicksComputer(), getNbTicks(), sciGraphics::AutoLogTicksComputer::getNbTicks(), getTicksPosition(), sciGraphics::AutoLogTicksComputer::getTicksPosition(), reduceTicksNumber(), and reinit().
double sciGraphics::AutomaticTicksComputer::m_dMinBounds [protected] |
Definition at line 72 of file AutomaticTicksComputer.hxx.
Referenced by AutomaticTicksComputer(), getNbTicks(), sciGraphics::AutoLogTicksComputer::getNbTicks(), getTicksPosition(), sciGraphics::AutoLogTicksComputer::getTicksPosition(), and setAxisBounds().
double sciGraphics::AutomaticTicksComputer::m_dMaxBounds [protected] |
Definition at line 73 of file AutomaticTicksComputer.hxx.
Referenced by getNbTicks(), sciGraphics::AutoLogTicksComputer::getNbTicks(), getTicksPosition(), sciGraphics::AutoLogTicksComputer::getTicksPosition(), and setAxisBounds().
1.5.5