164 if(!timer.isActive()){
168 int width=painter->device()->width();
169 int height=painter->device()->height();
181 if (width!=gWidth || height!=gHeight){
186 gImageSize=gRowStride*gHeight;
187 gImageArea=gWidth*gHeight;
188 gMapSize=gWidth*gHeight*
sizeof(double);
190 if (gpActivationMap){
191 delete [] gpActivationMap;
194 delete [] gpImageBuff;
196 gpActivationMap =
new double[gImageArea];
197 gpImageBuff =
new uchar[gImageSize];
199 if(TheadType == TYPE_CAN && gpSkinMeshThreadCan && gWidth>=180 && gHeight>=180){
200 gpSkinMeshThreadCan->
resize(gWidth,gHeight);
201 }
else if (TheadType == TYPE_PORT && gpSkinMeshThreadPort && gWidth>=180 && gHeight>=180){
202 gpSkinMeshThreadPort->
resize(gWidth,gHeight);
206 if (TheadType == TYPE_CAN && gpSkinMeshThreadCan){
207 memset(gpImageBuff,0,gImageSize);
209 if (gWidth>=180 && gHeight>=180){
210 gpSkinMeshThreadCan->
eval(gpImageBuff);
211 gpSkinMeshThreadCan->
draw(gpImageBuff);
214 QImage img = QImage(gpImageBuff,gWidth,gHeight,gRowStride,QImage::Format_RGB32);
215 painter->beginNativePainting();
216 painter->fillRect(0,0,gWidth,gHeight,QColor(
"black"));
217 painter->drawImage(0,0,img);
218 painter->endNativePainting();
220 }
else if (TheadType == TYPE_PORT && gpSkinMeshThreadPort) {
221 memset(gpImageBuff,0,gImageSize);
223 if (gWidth>=180 && gHeight>=180)
225 gpSkinMeshThreadPort->
eval(gpImageBuff);
226 gpSkinMeshThreadPort->
draw(gpImageBuff);
230 QImage img = QImage(gpImageBuff,gWidth,gHeight,gRowStride,QImage::Format_RGB888);
232 painter->beginNativePainting();
233 painter->fillRect(0,0,gWidth,gHeight,QColor(
"black"));
234 painter->drawImage(0,0,img);
235 painter->endNativePainting();
251 rf.setDefaultContext(
"skinGui/skinGui");
252 rf.setDefaultConfigFile(
"left_hand.ini");
255 int c = params.count();
257 v = (
char**)malloc(
sizeof(
char*) * c);
258 for(
int i=0;i<params.count();i++){
259 v[i] = (
char*)malloc(
sizeof(
char) * params.at(i).length()+1);
260 strcpy(v[i],params.at(i).toLatin1().data());
263 if(!rf.configure(c, v)){
268 gWidth =rf.find(
"width" ).asInt32();
269 gHeight=rf.find(
"height").asInt32();
270 if (rf.check(
"xpos")){
271 gXpos=rf.find(
"xpos").asInt32();
273 if (rf.check(
"ypos")){
274 gYpos=rf.find(
"ypos").asInt32();
277 bool useCan = rf.check(
"useCan");
279 yInfo(
"CAN version: Reading data directly from CAN");
282 yInfo(
"YARP version: reading data from a Yarp port");
287 window_title=QString(
"SkinGui (part: %1)").arg(rf.find(
"robotPart").asString().data());
294 yDebug(
"RF: %s",rf.toString().data());
297 gImageSize=gRowStride*gHeight;
298 gMapSize=gWidth*gHeight*
sizeof(double);
299 gImageArea=gWidth*gHeight;
301 gpActivationMap=
new double[gImageArea];
302 gpImageBuff=
new uchar[gImageSize];
310 connect(
this,SIGNAL(
init()),
this,SLOT(onInit()),Qt::QueuedConnection);