本文整理汇总了C++中FPoint类的典型用法代码示例。如果您正苦于以下问题:C++ FPoint类的具体用法?C++ FPoint怎么用?C++ FPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLineF
void CanvasMode_EditArc::mouseMoveEvent(QMouseEvent *m)
{
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m->accept();
double newX = mousePointDoc.x();
double newY = mousePointDoc.y();
if (m_canvas->m_viewMode.m_MouseButtonPressed && m_view->moveTimerElapsed())
{
PageItem *currItem = m_doc->m_Selection->itemAt(0);
QTransform itemMatrix = currItem->getTransform();
QPointF sPoint = currItem->PoLine.pointQF(0);
QPointF smPoint = itemMatrix.map(sPoint);
QLineF stLinA = QLineF(smPoint, QPointF(m_Mxp, m_Myp));
QLineF stLinM = QLineF(smPoint, QPointF(newX, newY));
double deltaAngle = stLinM.angle() - stLinA.angle();
QPainterPath pp;
if (m_arcPoint == useControlStart)
m_startAngle += deltaAngle;
else if (m_arcPoint == useControlSweep)
m_endAngle += deltaAngle;
else if (m_arcPoint == useControlHeight)
m_heightPoint = QPointF(m_heightPoint.x(), m_heightPoint.y() + (newY - m_Myp));
else if (m_arcPoint == useControlWidth)
m_widthPoint = QPointF(m_widthPoint.x() + (newX - m_Mxp), m_widthPoint.y());
double nSweep = m_endAngle - m_startAngle;
if (nSweep < 0)
nSweep += 360;
double nWidth = sPoint.x() - m_widthPoint.x();
double nHeight = sPoint.y() - m_heightPoint.y();
if ((nWidth > 0) && (nHeight > 0))
{
pp.moveTo(sPoint);
pp.arcTo(QRectF(sPoint.x() - nWidth, sPoint.y() - nHeight, nWidth * 2, nHeight * 2), m_startAngle, nSweep);
pp.closeSubpath();
FPointArray ar;
ar.fromQPainterPath(pp);
if (m_arcPoint == useControlStart)
{
m_startPoint = ar.pointQF(2);
QLineF stLinA = QLineF(smPoint, itemMatrix.map(m_startPoint));
m_canvas->displayRotHUD(m->globalPos(), 360.0 - stLinA.angle());
}
else if (m_arcPoint == useControlSweep)
{
m_endPoint = ar.pointQF(ar.size() - 4);
QLineF stLinA = QLineF(smPoint, itemMatrix.map(m_endPoint));
m_canvas->displayRotHUD(m->globalPos(), 360.0 - stLinA.angle());
}
QLineF res = QLineF(m_centerPoint, m_startPoint);
QLineF swe = QLineF(m_centerPoint, m_endPoint);
vectorDialog->setValues(res.angle(), swe.angle(), nHeight * 2, nWidth * 2);
blockUpdateFromItem(true);
currItem->update();
blockUpdateFromItem(false);
m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, currItem->width(), currItem->height())).adjusted(-nWidth, -nHeight, nWidth, nHeight));
}
}
m_Mxp = newX;
m_Myp = newY;
}
示例2: currentItem
void ShapeView::startDrag(Qt::DropActions supportedActions)
{
QString key = currentItem()->data(Qt::UserRole).toString();
if (m_Shapes.contains(key))
{
int w = m_Shapes[key].width;
int h = m_Shapes[key].height;
ScribusDoc *m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(w, h, 0, 0, 0, 0, 0, 0, false, false);
m_Doc->addPage(0);
m_Doc->setGUI(false, m_scMW, 0);
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset(), w, h, m_Doc->itemToolPrefs().shapeLineWidth, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
PageItem* ite = m_Doc->Items->at(z);
ite->PoLine = m_Shapes[key].path.copy();
FPoint wh = getMaxClipF(&ite->PoLine);
ite->setWidthHeight(wh.x(),wh.y());
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->AdjustItemSize(ite);
ite->OldB2 = ite->width();
ite->OldH2 = ite->height();
ite->updateClip();
ite->ClipEdited = true;
ite->FrameType = 3;
m_Doc->m_Selection->addItem(ite, true);
ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, m_Doc->m_Selection);
QDrag* dr = new QDrag(this);
dr->setMimeData(md);
dr->setPixmap(currentItem()->icon().pixmap(QSize(48, 48)));
dr->exec();
delete m_Doc;
}
}
示例3: mouseMoveEvent
void CanvasMode_Magnifier::mouseMoveEvent(QMouseEvent *m)
{
// const double mouseX = m->globalX();
// const double mouseY = m->globalY();
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m_lastPosWasOverGuide = false;
double newX, newY;
m->accept();
if (commonMouseMove(m))
return;
if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(Myp + ((SeRx - Mxp) * m_view->visibleHeight()) / m_view->visibleWidth());
SeRx = newX;
SeRy = newY;
/*
m_view->redrawMarker->setGeometry(QRect(Mxp, Myp, m->globalPos().x() - Mxp, m->globalPos().y() - Myp).normalized());
*/
QPoint startP = m_canvas->canvasToGlobal(m_doc->appMode == modeDrawTable? QPointF(Dxp, Dyp) : QPointF(Mxp, Myp));
m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
if (!m_view->redrawMarker->isVisible())
m_view->redrawMarker->show();
m_view->HaveSelRect = true;
}
}
示例4: mousePressEvent
void ResizeGesture::mousePressEvent(QMouseEvent *m)
{
FPoint point = m_canvas->globalToCanvas(m->globalPos());
m_mousePressPoint = m->globalPos();
if (m_doc->m_Selection->count() == 0)
{
m_handle = Canvas::OUTSIDE;
}
else if (m_doc->m_Selection->isMultipleSelection())
{
double gx, gy, gh, gw;
m_doc->m_Selection->getVisualGroupRect(&gx, &gy, &gw, &gh);
m_handle = m_canvas->frameHitTest(QPointF(point.x(), point.y()), QRectF(gx,gy,gw,gh));
}
else
{
m_handle = m_canvas->frameHitTest(QPointF(point.x(), point.y()), m_doc->m_Selection->itemAt(0));
}
if (m_handle > 0)
{
prepare(m_handle);
m->accept();
m_mousePressBounds = m_bounds;
}
}
示例5: mouseHitsGuide
bool RulerGesture::mouseHitsGuide(FPoint mousePointDoc)
{
const int page = m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y());
if ((m_doc->guidesSettings.guidesShown) && (!m_doc->GuideLock) && page >= 0)
{
double grabRadScale = m_doc->guidesSettings.grabRad / m_canvas->scale();
int index = m_doc->Pages->at(page)->guides.isMouseOnVertical(mousePointDoc.x() + grabRadScale, mousePointDoc.x() - grabRadScale, GuideManagerCore::Standard);
if (index >= 0)
{
m_mode = VERTICAL;
m_haveGuide = true;
m_guide = m_doc->Pages->at(page)->guides.vertical(index, GuideManagerCore::Standard);
m_currentGuide = m_guide;
m_page = page;
return true;
}
index = m_doc->Pages->at(page)->guides.isMouseOnHorizontal(mousePointDoc.y() + grabRadScale, mousePointDoc.y() - grabRadScale, GuideManagerCore::Standard);
if (index >= 0)
{
m_mode = HORIZONTAL;
m_haveGuide = true;
m_guide = m_doc->Pages->at(page)->guides.horizontal(index, GuideManagerCore::Standard);
m_currentGuide = m_guide;
m_page = page;
return true;
}
}
m_haveGuide = false;
return false;
}
示例6: qRound
void CanvasMode_ObjImport::mousePressEvent(QMouseEvent *m)
{
// const double mouseX = m->globalX();
// const double mouseY = m->globalY();
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
double Rxp = 0, Ryp = 0;
m_canvas->PaintSizeRect(QRect());
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
// oldClip = 0;
m->accept();
m_view->registerMousePress(m->globalPos());
Mxp = mousePointDoc.x();
Myp = mousePointDoc.y();
Rxp = m_doc->ApplyGridF(FPoint(Mxp, Myp)).x();
Mxp = qRound(Rxp);
Ryp = m_doc->ApplyGridF(FPoint(Mxp, Myp)).y();
Myp = qRound(Ryp);
if (m->button() == Qt::MidButton)
{
m_view->MidButt = true;
if (m->modifiers() & Qt::ControlModifier)
m_view->DrawNew();
return;
}
}
示例7: while
void KCurve::keyPressEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace)
{
if (m_points.size() > 2)
{
FPoint closest_point = m_points.point(0);
FPoint p = m_points.point(0);
int pos = 0;
int cc = 0;
double distance = 1000; // just a big number
while(cc < m_points.size())
{
p = m_points.point(cc);
if (fabs (m_grab_point.x() - p.x()) < distance)
{
distance = fabs(m_grab_point.x() - p.x());
closest_point = p;
m_pos = pos;
}
cc++;
pos++;
}
FPointArray cli;
cli.putPoints(0, m_pos, m_points);
cli.putPoints(cli.size(), m_points.size()-m_pos-1, m_points, m_pos+1);
m_points.resize(0);
m_points = cli.copy();
m_grab_point = closest_point;
repaint();
emit modified();
QWidget::keyPressEvent(e);
}
}
}
示例8: drawItemOutlines
void CanvasMode_Rotate::drawItemOutlines(QPainter* p)
{
FPoint itemPos;
double itemRotation;
p->save();
QColor drawColor = qApp->palette().color(QPalette::Active, QPalette::Highlight);
p->setRenderHint(QPainter::Antialiasing);
p->setBrush(Qt::NoBrush);
p->setPen(QPen(drawColor, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
uint docSelectionCount = m_doc->m_Selection->count();
for (uint i = 0; i < docSelectionCount; ++i)
{
PageItem * currItem = m_doc->m_Selection->itemAt(i);
getNewItemPosition(currItem, itemPos, itemRotation);
p->save();
p->translate(itemPos.x(), itemPos.y());
p->rotate(itemRotation);
currItem->DrawPolyL(p, currItem->Clip);
p->restore();
}
p->restore();
}
示例9: qRound
void LineMove::adjustBounds(QMouseEvent *m)
{
FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
bool constrainRatio = ((m->modifiers() & Qt::ControlModifier) != Qt::NoModifier);
double newX = mousePointDoc.x();
double newY = mousePointDoc.y();
if (m_doc->useRaster)
{
newX = qRound(newX / m_doc->guidesSettings.minorGridSpacing) * m_doc->guidesSettings.minorGridSpacing;
newY = qRound(newY / m_doc->guidesSettings.minorGridSpacing) * m_doc->guidesSettings.minorGridSpacing;
}
//<<#8099
FPoint np2 = m_doc->ApplyGridF(FPoint(newX, newY));
double nx = np2.x();
double ny = np2.y();
m_doc->ApplyGuides(&nx, &ny);
newX = qRound(nx);
newY = qRound(ny);
//>>#8099
m_bounds.setBottomRight(QPointF(newX, newY));
//Constrain rotation angle, when the mouse is being dragged around for a new line
if (constrainRatio)
{
double newRot = rotation();
newRot = constrainAngle(newRot, m_doc->opToolPrefs.constrain);
setRotation(newRot);
}
// qDebug() << "LineMove::adjustBounds" << m_bounds << rotation() << length() << m_bounds.bottomRight();
m_view->updateCanvas(m_bounds.normalized().adjusted(-10, -10, 20, 20));
}
示例10: selectPage
void CalligraphicMode::selectPage(QMouseEvent *m)
{
m_MouseButtonPressed = true;
FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
Mxp = mousePointDoc.x(); //static_cast<int>(m->x()/m_canvas->scale());
Myp = mousePointDoc.y(); //static_cast<int>(m->y()/m_canvas->scale());
QRect mpo(m->x()-m_doc->guidesPrefs().grabRadius, m->y()-m_doc->guidesPrefs().grabRadius, m_doc->guidesPrefs().grabRadius*2, m_doc->guidesPrefs().grabRadius*2);
m_doc->nodeEdit.deselect();
m_view->Deselect(false);
if (!m_doc->masterPageMode())
{
int i = m_doc->OnPage(Mxp, Myp);
if (i!=-1)
{
uint docCurrPageNo=m_doc->currentPageNumber();
uint j=static_cast<uint>(i);
if (docCurrPageNo != j)
{
m_doc->setCurrentPage(m_doc->Pages->at(j));
m_view->m_ScMW->slotSetCurrentPage(j);
m_view->DrawNew();
}
}
}
}
示例11: drawLine
void ScPainterEx_GDI::drawLine(FPoint start, FPoint end)
{
newPath();
moveTo(start.x(), start.y());
lineTo(end.x(), end.y());
strokePath();
}
示例12: selectPage
void CanvasMode_FrameLinks::selectPage(QMouseEvent *m)
{
m_canvas->m_viewMode.m_MouseButtonPressed = true;
FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
Mxp = mousePointDoc.x(); //static_cast<int>(m->x()/m_canvas->scale());
Myp = mousePointDoc.y(); //static_cast<int>(m->y()/m_canvas->scale());
m_doc->nodeEdit.deselect();
m_view->Deselect(false);
if (!m_doc->masterPageMode())
{
int i = m_doc->OnPage(Mxp, Myp);
if (i!=-1)
{
uint docCurrPageNo=m_doc->currentPageNumber();
uint j=static_cast<uint>(i);
if (docCurrPageNo != j)
{
m_doc->setCurrentPage(m_doc->Pages->at(j));
m_view->setMenTxt(j);
m_view->DrawNew();
}
}
m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
}
}
示例13: transformPoint
void ScPainterEx_GDI::transformPoint( const FPoint& in, FPoint& out )
{
double x, y;
x = in.x() * m_matrix.m11() + in.y() * m_matrix.m21() + m_matrix.dx();
y = in.x() * m_matrix.m12() + in.y() * m_matrix.m22() + m_matrix.dy();
out.setX( x );
out.setY( y );
}
示例14: mouseMoveEvent
void CanvasMode_EditSpiral::mouseMoveEvent(QMouseEvent *m)
{
const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
m->accept();
double newX = mousePointDoc.x();
double newY = mousePointDoc.y();
if (m_canvas->m_viewMode.m_MouseButtonPressed && m_view->moveTimerElapsed() && (m_arcPoint != noPointDefined))
{
PageItem *currItem = m_doc->m_Selection->itemAt(0);
QTransform itemMatrix = currItem->getTransform();
PageItem_Spiral *item = currItem->asSpiral();
QPointF sPoint;
if (m_arcPoint == useControlStart)
sPoint = getSegment(m_startAngle);
else if (m_arcPoint == useControlEnd)
sPoint = getSegment(m_endAngle);
QPointF smPoint = itemMatrix.map(sPoint);
QLineF stLinA = QLineF(smPoint, QPointF(m_Mxp, m_Myp));
QLineF stLinM = QLineF(smPoint, QPointF(newX, newY));
double deltaAngle = stLinM.angle() - stLinA.angle();
if (deltaAngle < -180)
deltaAngle = deltaAngle + 360;
else if (deltaAngle > 180)
deltaAngle = deltaAngle - 360;
if (currItem->imageFlippedV())
deltaAngle *= -1.0;
if (currItem->imageFlippedH())
deltaAngle *= -1.0;
if (m_arcPoint == useControlStart)
{
if (m_startAngle + deltaAngle >= 0)
{
m_startAngle += deltaAngle;
applyValues(m_startAngle,m_endAngle,item->spiralFactor);
item->recalcPath();
m_startPoint = currItem->PoLine.pointQF(0);
m_canvas->displayRealRotHUD(m->globalPos(), m_startAngle);
}
m_VectorDialog->setValues(computeRealAngle(m_startAngle, false), computeRealAngle(m_endAngle, false), item->spiralFactor);
}
else if (m_arcPoint == useControlEnd)
{
if (m_endAngle + deltaAngle > m_startAngle)
{
m_endAngle += deltaAngle;
applyValues(m_startAngle,m_endAngle,item->spiralFactor);
item->recalcPath();
m_endPoint = currItem->PoLine.pointQF(currItem->PoLine.size() - 2);
m_canvas->displayRealRotHUD(m->globalPos(), m_endAngle);
}
m_VectorDialog->setValues(computeRealAngle(m_startAngle, false), computeRealAngle(m_endAngle, false), item->spiralFactor);
}
currItem->update();
m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, currItem->width(), currItem->height())).adjusted(-5, -5, 10, 10));
}
m_Mxp = newX;
m_Myp = newY;
}
示例15: doInvert
void CurveWidget::doInvert()
{
FPointArray curve = cDisplay->getCurve();
for (int a = 0; a < curve.size(); a++)
{
FPoint p = curve.point(a);
curve.setPoint(a, p.x(), 1.0 - p.y());
}
cDisplay->setCurve(curve);
}