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

Generated on 30 Jun 2016 for Hugintrunk by  doxygen 1.4.7