00001 #ifndef GRID_INITIALIZER_H
00002 #define GRID_INITIALIZER_H
00003
00004 #include "DocumentModelGridDisplay.h"
00005 #include <QRectF>
00006
00007 class DocumentModelCoords;
00008 class QSize;
00009
00010 class Transformation;
00011
00013 class GridInitializer
00014 {
00015 public:
00017 GridInitializer();
00018
00020 int computeCount (bool linearAxis,
00021 double start,
00022 double stop,
00023 double step) const;
00024
00026 double computeStart (bool linearAxis,
00027 double stop,
00028 double step,
00029 int count) const;
00030
00032 double computeStep (bool linearAxis,
00033 double start,
00034 double stop,
00035 int count) const;
00036
00038 double computeStop (bool linearAxis,
00039 double start,
00040 double step,
00041 int count) const;
00042
00044 DocumentModelGridDisplay initializeWithNarrowCoverage (const QRectF &boundingRectGraph,
00045 const DocumentModelCoords &modelCoords) const;
00046
00051 DocumentModelGridDisplay initializeWithWidePolarCoverage (const QRectF &boundingRectGraph,
00052 const DocumentModelCoords &modelCoords,
00053 const Transformation &transformation,
00054 const QSize &imageSize) const;
00055
00057 int valuePower (double value) const;
00058
00059 private:
00060
00061
00062
00063
00064 void axisScale (double xMin,
00065 double xMax,
00066 bool linearAxis,
00067 double &xStart,
00068 double &xStop,
00069 double &xDelta,
00070 int &count) const;
00071
00072 void overridePolarCoordinateSettings (const DocumentModelCoords &modelCoords,
00073 const Transformation &transformation,
00074 DocumentModelGridDisplay &modelGridDisplay,
00075 const QSize &imageSize) const;
00076 double roundOffToPower (double arg,
00077 int roundOffPower) const;
00078
00079 const QRectF m_boundingRectGraph;
00080 };
00081
00082 #endif // GRID_INITIALIZER_H