[an error occurred while processing this directive]
Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

hugin1/base_wx/Plot2D.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00024 #ifndef _PLOT2D_H
00025 #define _PLOT2D_H
00026 //---------------------------------------------------------------------------
00027 
00028 #include <vector>
00029 //#include <stack>
00030 
00043 class Plot2DWindow : public wxWindow
00044 {
00045 protected:
00046         //    TPen *FAPen;               // Datenelement fr den Stift
00047 //    TBrush *FABrush;           // Datenelement fr den Pinsel
00048 //    TPen *FGPen;               // Datenelement fr den Stift
00049 //    TBrush *FGBrush;           // Datenelement fr den Pinsel
00050     std::vector <hugin_utils::FDiff2D> m_points;
00051     // axis properties
00052     double x_min,y_min, x_max, y_max;
00053     double m_XSpacing;
00054     double m_YSpacing;
00055     int m_axisDivLen;
00056     bool m_axisEqual;
00057     bool m_autosize;
00058     int m_borderLeft;
00059     int m_borderRight;
00060     int m_borderTop;
00061     int m_borderBottom;
00062 
00063     wxPen m_curvePen;
00064     wxPen m_axisPen;
00065     wxPen m_gridPen;
00066 
00067 //    void calcBoundingBox();
00068     wxPoint ToScreen(const hugin_utils::FDiff2D & p, const hugin_utils::FDiff2D & scale) const;
00069 //    void adjustRange();
00070 
00071 
00072     void OnPaint(wxPaintEvent &event);
00073     void Paint(wxDC & dc);
00074     void PaintAxis(wxDC & dc, const hugin_utils::FDiff2D & scale);
00075     double AxisRound(double d) const ;
00076 
00077     void Invalidate();
00078 
00079 public:
00080     Plot2DWindow(wxWindow * parent, int id=-1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
00081     
00082     ~Plot2DWindow();
00083     
00085     void SetPoints(std::vector<hugin_utils::FDiff2D> &);
00086 
00088     template <class Functor>
00089     void Plot(Functor & f, double startx, double endx, int nPoints=100)
00090     {
00091         m_points.resize(nPoints);
00092         double deltax = (endx-startx)/nPoints;
00093         for (int i=0; i < nPoints; i++) {
00094             m_points[i] = hugin_utils::FDiff2D(startx, f(startx));
00095             startx +=deltax;
00096         }
00097         if (m_autosize) {
00098             AutoSizeAxis();
00099         } else {
00100             Invalidate();
00101         }
00102     }
00103 
00105     void SetAxis(double xstart, double xend,
00106                  double ystart, double yend);
00107 
00110     void AutoSizeAxis();
00111 
00113     void SetXSpacing(double x)
00114     {
00115         m_XSpacing = x;
00116         Invalidate();
00117     }
00118 
00119     void SetYSpacing(double y)
00120     {
00121         m_YSpacing = y;
00122         Invalidate();
00123     }
00124 
00126     void SetAxisDivLen(int x);
00127 
00129     void SetBorder(int x, int y);
00130 
00132     void AxisEqual(bool b){m_axisEqual=b;Invalidate();};
00133 
00135     void SetAutosize(bool a) {m_autosize = a;};
00136 private:
00137     DECLARE_EVENT_TABLE()
00138 
00139 };
00140 //---------------------------------------------------------------------------
00141 #endif

Generated on Mon Sep 20 01:01:25 2010 for Hugintrunk by doxygen 1.3.9.1