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, write to the Free Software
00021  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  *
00023  */
00024 
00025 #ifndef _IMAGESTREE_H
00026 #define _IMAGESTREE_H
00027 
00028 #include <map>
00029 #include "PT/Panorama.h"
00030 #include <panodata/StandardImageVariableGroups.h>
00031 #include "treelistctrl.h"
00032 #include "GuiLevel.h"
00033 #include "hugin/PanoOperation.h"
00034 
00035 using namespace PT;
00036 
00038 class ImagesTreeCtrl: public wxTreeListCtrl, public PT::PanoramaObserver
00039 {
00040 public:
00042     enum GroupMode
00043     {
00044         GROUP_NONE=0,
00045         GROUP_LENS=1,
00046         GROUP_STACK=2,
00047         GROUP_OUTPUTLAYERS=3,
00048         GROUP_OUTPUTSTACK=4,
00049     };
00051     enum DisplayMode
00052     {
00053         DISPLAY_GENERAL=0,
00054         DISPLAY_EXIF=1,
00055         DISPLAY_POSITION=2,
00056         DISPLAY_LENS=3,
00057         DISPLAY_PHOTOMETRICS=4,
00058         DISPLAY_PHOTOMETRICS_IMAGES=32,
00059         DISPLAY_PHOTOMETRICS_LENSES=33,
00060     };
00062     ImagesTreeCtrl();
00063 
00065     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"));
00066 
00068     void Init(PT::Panorama * pano);
00069    
00071     virtual ~ImagesTreeCtrl(void) ;
00072 
00074     void SetGroupMode(GroupMode newMode);
00076     void SetDisplayMode(DisplayMode newMode);
00077 
00079     void SetGuiLevel(GuiLevel newSetting);
00084     void SetOptimizerMode();
00086     virtual void panoramaChanged(PT::Panorama & pano);
00089     void panoramaImagesChanged(PT::Panorama &pano, const PT::UIntSet & imgNr);
00093     HuginBase::UIntSet GetSelectedImages();
00094 
00095 protected:
00097     void UpdateImageText(wxTreeItemId item);
00099     void UpdateGroupText(wxTreeItemId item);
00101     void UpdateGroup(wxTreeItemId parent, const UIntSet imgs, UIntSet& changed);
00103     void OnColumnWidthChange(wxListEvent & e );
00105     void OnLinkImageVariables(wxCommandEvent &e);
00107     void OnUnlinkImageVariables(wxCommandEvent &e);
00109     void OnEditImageVariables(wxCommandEvent &e);
00111     void OnBeginDrag(wxTreeEvent &e);
00113     void OnEndDrag(wxMouseEvent &e);
00115     void OnLeftDown(wxMouseEvent &e);
00117     void OnLeftDblClick(wxMouseEvent &e);
00119     void OnSelectAll(wxCommandEvent &e);
00121     void OnUnselectAll(wxCommandEvent &e);
00123     void OnSelectLensStack(wxCommandEvent &e);
00125     void OnUnselectLensStack(wxCommandEvent &e);
00127     void OnChar(wxTreeEvent &e);
00129     void OnBeginEdit(wxTreeEvent &e);
00131     void OnEndEdit(wxTreeEvent &e);
00133     void OnExecuteOperation(wxCommandEvent & e);
00135     void OnContextMenu(wxTreeEvent & e);
00137     void OnHeaderContextMenu(wxListEvent & e);
00138 
00139 private:
00141     void CreateColumns();
00143     void UnLinkImageVariables(bool linked);
00148     void SelectAllParameters(bool select, bool allImages);
00150     void UpdateOptimizerVariables();
00152     void GenerateSubMenu(wxMenu* menu, PanoOperation::PanoOperationVector* operations, int& id);
00153 
00154     // the model
00155     Panorama * m_pano;
00157     GroupMode m_groupMode;
00158     
00159     // image variable group information
00160     HuginBase::StandardImageVariableGroups * m_variable_groups;
00161 
00162     // number of digits for display
00163     int m_degDigits;
00164     int m_distDigits;
00165     int m_pixelDigits;
00167     GuiLevel m_guiLevel;
00169     bool m_optimizerMode;
00171     DisplayMode m_displayMode;
00173     std::map<std::string,size_t> m_columnMap;
00175     std::vector<std::string> m_columnVector;
00177     HuginBase::UIntSet m_editableColumns;
00179     std::vector<HuginBase::ImageVariableGroup::ImageVariableEnum> m_variableVector;
00181     std::map<int,PanoOperation::PanoOperation*> m_menuOperation;
00183     size_t m_selectedColumn;
00185     HuginBase::UIntSet m_draggingImages;
00187     bool m_dragging;
00189     double m_editVal;
00191     wxString m_editOldString;
00193     bool m_needsUpdate;
00194 
00196     wxTreeItemId m_root;
00197 
00198     //for saving column width
00199     wxString m_configClassName;
00200     DECLARE_EVENT_TABLE()
00201     DECLARE_DYNAMIC_CLASS(ImagesTreeCtrl)
00202 };
00203 
00204 
00206 class ImagesTreeCtrlXmlHandler : public wxTreeListCtrlXmlHandler
00207 {
00208     DECLARE_DYNAMIC_CLASS(ImagesTreeCtrlXmlHandler)
00209 
00210     public:
00211         ImagesTreeCtrlXmlHandler();
00212         virtual wxObject *DoCreateResource();
00213         virtual bool CanHandle(wxXmlNode *node);
00214 };
00215 
00216 #endif // _IMAGESTREE_H

Generated on Thu Apr 17 01:25:33 2014 for Hugintrunk by  doxygen 1.3.9.1