ImagesTree.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00009 /*  This is free software; you can redistribute it and/or
00010  *  modify it under the terms of the GNU General Public
00011  *  License as published by the Free Software Foundation; either
00012  *  version 2 of the License, or (at your option) any later version.
00013  *
00014  *  This software is distributed in the hope that it will be useful,
00015  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  *  Lesser General Public License for more details.
00018  *
00019  *  You should have received a copy of the GNU General Public
00020  *  License along with this software. If not, see
00021  *  <http://www.gnu.org/licenses/>.
00022  *
00023  */
00024 
00025 #ifndef _IMAGESTREE_H
00026 #define _IMAGESTREE_H
00027 
00028 #include <map>
00029 #include "panodata/Panorama.h"
00030 #include <panodata/StandardImageVariableGroups.h>
00031 #include "treelistctrl.h"
00032 #include "GuiLevel.h"
00033 #include "hugin/PanoOperation.h"
00034 
00036 #if wxCHECK_VERSION(2,9,0)
00037 class ImagesTreeCtrl: public wxcode::wxTreeListCtrl, public HuginBase::PanoramaObserver
00038 #else
00039 class ImagesTreeCtrl: public wxTreeListCtrl, public HuginBase::PanoramaObserver
00040 #endif
00041 {
00042 public:
00044     enum GroupMode
00045     {
00046         GROUP_NONE=0,
00047         GROUP_LENS=1,
00048         GROUP_STACK=2,
00049         GROUP_OUTPUTLAYERS=3,
00050         GROUP_OUTPUTSTACK=4,
00051     };
00053     enum DisplayMode
00054     {
00055         DISPLAY_GENERAL=0,
00056         DISPLAY_EXIF=1,
00057         DISPLAY_POSITION=2,
00058         DISPLAY_LENS=3,
00059         DISPLAY_PHOTOMETRICS=4,
00060         DISPLAY_PHOTOMETRICS_IMAGES=32,
00061         DISPLAY_PHOTOMETRICS_LENSES=33,
00062     };
00064     ImagesTreeCtrl();
00065 
00067     bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxT("panel"));
00068 
00070     void Init(HuginBase::Panorama * pano);
00071    
00073     virtual ~ImagesTreeCtrl(void) ;
00074 
00076     void SetGroupMode(GroupMode newMode);
00078     void SetDisplayMode(DisplayMode newMode);
00079 
00081     void SetGuiLevel(GuiLevel newSetting);
00086     void SetOptimizerMode();
00088     virtual void panoramaChanged(HuginBase::Panorama & pano);
00091     void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet & imgNr);
00095     HuginBase::UIntSet GetSelectedImages();
00096 
00097 protected:
00099     void UpdateImageText(wxTreeItemId item);
00101     void UpdateGroupText(wxTreeItemId item);
00103     void UpdateGroup(wxTreeItemId parent, const HuginBase::UIntSet imgs, HuginBase::UIntSet& changed);
00105     void OnColumnWidthChange(wxListEvent & e );
00107     void OnLinkImageVariables(wxCommandEvent &e);
00109     void OnUnlinkImageVariables(wxCommandEvent &e);
00111     void OnEditImageVariables(wxCommandEvent &e);
00113     void OnBeginDrag(wxTreeEvent &e);
00115     void OnEndDrag(wxMouseEvent &e);
00117     void OnLeftDown(wxMouseEvent &e);
00119     void OnLeftDblClick(wxMouseEvent &e);
00121     void OnSelectAll(wxCommandEvent &e);
00123     void OnUnselectAll(wxCommandEvent &e);
00125     void OnSelectLensStack(wxCommandEvent &e);
00127     void OnUnselectLensStack(wxCommandEvent &e);
00129     void OnChar(wxTreeEvent &e);
00131     void OnBeginEdit(wxTreeEvent &e);
00133     void OnEndEdit(wxTreeEvent &e);
00135     void OnExecuteOperation(wxCommandEvent & e);
00137     void OnContextMenu(wxTreeEvent & e);
00139     void OnHeaderContextMenu(wxListEvent & e);
00140 
00141 private:
00143     void CreateColumns();
00145     void UnLinkImageVariables(bool linked);
00150     void SelectAllParameters(bool select, bool allImages);
00152     void UpdateOptimizerVariables();
00154     void GenerateSubMenu(wxMenu* menu, PanoOperation::PanoOperationVector* operations, int& id);
00155 
00156     // the model
00157     HuginBase::Panorama * m_pano;
00159     GroupMode m_groupMode;
00160     
00161     // image variable group information
00162     HuginBase::StandardImageVariableGroups * m_variable_groups;
00163 
00164     // number of digits for display
00165     int m_degDigits;
00166     int m_distDigits;
00167     int m_pixelDigits;
00169     GuiLevel m_guiLevel;
00171     bool m_optimizerMode;
00173     DisplayMode m_displayMode;
00175     std::map<std::string,size_t> m_columnMap;
00177     std::vector<std::string> m_columnVector;
00179     HuginBase::UIntSet m_editableColumns;
00181     std::vector<HuginBase::ImageVariableGroup::ImageVariableEnum> m_variableVector;
00183     std::map<int,PanoOperation::PanoOperation*> m_menuOperation;
00185     size_t m_selectedColumn;
00187     HuginBase::UIntSet m_draggingImages;
00189     bool m_dragging;
00191     double m_editVal;
00193     wxString m_editOldString;
00195     bool m_needsUpdate;
00196 
00198     wxTreeItemId m_root;
00199 
00200     //for saving column width
00201     wxString m_configClassName;
00202     DECLARE_EVENT_TABLE()
00203     DECLARE_DYNAMIC_CLASS(ImagesTreeCtrl)
00204 };
00205 
00206 
00208 #if wxCHECK_VERSION(2,9,0)
00209 class ImagesTreeCtrlXmlHandler : public wxcode::wxTreeListCtrlXmlHandler
00210 #else
00211 class ImagesTreeCtrlXmlHandler : public wxTreeListCtrlXmlHandler
00212 #endif
00213 {
00214     DECLARE_DYNAMIC_CLASS(ImagesTreeCtrlXmlHandler)
00215 
00216     public:
00217         ImagesTreeCtrlXmlHandler();
00218         virtual wxObject *DoCreateResource();
00219         virtual bool CanHandle(wxXmlNode *node);
00220 };
00221 
00222 #endif // _IMAGESTREE_H

Generated on 13 Feb 2016 for Hugintrunk by  doxygen 1.4.7