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 
00035 using namespace HuginBase;
00036 
00038 #if wxCHECK_VERSION(2,9,0)
00039 class ImagesTreeCtrl: public wxcode::wxTreeListCtrl, public HuginBase::PanoramaObserver
00040 #else
00041 class ImagesTreeCtrl: public wxTreeListCtrl, public HuginBase::PanoramaObserver
00042 #endif
00043 {
00044 public:
00046     enum GroupMode
00047     {
00048         GROUP_NONE=0,
00049         GROUP_LENS=1,
00050         GROUP_STACK=2,
00051         GROUP_OUTPUTLAYERS=3,
00052         GROUP_OUTPUTSTACK=4,
00053     };
00055     enum DisplayMode
00056     {
00057         DISPLAY_GENERAL=0,
00058         DISPLAY_EXIF=1,
00059         DISPLAY_POSITION=2,
00060         DISPLAY_LENS=3,
00061         DISPLAY_PHOTOMETRICS=4,
00062         DISPLAY_PHOTOMETRICS_IMAGES=32,
00063         DISPLAY_PHOTOMETRICS_LENSES=33,
00064     };
00066     ImagesTreeCtrl();
00067 
00069     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"));
00070 
00072     void Init(HuginBase::Panorama * pano);
00073    
00075     virtual ~ImagesTreeCtrl(void) ;
00076 
00078     void SetGroupMode(GroupMode newMode);
00080     void SetDisplayMode(DisplayMode newMode);
00081 
00083     void SetGuiLevel(GuiLevel newSetting);
00088     void SetOptimizerMode();
00090     virtual void panoramaChanged(HuginBase::Panorama & pano);
00093     void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet & imgNr);
00097     HuginBase::UIntSet GetSelectedImages();
00098 
00099 protected:
00101     void UpdateImageText(wxTreeItemId item);
00103     void UpdateGroupText(wxTreeItemId item);
00105     void UpdateGroup(wxTreeItemId parent, const UIntSet imgs, UIntSet& changed);
00107     void OnColumnWidthChange(wxListEvent & e );
00109     void OnLinkImageVariables(wxCommandEvent &e);
00111     void OnUnlinkImageVariables(wxCommandEvent &e);
00113     void OnEditImageVariables(wxCommandEvent &e);
00115     void OnBeginDrag(wxTreeEvent &e);
00117     void OnEndDrag(wxMouseEvent &e);
00119     void OnLeftDown(wxMouseEvent &e);
00121     void OnLeftDblClick(wxMouseEvent &e);
00123     void OnSelectAll(wxCommandEvent &e);
00125     void OnUnselectAll(wxCommandEvent &e);
00127     void OnSelectLensStack(wxCommandEvent &e);
00129     void OnUnselectLensStack(wxCommandEvent &e);
00131     void OnChar(wxTreeEvent &e);
00133     void OnBeginEdit(wxTreeEvent &e);
00135     void OnEndEdit(wxTreeEvent &e);
00137     void OnExecuteOperation(wxCommandEvent & e);
00139     void OnContextMenu(wxTreeEvent & e);
00141     void OnHeaderContextMenu(wxListEvent & e);
00142 
00143 private:
00145     void CreateColumns();
00147     void UnLinkImageVariables(bool linked);
00152     void SelectAllParameters(bool select, bool allImages);
00154     void UpdateOptimizerVariables();
00156     void GenerateSubMenu(wxMenu* menu, PanoOperation::PanoOperationVector* operations, int& id);
00157 
00158     // the model
00159     Panorama * m_pano;
00161     GroupMode m_groupMode;
00162     
00163     // image variable group information
00164     HuginBase::StandardImageVariableGroups * m_variable_groups;
00165 
00166     // number of digits for display
00167     int m_degDigits;
00168     int m_distDigits;
00169     int m_pixelDigits;
00171     GuiLevel m_guiLevel;
00173     bool m_optimizerMode;
00175     DisplayMode m_displayMode;
00177     std::map<std::string,size_t> m_columnMap;
00179     std::vector<std::string> m_columnVector;
00181     HuginBase::UIntSet m_editableColumns;
00183     std::vector<HuginBase::ImageVariableGroup::ImageVariableEnum> m_variableVector;
00185     std::map<int,PanoOperation::PanoOperation*> m_menuOperation;
00187     size_t m_selectedColumn;
00189     HuginBase::UIntSet m_draggingImages;
00191     bool m_dragging;
00193     double m_editVal;
00195     wxString m_editOldString;
00197     bool m_needsUpdate;
00198 
00200     wxTreeItemId m_root;
00201 
00202     //for saving column width
00203     wxString m_configClassName;
00204     DECLARE_EVENT_TABLE()
00205     DECLARE_DYNAMIC_CLASS(ImagesTreeCtrl)
00206 };
00207 
00208 
00210 #if wxCHECK_VERSION(2,9,0)
00211 class ImagesTreeCtrlXmlHandler : public wxcode::wxTreeListCtrlXmlHandler
00212 #else
00213 class ImagesTreeCtrlXmlHandler : public wxTreeListCtrlXmlHandler
00214 #endif
00215 {
00216     DECLARE_DYNAMIC_CLASS(ImagesTreeCtrlXmlHandler)
00217 
00218     public:
00219         ImagesTreeCtrlXmlHandler();
00220         virtual wxObject *DoCreateResource();
00221         virtual bool CanHandle(wxXmlNode *node);
00222 };
00223 
00224 #endif // _IMAGESTREE_H

Generated on 31 Jul 2015 for Hugintrunk by  doxygen 1.4.7