void qQuantityWin::setData(QVector<int> size, QVector<double> result) { qs2(&size, 0, size.size()-1,&result ); QCPBarsGroup *group = new QCPBarsGroup(plot); QVector<double> tempSize(size.size()); for(int i=0;i<size.size();i++) tempSize[i]=(double)size[i]; plot->xAxis->setLabel("Size of bicluster"); plot->yAxis->setLabel("Count"); plot->xAxis->setNumberFormat("f"); plot->yAxis->setNumberFormat("f"); plot->xAxis->setNumberPrecision(0); plot->yAxis->setNumberPrecision(0); plot->axisRect()->setRangeZoom(Qt::Horizontal); //plot->axisRect()->setRangeDrag(Qt::Horizontal); double max = *std::max_element(result.begin(), result.end()); plot->xAxis->setRange(0,tempSize.last()); plot->yAxis->setRange(0,max); bars = new QCPBars(plot->xAxis,plot->yAxis); bars->setData(tempSize, result); bars->setBarsGroup(group); }
void X2DPacker::updatePutOperate(XObjectBox &objectBox,XBasicBox &basicBox,XBool needRotate,float positionX,float positionY) { XVec2 tempSize(0.0f); if(!needRotate) tempSize.set(objectBox.m_size); else tempSize.set(objectBox.m_size.y,objectBox.m_size.x); objectBox.m_basicBoxOrder = basicBox.m_order; objectBox.m_position.set(positionX,positionY); objectBox.m_AABB.set(positionX,positionY,positionX + tempSize.x,positionY + tempSize.y); //设置碰撞区域 objectBox.m_needRotate = needRotate; basicBox.m_objectBoxesOrder[basicBox.m_beUsed] = objectBox.m_order; //标记已经放入的物件的编号 ++ basicBox.m_beUsed; //标记已经放入了一个物件 basicBox.m_releaseAcreage -= objectBox.m_acreage; //减去已经放入的面积 }
/**************************************************** GetBestSize Returns the best (nominal) size for a cell using the checkbox celltype, with the given cell properties. Params: dc - device context to use to calc the size on size - return the best size in this param cell - pointer to a cell object to use for the calc. Return: <none> *****************************************************/ void CUGCheckBoxType::GetBestSize(CDC *dc,CSize *size,CUGCell *cell) { //select the font CFont * oldFont = NULL; //get the best size CSize tempSize(0,0); if (!( cell->GetCellTypeEx()&UGCT_CHECKBOXUSEALIGN )) { if(cell->IsPropertySet(UGCELL_FONT_SET)) oldFont = (CFont *)dc->SelectObject(cell->GetFont()); else if(m_ctrl->m_GI->m_defFont != NULL) oldFont = (CFont *)dc->SelectObject(m_ctrl->m_GI->m_defFont); if( cell->IsPropertySet(UGCELL_TEXT_SET)) { CRect rect(0,0,0,0); UINT style = DT_CALCRECT; if ( cell->GetCellTypeEx() == 0 ) style |= DT_SINGLELINE; if ( cell->GetCellTypeEx() & UGCT_NORMALSINGLELINE ) style |= DT_SINGLELINE; if ( cell->GetCellTypeEx() & UGCT_NORMALELLIPSIS ) style |= DT_END_ELLIPSIS; dc->DrawText( cell->GetLabelText(), rect, style ); tempSize.cx = rect.Width() + ( UGCT_CHECKMARGIN * 2 ); tempSize.cy = rect.Height(); } } //use margins tempSize.cx += ( UGCT_CHECKMARGIN * 2 ) + UGCT_CHECKSIZE; tempSize.cy += 2; //select back the original font if(oldFont != NULL) dc->SelectObject(oldFont); *size = tempSize; }