00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "stdr_gui/stdr_robot_creator/stdr_robot_creator_loader.h"
00023
00024 namespace stdr_gui
00025 {
00032 CRobotCreatorLoader::CRobotCreatorLoader(int argc, char **argv):
00033 robotPropLoader(argc,argv),
00034 robotFootLoader(argc,argv),
00035 laserPropLoader(argc,argv),
00036 sonarPropLoader(argc,argv),
00037 kinematicPropLoader(argc,argv),
00038 rfidAntennaPropLoader(argc,argv),
00039 co2SensorPropLoader(argc,argv),
00040 thermalSensorPropLoader(argc,argv),
00041 soundSensorPropLoader(argc,argv),
00042 argc_(argc),
00043 argv_(argv)
00044 {
00045 setupUi(this);
00046
00047 setupInitialTree();
00048 robotPreviewLabel->setScaledContents(true);
00049
00050 robotPreviewImage = QImage(500,500,QImage::Format_RGB32);
00051 robotPreviewImage.fill(QColor(220,220,220,1));
00052 }
00053
00058 void CRobotCreatorLoader::setupInitialTree(void)
00059 {
00060 addIcon.addFile(QString::fromUtf8((
00061 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00062 std::string("/resources/images/add_icon.png")).c_str()),
00063 QSize(16,16),
00064 QIcon::Normal,
00065 QIcon::Off);
00066 editIcon.addFile(QString::fromUtf8((
00067 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00068 std::string("/resources/images/edit_icon.png")).c_str()),
00069 QSize(16,16),
00070 QIcon::Normal,
00071 QIcon::Off);
00072 removeIcon.addFile(QString::fromUtf8((
00073 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00074 std::string("/resources/images/remove_icon.png")).c_str()),
00075 QSize(16,16),
00076 QIcon::Normal,
00077 QIcon::Off);
00078 saveIcon.addFile(QString::fromUtf8((
00079 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00080 std::string("/resources/images/save_icon.png")).c_str()),
00081 QSize(16,16),
00082 QIcon::Normal,
00083 QIcon::Off);
00084 loadIcon.addFile(QString::fromUtf8((
00085 stdr_gui_tools::getRosPackagePath("stdr_gui") +
00086 std::string("/resources/images/load_icon.png")).c_str()),
00087 QSize(16,16),
00088 QIcon::Normal,
00089 QIcon::Off);
00090
00091 robotTreeWidget->setColumnWidth(0,150);
00092 robotTreeWidget->setColumnWidth(1,60);
00093 robotTreeWidget->setColumnWidth(2,20);
00094 robotTreeWidget->setColumnWidth(3,20);
00095 robotTreeWidget->setColumnWidth(4,20);
00096
00097 QStringList ColumnNames;
00098 ColumnNames << "Robot parts" << "Info" << "" << "" << "";
00099
00100 robotTreeWidget->setHeaderLabels(ColumnNames);
00101
00102 robotNode.setText(0,"Robot");
00103 lasersNode.setText(0,"Lasers");
00104 sonarsNode.setText(0,"Sonars");
00105 rfidAntennasNode.setText(0,"Rfid readers");
00106 co2SensorsNode.setText(0,"CO2 sensors");
00107 thermalSensorsNode.setText(0,"Thermal sensors");
00108 soundSensorsNode.setText(0,"Sound sensors");
00109
00110
00111 robotNode.setIcon(2,editIcon);
00112 robotNode.setIcon(3,saveIcon);
00113 robotNode.setIcon(4,loadIcon);
00114 lasersNode.setIcon(2,addIcon);
00115 sonarsNode.setIcon(2,addIcon);
00116 rfidAntennasNode.setIcon(2,addIcon);
00117 co2SensorsNode.setIcon(2,addIcon);
00118 thermalSensorsNode.setIcon(2,addIcon);
00119 soundSensorsNode.setIcon(2,addIcon);
00120
00121
00122 robotTreeWidget->addTopLevelItem(&robotNode);
00123 robotTreeWidget->addTopLevelItem(&lasersNode);
00124 robotTreeWidget->addTopLevelItem(&sonarsNode);
00125 robotTreeWidget->addTopLevelItem(&rfidAntennasNode);
00126 robotTreeWidget->addTopLevelItem(&co2SensorsNode);
00127 robotTreeWidget->addTopLevelItem(&thermalSensorsNode);
00128 robotTreeWidget->addTopLevelItem(&soundSensorsNode);
00129
00130
00131 robotInfoOrientation.setText(0,"Orientation");
00132 robotInfoOrientation.setText(1,"0");
00133
00134 robotInfoFootprint.setText(0,"Footprint");
00135 robotInfoFootprint.setIcon(2,addIcon);
00136
00137 robotNode.addChild(&robotInfoRadius);
00138 robotNode.addChild(&robotInfoOrientation);
00139 robotNode.addChild(&robotInfoFootprint);
00140
00141 robotNode.setExpanded(true);
00142 lasersNode.setExpanded(true);
00143 sonarsNode.setExpanded(true);
00144 rfidAntennasNode.setExpanded(true);
00145 co2SensorsNode.setExpanded(true);
00146 thermalSensorsNode.setExpanded(true);
00147 soundSensorsNode.setExpanded(true);
00148
00149
00150 robotTreeWidget->resizeColumnToContents(0);
00151 robotTreeWidget->resizeColumnToContents(1);
00152 robotTreeWidget->resizeColumnToContents(2);
00153 robotTreeWidget->resizeColumnToContents(3);
00154 robotTreeWidget->resizeColumnToContents(4);
00155 }
00156 }