1 // -*- c-basic-offset: 4 -*- 2 3 /** @file LensCalFrame.h 4 * 5 * @brief declaration of LensCal main frame class 6 * 7 * @author T. Modes 8 * 9 */ 10 11 /* 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public 14 * License as published by the Free Software Foundation; either 15 * version 2 of the License, or (at your option) any later version. 16 * 17 * This software is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public 23 * License along with this software. If not, see 24 * <http://www.gnu.org/licenses/>. 25 * 26 */ 27 28 #ifndef LENSCALFRAME_H 29 #define LENSCALFRAME_H 30 31 #include <vector> 32 #include <set> 33 34 #include "panoinc_WX.h" 35 #include "panodata/Panorama.h" 36 #include "lines/FindLines.h" 37 #include "LensCalTypes.h" 38 #include "LensCalImageCtrl.h" 39 40 /** simple class that forward the drop to the mainframe */ 41 class FileDropTarget : public wxFileDropTarget 42 { 43 public: 44 bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames); 45 }; 46 47 // forward declaration, to prevent include of class 48 namespace wxGraphTools 49 { 50 class GraphPopupWindow; 51 }; 52 53 /** The main window frame. 54 * 55 */ 56 class LensCalFrame:public wxFrame, public AppBase::ProgressDisplay 57 { 58 public: 59 60 /** constructor */ 61 explicit LensCalFrame(wxWindow* parent); 62 /** destructor */ 63 virtual ~LensCalFrame(); 64 65 /** get the path to the xrc directory */ 66 const wxString & GetXRCPath(); 67 void AddImages(wxArrayString files); 68 void UpdateListString(unsigned int index); 69 /** updates the list box with current values */ 70 void UpdateList(bool restoreSelection); 71 72 protected: 73 /** called when a progress message should be displayed */ 74 void updateProgressDisplay(); 75 76 private: 77 // event handlers 78 void OnExit(wxCommandEvent &e); 79 void OnAddImage(wxCommandEvent &e); 80 void OnRemoveImage(wxCommandEvent &e); 81 void OnFindLines(wxCommandEvent &e); 82 void OnOptimize(wxCommandEvent &e); 83 /** show distortion graph */ 84 void OnShowDistortionGraph(wxCommandEvent &e); 85 void SaveLensToIni(); 86 void OnSaveLens(wxCommandEvent &e); 87 void OnSaveProject(wxCommandEvent &e); 88 void OnImageSelected(wxCommandEvent &e); 89 void OnSelectPreviewContent(wxCommandEvent &e); 90 void OnReset(wxCommandEvent &e); 91 void OnShowLines(wxCommandEvent &e); 92 void OnRefresh(wxCommandEvent &e); 93 /** reads all input values into internal values */ 94 bool ReadInputs(bool readFocalLength,bool readOptions,bool readLensParameter); 95 /** do the optimization */ 96 void Optimize(); 97 /** update progress display */ 98 bool displayProgress(); 99 /** return panorama object with all images */ 100 HuginBase::Panorama GetPanorama(); 101 /** enable all buttons and menu items depending on number of active images*/ 102 void EnableButtons(); 103 /** set all parameter input wxTextField to internal values */ 104 void ParametersToDisplay(); 105 106 //link to some controls 107 wxChoice* m_choice_projection; 108 wxListBox* m_images_list; 109 LensCalImageCtrl* m_preview; 110 /** list of all detected lines */ 111 std::vector<ImageLineList*> m_images; 112 //internal values of inputs 113 HuginBase::SrcPanoImage::Projection m_projection; 114 double m_focallength; 115 double m_cropfactor; 116 double m_edge_scale; 117 double m_edge_threshold; 118 unsigned int m_resize_dimension; 119 double m_minlinelength; 120 double m_a; 121 double m_b; 122 double m_c; 123 double m_d; 124 double m_e; 125 126 // progress reporter 127 double m_progressMax; 128 double m_progress; 129 wxString m_progressMsg; 130 // popup window 131 wxGraphTools::GraphPopupWindow* m_popup = nullptr; 132 133 DECLARE_EVENT_TABLE() 134 }; 135 136 137 #endif // LENSCALFRAME_H 138