GraphTools.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00010 /*
00011  *  This is free software; you can redistribute it and/or
00012  *  modify it under the terms of the GNU General Public
00013  *  License as published by the Free Software Foundation; either
00014  *  version 2 of the License, or (at your option) any later version.
00015  *
00016  *  This software is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  *  Lesser General Public License for more details.
00020  *
00021  *  You should have received a copy of the GNU General Public
00022  *  License along with this software. If not, see
00023  *  <http://www.gnu.org/licenses/>.
00024  *
00025  */
00026 
00027 #ifndef GRAPHTOOLS_H
00028 #define GRAPHTOOLS_H
00029 
00030 #include <hugin_shared.h>
00031 #include "panoinc_WX.h"
00032 #include "panoinc.h"
00033 #include "wx/popupwin.h"
00034 
00035 namespace wxGraphTools
00036 {
00038 class WXIMPEX GraphPopupWindow : public wxPopupTransientWindow
00039 {
00040 public:
00041     GraphPopupWindow(wxWindow* parent, wxBitmap bitmap);
00042 protected:
00043     void OnLeftDown(wxMouseEvent &e);
00044     void OnRightDown(wxMouseEvent &e);
00045 private:
00046     wxStaticBitmap* m_bitmapControl;
00047     DECLARE_CLASS(GraphPopupWindow)
00048 };
00049 
00051 class WXIMPEX Graph
00052 {
00053 public:
00055     Graph(int graphWidth, int graphHeight, wxColour backgroundColour);
00057     ~Graph();
00059     void SetChartArea(int left, int top, int right, int bottom);
00061     void SetChartDisplay(double xmin, double ymin, double xmax, double ymax);
00063     void DrawGrid(size_t linesX, size_t linesY);
00065     void DrawLine(std::vector<hugin_utils::FDiff2D> points, wxColour colour, int penWidth = 1);
00066     const wxBitmap GetGraph() const;
00067 private:
00068     // prevent copying of class
00069     Graph(const Graph&);
00070     Graph& operator=(const Graph&);
00071     //helper function to transform coordinates from real world to bitmap
00072     int TransformX(double x);
00073     int TransformY(double y);
00074     // area to be drawn
00075     double m_xmin, m_xmax, m_ymin, m_ymax;
00076     // size of canvas
00077     int m_width, m_height;
00078     // chart area
00079     int m_left, m_top, m_right, m_bottom;
00080     // bitmap
00081     wxBitmap* m_bitmap;
00082     wxMemoryDC m_dc;
00083 };
00084 
00086 wxBitmap WXIMPEX GetDistortionGraph(const HuginBase::SrcPanoImage& srcImage);
00087 }
00088 #endif // GRAPHTOOLS_H

Generated on 26 Apr 2018 for Hugintrunk by  doxygen 1.4.7