00001 #ifndef GEOTREE_H
00002 #define GEOTREE_H
00003
00004
00005
00006
00007
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
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class GeoTree : public QTreeView
00042 {
00043 Q_OBJECT
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
00054 void setItemSelected(const QModelIndex& index);
00055
00056
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 }
00093
00094 #endif // GEOTREE_H