00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00030 #ifndef _dbasedlg_h_
00031 #define _dbasedlg_h_
00032
00033 #include "ui_dbaseDlg.h"
00034 #include <map>
00035 #include <QDialog>
00036
00037 class GraspitDBGrasp;
00038 class GraspitDBModel;
00039 class Hand;
00040
00041 namespace db_planner {
00042 class DatabaseManager;
00043 class Model;
00044 class Grasp;
00045 }
00046
00052 class DBaseDlg : public QDialog, public Ui::DBaseDlgUI
00053 {
00054 Q_OBJECT
00055 private:
00057 GraspitDBModel *mCurrentLoadedModel;
00059 QGraphicsScene * mModelScene;
00061 db_planner::DatabaseManager *mDBMgr;
00063 std::vector<db_planner::Model*> mModelList;
00065 std::map<std::string, int> mModelMap;
00067 std::vector<db_planner::Grasp*> mGraspList;
00069 int mCurrentFrame;
00071 bool inModelConstruction;
00072
00074 void init();
00076 void destroy();
00078 void getModelList();
00080 void displayModelList();
00082 void displayGraspTypeList(std::vector<std::string>);
00084 template <class vectorType, class treatAsType>
00085 void deleteVectorElements(std::vector<vectorType>&);
00087 void showGrasp(int i);
00089 void nextGrasp();
00091 void previousGrasp();
00093 void updateGraspInfo();
00095 void initializeGraspInfo();
00096
00097 public:
00098 DBaseDlg(QWidget *parent = 0) : QDialog(parent), mCurrentLoadedModel(NULL), mDBMgr(NULL),
00099 mModelScene(NULL), mCurrentFrame(0),
00100 inModelConstruction(false) {
00101 setupUi(this);
00102 QObject::connect(exitButton, SIGNAL(clicked()), this, SLOT(exitButton_clicked()));
00103 QObject::connect(connectButton, SIGNAL(clicked()), this, SLOT(connectButton_clicked()));
00104 QObject::connect(loadModelButton, SIGNAL(clicked()), this, SLOT(loadModelButton_clicked()));
00105 QObject::connect(loadGraspButton, SIGNAL(clicked()), this, SLOT(loadGraspButton_clicked()));
00106 QObject::connect(nextGraspButton, SIGNAL(clicked()), this, SLOT(nextGraspButton_clicked()));
00107 QObject::connect(previousGraspButton, SIGNAL(clicked()), this, SLOT(previousGraspButton_clicked()));
00108 QObject::connect(plannerButton, SIGNAL(clicked()), this, SLOT(plannerButton_clicked()));
00109 QObject::connect(createGWSButton, SIGNAL(clicked()), this, SLOT(createGWSButton_clicked()));
00110 QObject::connect(sortButton, SIGNAL(clicked()), this, SLOT(sortButton_clicked()));
00111 QObject::connect(showMarkersBox, SIGNAL(clicked()), this, SLOT(showMarkers()));
00112
00113 QObject::connect(modelsComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(modelChanged()));
00114 QObject::connect(classesComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(classChanged()));
00115 QObject::connect(showPreGraspRadioButton, SIGNAL(toggled(bool)), this, SLOT(graspTypeChanged()));
00116 QObject::connect(showFinalGraspRadioButton, SIGNAL(toggled(bool)), this, SLOT(graspTypeChanged()));
00117
00118 init();
00119 }
00120 ~DBaseDlg(){destroy();}
00121
00122 public slots:
00124 void connectButton_clicked();
00125 void exitButton_clicked();
00126 void loadModelButton_clicked();
00127 void loadGraspButton_clicked();
00128 void nextGraspButton_clicked();
00129 void previousGraspButton_clicked();
00130 void plannerButton_clicked();
00131 void createGWSButton_clicked();
00132 void sortButton_clicked();
00133 void showMarkers();
00135 void modelChanged();
00136 void graspTypeChanged();
00137 void classChanged();
00138 };
00139 #endif