170 if(!timer.isActive()){
174 int width=painter->device()->width();
175 int height=painter->device()->height();
187 if (width!=gWidth || height!=gHeight){
192 gImageSize=gRowStride*gHeight;
193 gImageArea=gWidth*gHeight;
194 gMapSize=gWidth*gHeight*
sizeof(double);
196 if (gpActivationMap){
197 delete [] gpActivationMap;
200 delete [] gpImageBuff;
202 gpActivationMap =
new double[gImageArea];
203 gpImageBuff =
new uchar[gImageSize];
205 if(TheadType == TYPE_CAN && gpSkinMeshThreadCan && gWidth>=180 && gHeight>=180){
206 gpSkinMeshThreadCan->resize(gWidth,gHeight);
207 }
else if (TheadType == TYPE_PORT && gpSkinMeshClient && gWidth>=180 && gHeight>=180){
208 gpSkinMeshClient->resize(gWidth,gHeight);
212 if (TheadType == TYPE_CAN && gpSkinMeshThreadCan){
213 memset(gpImageBuff,0,gImageSize);
215 if (gWidth>=180 && gHeight>=180){
216 gpSkinMeshThreadCan->eval(gpImageBuff);
217 gpSkinMeshThreadCan->draw(gpImageBuff);
220 QImage img = QImage(gpImageBuff,gWidth,gHeight,gRowStride,QImage::Format_RGB32);
221 painter->beginNativePainting();
222 painter->fillRect(0,0,gWidth,gHeight,QColor(
"black"));
223 painter->drawImage(0,0,img);
224 painter->endNativePainting();
226 }
else if (TheadType == TYPE_PORT && gpSkinMeshClient) {
227 memset(gpImageBuff,0,gImageSize);
229 if (gWidth>=180 && gHeight>=180)
231 gpSkinMeshClient->eval(gpImageBuff);
232 gpSkinMeshClient->draw(gpImageBuff);
236 QImage img = QImage(gpImageBuff,gWidth,gHeight,gRowStride,QImage::Format_RGB888);
238 painter->beginNativePainting();
239 painter->fillRect(0,0,gWidth,gHeight,QColor(
"black"));
240 painter->drawImage(0,0,img);
241 painter->endNativePainting();
257 rf.setDefaultContext(
"skinGui/skinGui");
258 rf.setDefaultConfigFile(
"left_hand.ini");
261 int c = params.count();
263 v = (
char**)malloc(
sizeof(
char*) * c);
264 for(
int i=0;i<params.count();i++){
265 v[i] = (
char*)malloc(
sizeof(
char) * params.at(i).length()+1);
266 strcpy(v[i],params.at(i).toLatin1().data());
269 if(!rf.configure(c, v)){
274 gWidth =rf.find(
"width" ).asInt32();
275 gHeight=rf.find(
"height").asInt32();
276 if (rf.check(
"xpos")){
277 gXpos=rf.find(
"xpos").asInt32();
279 if (rf.check(
"ypos")){
280 gYpos=rf.find(
"ypos").asInt32();
283 bool useCan = rf.check(
"useCan");
285 yCInfo(QTICUBSKINGUIPLUGIN) <<
"CAN version: reading data directly from CAN";
288 yCInfo(QTICUBSKINGUIPLUGIN) <<
"YARP version: reading data from a YARP client";
293 window_title=QString(
"SkinGui (part: %1)").arg(rf.find(
"robotPart").asString().data());
300 yCDebug(QTICUBSKINGUIPLUGIN) <<
"RF:" << rf.toString();
303 gImageSize=gRowStride*gHeight;
304 gMapSize=gWidth*gHeight*
sizeof(double);
305 gImageArea=gWidth*gHeight;
307 gpActivationMap=
new double[gImageArea];
308 gpImageBuff=
new uchar[gImageSize];
316 connect(
this,SIGNAL(
init()),
this,SLOT(onInit()),Qt::QueuedConnection);