本文整理汇总了C++中QWMatrix::map方法的典型用法代码示例。如果您正苦于以下问题:C++ QWMatrix::map方法的具体用法?C++ QWMatrix::map怎么用?C++ QWMatrix::map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWMatrix
的用法示例。
在下文中一共展示了QWMatrix::map方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawShape
void ArrowLine::drawShape(QPainter &p)
{
p.setPen(darkGray);
QCanvasLine::drawShape(p);
double angle = computeAngle(startPoint().x(),
startPoint().y(),
endPoint().x(),
endPoint().y());
QPointArray pts(3);
QWMatrix m;
int x, y;
m.rotate(angle);
m.map(-5, -2, &x, &y);
pts.setPoint(0, x, y);
m.map(-5, 2, &x, &y);
pts.setPoint(1, x, y);
m.map(0, 0, &x, &y);
pts.setPoint(2, x, y);
pts.translate(endPoint().x(), endPoint().y());
p.setBrush(QColor(darkGray));
p.drawPolygon(pts);
}
示例2: slotUpdateResizeHandles
void MechanicsItemOverlay::slotUpdateResizeHandles()
{
const PositionInfo absPos = p_mechanicsItem->absolutePosition();
const QRect sizeRect = p_mechanicsItem->sizeRect();
QPointArray pa(9);
pa[0] = sizeRect.topLeft();
pa[2] = sizeRect.topRight();
pa[1] = (pa[0]+pa[2])/2;
pa[4] = sizeRect.bottomRight();
pa[3] = (pa[2]+pa[4])/2;
pa[6] = sizeRect.bottomLeft();
pa[5] = (pa[4]+pa[6])/2;
pa[7] = (pa[6]+pa[0])/2;
pa[8] = QPoint(0,0);
QWMatrix m;
m.rotate(absPos.angle() * DPR);
pa = m.map(pa);
m_tl->move( absPos.x()+pa[0].x(), absPos.y()+pa[0].y() );
m_tm->move( absPos.x()+pa[1].x(), absPos.y()+pa[1].y() );
m_tr->move( absPos.x()+pa[2].x(), absPos.y()+pa[2].y() );
m_mr->move( absPos.x()+pa[3].x(), absPos.y()+pa[3].y() );
m_br->move( absPos.x()+pa[4].x(), absPos.y()+pa[4].y() );
m_bm->move( absPos.x()+pa[5].x(), absPos.y()+pa[5].y() );
m_bl->move( absPos.x()+pa[6].x(), absPos.y()+pa[6].y() );
m_ml->move( absPos.x()+pa[7].x(), absPos.y()+pa[7].y() );
m_mm->move( absPos.x()+pa[8].x(), absPos.y()+pa[8].y() );
}
示例3: initPoints
void Node::initPoints() {
// Bounding rectangle, facing right
QPointArray pa(QRect(0, -8, m_length, 16));
QWMatrix m;
m.rotate(m_dir);
pa = m.map(pa);
setPoints(pa);
}
示例4: initPoints
void PinNode::initPoints()
{
int l = - m_length;
// Bounding rectangle, facing right
Q3PointArray pa( QRect( 0, -8, l, 16 ) );
QWMatrix m;
m.rotate( m_dir );
pa = m.map(pa);
setPoints(pa);
}
示例5: updateConnectorPoints
void CNItem::updateConnectorPoints( bool add )
{
if ( b_deleted || !isVisible() )
add = false;
if ( b_pointsAdded == add )
return;
b_pointsAdded = add;
Cells *cells = p_icnDocument->cells();
if (!cells)
return;
// Get translation matrix
// Hackish...
QWMatrix m;
if ( Component *c = dynamic_cast<Component*>(this) )
m = c->transMatrix( c->angleDegrees(), c->flipped(), int(x()), int(y()), false );
// Convention used here: _UM = unmapped by both matrix and cell reference, _M = mapped
const QPoint start_UM = QPoint( int(x()+offsetX())-8, int(y()+offsetY())-8 );
const QPoint end_UM = start_UM + QPoint( width()+2*8, height()+2*8 );
const QPoint start_M = roundDown( m.map(start_UM), 8 );
const QPoint end_M = roundDown( m.map(end_UM), 8 );
int sx_M = start_M.x();
int ex_M = end_M.x();
int sy_M = start_M.y();
int ey_M = end_M.y();
// Normalise start and end points
if ( sx_M > ex_M )
{
const int temp = sx_M;
sx_M = ex_M;
ex_M = temp;
}
if ( sy_M > ey_M )
{
const int temp = sy_M;
sy_M = ey_M;
ey_M = temp;
}
ex_M++;
ey_M++;
const int mult = add ? 1 : -1;
for ( int x = sx_M; x < ex_M; x++ )
{
for ( int y = sy_M; y < ey_M; y++ )
{
if ( cells->haveCell( x, y ) )
{
if ( x != sx_M && y != sy_M && x != (ex_M-1) && y != (ey_M-1) )
{
cells->cell( x, y ).CIpenalty += mult*ICNDocument::hs_item;
}
else
{
// (*cells)[x][y].CIpenalty += mult*ICNDocument::hs_item/2;
cells->cell( x, y ).CIpenalty += mult*ICNDocument::hs_connector*5;
}
}
}
}
#if 0
// And subtract the positions of the node on the border
NodeInfoMap::iterator end = m_nodeMap.end();
for ( NodeInfoMap::iterator it = m_nodeMap.begin(); it != end; ++it )
{
const int x = (int)((it->second.node->x()-4)/cellSize);
const int y = (int)((it->second.node->y()-4)/cellSize);
if ( p_icnDocument->isValidCellReference(x,y) ) {
(*cells)[x][y].CIpenalty -= mult*ICNDocument::hs_connector*5;
}
}
#endif
const TextMap::iterator textMapEnd = m_textMap.end();
for ( TextMap::iterator it = m_textMap.begin(); it != textMapEnd; ++it )
{
it.data()->updateConnectorPoints(add);
}
const WidgetMap::iterator widgetMapEnd = m_widgetMap.end();
for ( WidgetMap::iterator it = m_widgetMap.begin(); it != widgetMapEnd; ++it )
{
it.data()->updateConnectorPoints(add);
}
}