PSQt/include/GeoTree.h

Go to the documentation of this file.
00001 #ifndef GEOTREE_H
00002 #define GEOTREE_H
00003 
00004 //#include "PSQt/WdgImage.h"
00005 //#include "PSQt/WdgFile.h"
00006 
00007 //#include "PSQt/Frame.h"
00008 #include "PSCalib/GeometryAccess.h"
00009 #include "PSCalib/GeometryObject.h"
00010 #include <boost/shared_ptr.hpp>
00011 
00012 #include <Qt>
00013 #include <QtGui>
00014 #include <QtCore>
00015 
00016 namespace PSQt {
00017 
00018 typedef boost::shared_ptr<PSCalib::GeometryObject> shpGO;
00019 
00020 /**
00021  *  @ingroup PSQt
00022  *
00023  *  @brief Implementation of the geometry tree as QTreeView subclass.
00024  * 
00025  *  GeoTree is a sub-class of QTreeView
00026  *
00027  *  Geometry tree for input file is displayed in the window.
00028  *  GeoTree emits signal "selectedGO(shpGO&)" when the geometry object is selected.
00029  *
00030  *
00031  *  This software was developed for the LCLS project.  If you use all or 
00032  *  part of it, please give an appropriate acknowledgment.
00033  *
00034  *  @see GUIMain
00035  *
00036  *  @version $Id: GeoTree.h 11039 2015-12-01 01:18:58Z dubrovin@SLAC.STANFORD.EDU $
00037  *
00038  *  @author Mikhail Dubrovin
00039  */
00040 
00041 class GeoTree : public QTreeView
00042 {
00043  Q_OBJECT // macro is needed for connection of signals and slots
00044 
00045  public:
00046 
00047     GeoTree( QWidget *parent = 0, 
00048              const std::string& gfname = "/reg/g/psdm/detector/alignment/cspad/geo-cspad-test-2-end.data", 
00049              const unsigned& pbits=255);
00050 
00051     PSCalib::GeometryAccess* geoacc(){return m_geoacc;}
00052 
00053     // Select item programatically
00054     void setItemSelected(const QModelIndex& index);
00055 
00056     // Select item programatically
00057     void setItemSelected(const QStandardItem* item=0);
00058     void saveGeometryInFile(const std::string& ofname="./geometry.txt");
00059 
00060  public slots:
00061     void updateTreeModel(const std::string& gfname = "/reg/g/psdm/detector/alignment/cspad/geo-cspad-test-2-end.data");
00062     void testSignalGeometryIsLoaded(PSCalib::GeometryAccess*);
00063     void testSignalString(const std::string& str);
00064     void testSignalGO(shpGO&);
00065     void testSignalCollapsed(const QModelIndex& index);
00066     void testSignalExpanded(const QModelIndex& index);
00067     void currentChanged(const QModelIndex & current, const QModelIndex & previous);
00068 
00069  signals:
00070     void geometryIsLoaded(PSCalib::GeometryAccess*);
00071     void selectedText(const std::string& str);
00072     void selectedGO(shpGO&);
00073 
00074  private:
00075 
00076     std::string              m_gfname;
00077     QTreeView*               m_view;
00078     unsigned                 m_pbits;
00079     QStandardItemModel*      m_model;
00080     PSCalib::GeometryAccess* m_geoacc;
00081 
00082     std::map<QStandardItem*,shpGO> map_item_to_geo;
00083     std::map<shpGO,QStandardItem*> map_geo_to_item;
00084 
00085     inline const char* _name_(){return "GeoTree";}
00086     bool loadGeometry(const std::string& gfname);
00087     void makeTreeModel();
00088     void fillTreeModel(shpGO geo=shpGO(), QStandardItem* item=0, const unsigned& level=0, const unsigned& pbits=0);
00089     void fillTreeModelTest();
00090 };
00091 
00092 } // namespace PSQt
00093 
00094 #endif // GEOTREE_H

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7